diff --git a/build/three.js b/build/three.js index 8cef988787387174b0bfbb0f6580183435aae5ae..7289e17c98170a5d30dfeae14e68d8bd71d1d711 100644 --- a/build/three.js +++ b/build/three.js @@ -2144,11 +2144,13 @@ }, - projectOnVector: function ( vector ) { + projectOnVector: function ( v ) { - var scalar = vector.dot( this ) / vector.lengthSq(); + // v cannot be the zero v - return this.copy( vector ).multiplyScalar( scalar ); + var scalar = v.dot( this ) / v.lengthSq(); + + return this.copy( v ).multiplyScalar( scalar ); }, @@ -2171,6 +2173,8 @@ angleTo: function ( v ) { + // assumes this and v are not the zero vector + var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) ); // clamp, to handle numerical problems @@ -11374,6 +11378,13 @@ var indices = geometry.index !== null ? geometry.index.array : undefined; var attributes = geometry.attributes; + if ( attributes.position === undefined ) { + + console.error( 'THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.' ); + return this; + + } + var positions = attributes.position.array; var normals = attributes.normal !== undefined ? attributes.normal.array : undefined; var colors = attributes.color !== undefined ? attributes.color.array : undefined; @@ -14039,7 +14050,7 @@ var color_vertex = "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif"; - var common = "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 projectionMatrix ) {\n return projectionMatrix[ 2 ][ 3 ] == - 1.0;\n}"; + var common = "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 projectionMatrix ) {\n return projectionMatrix[ 2 ][ 3 ] == - 1.0;\n}"; var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif"; @@ -14175,7 +14186,7 @@ var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif"; - var tonemapping_pars_fragment = "#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}"; + var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}"; var uv_pars_fragment = "#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif"; @@ -16371,6 +16382,8 @@ this.generateMipmaps = false; this.flipY = false; + this.needsUpdate = true; + } DataTexture2DArray.prototype = Object.create( Texture.prototype ); @@ -16403,6 +16416,9 @@ this.generateMipmaps = false; this.flipY = false; + this.needsUpdate = true; + + } DataTexture3D.prototype = Object.create( Texture.prototype ); @@ -17460,52 +17476,58 @@ } - function parseIncludes( string ) { + // Resolve Includes - var pattern = /^[ \t]*#include +<([\w\d./]+)>/gm; + var includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; - function replace( match, include ) { + function resolveIncludes( string ) { - var replace = ShaderChunk[ include ]; + return string.replace( includePattern, includeReplacer ); - if ( replace === undefined ) { + } - throw new Error( 'Can not resolve #include <' + include + '>' ); + function includeReplacer( match, include ) { - } + var string = ShaderChunk[ include ]; - return parseIncludes( replace ); + if ( string === undefined ) { + + throw new Error( 'Can not resolve #include <' + include + '>' ); } - return string.replace( pattern, replace ); + return resolveIncludes( string ); } - function unrollLoops( string ) { + // Unroll Loops - var pattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; + var loopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; - function replace( match, start, end, snippet ) { + function unrollLoops( string ) { - var unroll = ''; + return string.replace( loopPattern, loopReplacer ); - for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { + } - unroll += snippet - .replace( /\[ i \]/g, '[ ' + i + ' ]' ) - .replace( /UNROLLED_LOOP_INDEX/g, i ); + function loopReplacer( match, start, end, snippet ) { - } + var string = ''; + + for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { - return unroll; + string += snippet + .replace( /\[ i \]/g, '[ ' + i + ' ]' ) + .replace( /UNROLLED_LOOP_INDEX/g, i ); } - return string.replace( pattern, replace ); + return string; } + // + function generatePrecision( parameters ) { var precisionstring = "precision " + parameters.precision + " float;\nprecision " + parameters.precision + " int;"; @@ -17910,11 +17932,11 @@ } - vertexShader = parseIncludes( vertexShader ); + vertexShader = resolveIncludes( vertexShader ); vertexShader = replaceLightNums( vertexShader, parameters ); vertexShader = replaceClippingPlaneNums( vertexShader, parameters ); - fragmentShader = parseIncludes( fragmentShader ); + fragmentShader = resolveIncludes( fragmentShader ); fragmentShader = replaceLightNums( fragmentShader, parameters ); fragmentShader = replaceClippingPlaneNums( fragmentShader, parameters ); diff --git a/build/three.min.js b/build/three.min.js index 64200fe3f3e96cd1d604dfc04c0b21a9f5f3e559..48052c3f48c745831a08e2c977e36fd3db9cbae5 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,22 +1,22 @@ // threejs.org/license (function(k,Ba){"object"===typeof exports&&"undefined"!==typeof module?Ba(exports):"function"===typeof define&&define.amd?define(["exports"],Ba):(k=k||self,Ba(k.THREE={}))})(this,function(k){function Ba(){}function w(a,b){this.x=a||0;this.y=b||0}function sa(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function n(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function da(){this.elements=[1,0,0,0,1,0,0,0,1];0h)return!1}return!0}function nb(a,b){this.center=void 0!==a?a:new n;this.radius=void 0!==b?b:0}function Sb(a,b){this.origin=void 0!==a?a:new n;this.direction=void 0!==b?b:new n}function R(a,b,c){this.a=void 0!==a?a:new n;this.b=void 0!==b?b:new n;this.c=void 0!==c?c:new n}function H(a,b,c){return void 0===b&&void 0=== c?this.set(a):this.setRGB(a,b,c)}function Rf(a,b,c){0>c&&(c+=1);1c?b:c<2/3?a+6*(b-a)*(2/3-c):a}function Sf(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function Tf(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function zc(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new n;this.vertexNormals=Array.isArray(d)?d:[];this.color=e&&e.isColor?e:new H;this.vertexColors=Array.isArray(e)?e:[];this.materialIndex= -void 0!==f?f:0}function O(){Object.defineProperty(this,"id",{value:Qi++});this.uuid=L.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilWriteMask=255;this.stencilFunc= +void 0!==f?f:0}function O(){Object.defineProperty(this,"id",{value:Si++});this.uuid=L.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilWriteMask=255;this.stencilFunc= 519;this.stencilRef=0;this.stencilFuncMask=255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.needsUpdate=!0}function Ga(a){O.call(this);this.type="MeshBasicMaterial"; this.color=new H(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function M(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name="";this.array=a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function xd(a,b,c){M.call(this,new Int8Array(a),b,c)}function yd(a,b,c){M.call(this,new Uint8Array(a),b,c)}function zd(a,b,c){M.call(this,new Uint8ClampedArray(a),b,c)}function Ad(a,b,c){M.call(this,new Int16Array(a),b,c)}function Tb(a,b,c){M.call(this,new Uint16Array(a),b,c)}function Bd(a,b,c){M.call(this,new Int32Array(a),b,c)}function Ub(a, -b,c){M.call(this,new Uint32Array(a),b,c)}function A(a,b,c){M.call(this,new Float32Array(a),b,c)}function Cd(a,b,c){M.call(this,new Float64Array(a),b,c)}function hh(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function ih(a){if(0===a.length)return-Infinity; -for(var b=a[0],c=1,d=a.length;cb&&(b=a[c]);return b}function E(){Object.defineProperty(this,"id",{value:Ri+=2});this.uuid=L.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Y(a,b){B.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Ga({color:16777215*Math.random()}); -this.drawMode=0;this.updateMorphTargets()}function jh(a,b,c,d,e,f,g,h){if(null===(1===b.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==b.side,h)))return null;Ee.copy(h);Ee.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(Ee);return bc.far?null:{distance:b,point:Ee.clone(),object:a}}function Fe(a,b,c,d,e,f,g,h,l,m,q){Vb.fromBufferAttribute(e,l);Wb.fromBufferAttribute(e,m);Xb.fromBufferAttribute(e,q);e=a.morphTargetInfluences;if(b.morphTargets&&f&&e){Uf.set(0,0,0); -Vf.set(0,0,0);Wf.set(0,0,0);for(var u=0,t=f.length;ub&&(b=a[c]);return b}function E(){Object.defineProperty(this,"id",{value:Ti+=2});this.uuid=L.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Y(a,b){B.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Ga({color:16777215*Math.random()}); +this.drawMode=0;this.updateMorphTargets()}function kh(a,b,c,d,e,f,g,h){if(null===(1===b.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==b.side,h)))return null;Ee.copy(h);Ee.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(Ee);return bc.far?null:{distance:b,point:Ee.clone(),object:a}}function Fe(a,b,c,d,e,f,g,h,l,m,q){Vb.fromBufferAttribute(e,l);Wb.fromBufferAttribute(e,m);Xb.fromBufferAttribute(e,q);e=a.morphTargetInfluences;if(b.morphTargets&&f&&e){Uf.set(0,0,0); +Vf.set(0,0,0);Wf.set(0,0,0);for(var u=0,t=f.length;ug;g++)a.setRenderTarget(f,g),a.clear(b,c,d);a.setRenderTarget(e)}}function Ab(a,b,c){ka.call(this,a,b,c)}function Zb(a,b,c,d,e,f,g,h,l,m,q,u){W.call(this,null,f,g,h,l,m,d,e,q,u);this.image={data:a||null, width:b||1,height:c||1};this.magFilter=void 0!==l?l:1003;this.minFilter=void 0!==m?m:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1;this.needsUpdate=!0}function cb(a,b){this.normal=void 0!==a?a:new n(1,0,0);this.constant=void 0!==b?b:0}function Ed(a,b,c,d,e,f){this.planes=[void 0!==a?a:new cb,void 0!==b?b:new cb,void 0!==c?c:new cb,void 0!==d?d:new cb,void 0!==e?e:new cb,void 0!==f?f:new cb]}function Xf(){function a(e,f){!1!==c&&(d(e,f),b.requestAnimationFrame(a))}var b=null,c=!1, -d=null;return{start:function(){!0!==c&&null!==d&&(b.requestAnimationFrame(a),c=!0)},stop:function(){c=!1},setAnimationLoop:function(a){d=a},setContext:function(a){b=a}}}function Ti(a){function b(b,c){var d=b.array,e=b.dynamic?35048:35044,h=a.createBuffer();a.bindBuffer(c,h);a.bufferData(c,d,e);b.onUploadCallback();c=5126;d instanceof Float32Array?c=5126:d instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):d instanceof Uint16Array?c=5123:d instanceof +d=null;return{start:function(){!0!==c&&null!==d&&(b.requestAnimationFrame(a),c=!0)},stop:function(){c=!1},setAnimationLoop:function(a){d=a},setContext:function(a){b=a}}}function Vi(a){function b(b,c){var d=b.array,e=b.dynamic?35048:35044,h=a.createBuffer();a.bindBuffer(c,h);a.bufferData(c,d,e);b.onUploadCallback();c=5126;d instanceof Float32Array?c=5126:d instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):d instanceof Uint16Array?c=5123:d instanceof Int16Array?c=5122:d instanceof Uint32Array?c=5125:d instanceof Int32Array?c=5124:d instanceof Int8Array?c=5120:d instanceof Uint8Array&&(c=5121);return{buffer:h,type:c,bytesPerElement:d.BYTES_PER_ELEMENT,version:b.version}}var c=new WeakMap;return{get:function(a){a.isInterleavedBufferAttribute&&(a=a.data);return c.get(a)},remove:function(b){b.isInterleavedBufferAttribute&&(b=b.data);var d=c.get(b);d&&(a.deleteBuffer(d.buffer),c.delete(b))},update:function(d,e){d.isInterleavedBufferAttribute&&(d=d.data); var f=c.get(d);if(void 0===f)c.set(d,b(d,e));else if(f.versionm;m++){if(u=d[m])if(h=u[0],l=u[1]){q&&e.addAttribute("morphTarget"+m,q[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a, -"morphTargetInfluences",c)}}}function dj(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function ob(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];W.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,l,m);this.flipY=!1}function Ec(a,b,c,d){W.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001; -this.flipY=this.generateMipmaps=!1}function Fc(a,b,c,d){W.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function Gc(a,b,c){var d=a[0];if(0>=d||0/gm,function(a,c){a=N[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return Zf(a)})}function Ch(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);cm;m++){if(u=d[m])if(h=u[0],l=u[1]){q&&e.addAttribute("morphTarget"+m,q[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a, +"morphTargetInfluences",c)}}}function fj(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function ob(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];W.call(this,a,void 0!==b?b:301,c,d,e,f,void 0!==g?g:1022,h,l,m);this.flipY=!1}function Ec(a,b,c,d){W.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001; +this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function Fc(a,b,c,d){W.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function Gc(a,b,c){var d=a[0];if(0>=d||0");return a.replace($f,Zf)}function Dh(a,b,c,d){a="";for(b=parseInt(b);bc;c++)b.probe.push(new n);var d=new n,e=new V,f=new V;return{setup:function(c,h,l){for(var g=0,q=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var r=h=0,p=0,v=0,n=0,y=0,x=0,P=0;l=l.matrixWorldInverse;c.sort(bk);k=0;for(var S=c.length;kc;c++)b.probe.push(new n);var d=new n,e=new V,f=new V;return{setup:function(c,h,l){for(var g=0,q=0,u=0,k=0;9>k;k++)b.probe[k].set(0,0,0);var r=h=0,p=0,v=0,n=0,y=0,x=0,P=0;l=l.matrixWorldInverse;c.sort(dk);k=0;for(var S=c.length;kva;va++)b.probe[va].addScaledVector(C.sh.coefficients[va],w);else if(C.isDirectionalLight){var G=a.get(C);G.color.copy(C.color).multiplyScalar(C.intensity);G.direction.setFromMatrixPosition(C.matrixWorld);d.setFromMatrixPosition(C.target.matrixWorld);G.direction.sub(d);G.direction.transformDirection(l);if(G.shadow=C.castShadow)w=C.shadow,G.shadowBias=w.bias,G.shadowRadius=w.radius,G.shadowMapSize=w.mapSize,b.directionalShadowMap[h]=va,b.directionalShadowMatrix[h]= C.shadow.matrix,y++;b.directional[h]=G;h++}else if(C.isSpotLight){G=a.get(C);G.position.setFromMatrixPosition(C.matrixWorld);G.position.applyMatrix4(l);G.color.copy(Cb).multiplyScalar(w);G.distance=A;G.direction.setFromMatrixPosition(C.matrixWorld);d.setFromMatrixPosition(C.target.matrixWorld);G.direction.sub(d);G.direction.transformDirection(l);G.coneCos=Math.cos(C.angle);G.penumbraCos=Math.cos(C.angle*(1-C.penumbra));G.decay=C.decay;if(G.shadow=C.castShadow)w=C.shadow,G.shadowBias=w.bias,G.shadowRadius= w.radius,G.shadowMapSize=w.mapSize,b.spotShadowMap[p]=va,b.spotShadowMatrix[p]=C.shadow.matrix,P++;b.spot[p]=G;p++}else if(C.isRectAreaLight)G=a.get(C),G.color.copy(Cb).multiplyScalar(w),G.position.setFromMatrixPosition(C.matrixWorld),G.position.applyMatrix4(l),f.identity(),e.copy(C.matrixWorld),e.premultiply(l),f.extractRotation(e),G.halfWidth.set(.5*C.width,0,0),G.halfHeight.set(0,.5*C.height,0),G.halfWidth.applyMatrix4(f),G.halfHeight.applyMatrix4(f),b.rectArea[v]=G,v++;else if(C.isPointLight){G= a.get(C);G.position.setFromMatrixPosition(C.matrixWorld);G.position.applyMatrix4(l);G.color.copy(C.color).multiplyScalar(C.intensity);G.distance=C.distance;G.decay=C.decay;if(G.shadow=C.castShadow)w=C.shadow,G.shadowBias=w.bias,G.shadowRadius=w.radius,G.shadowMapSize=w.mapSize,G.shadowCameraNear=w.camera.near,G.shadowCameraFar=w.camera.far,b.pointShadowMap[r]=va,b.pointShadowMatrix[r]=C.shadow.matrix,x++;b.point[r]=G;r++}else C.isHemisphereLight&&(G=a.get(C),G.direction.setFromMatrixPosition(C.matrixWorld), G.direction.transformDirection(l),G.direction.normalize(),G.skyColor.copy(C.color).multiplyScalar(w),G.groundColor.copy(C.groundColor).multiplyScalar(w),b.hemi[n]=G,n++)}b.ambient[0]=g;b.ambient[1]=q;b.ambient[2]=u;c=b.hash;if(c.directionalLength!==h||c.pointLength!==r||c.spotLength!==p||c.rectAreaLength!==v||c.hemiLength!==n||c.numDirectionalShadows!==y||c.numPointShadows!==x||c.numSpotShadows!==P)b.directional.length=h,b.spot.length=p,b.rectArea.length=v,b.point.length=r,b.hemi.length=n,b.directionalShadowMap.length= -y,b.pointShadowMap.length=x,b.spotShadowMap.length=P,b.directionalShadowMatrix.length=y,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=P,c.directionalLength=h,c.pointLength=r,c.spotLength=p,c.rectAreaLength=v,c.hemiLength=n,c.numDirectionalShadows=y,c.numPointShadows=x,c.numSpotShadows=P,b.version=dk++},state:b}}function Fh(){var a=new ck,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, -pushShadow:function(a){c.push(a)}}}function ek(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var e=new Fh;b.set(c,new WeakMap);b.get(c).set(d,e);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(e=new Fh,b.get(c).set(d,e)):e=b.get(c).get(d);return e},dispose:function(){b=new WeakMap}}}function Db(a){O.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap= -this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Eb(a){O.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Gh(a,b,c){function d(b, +y,b.pointShadowMap.length=x,b.spotShadowMap.length=P,b.directionalShadowMatrix.length=y,b.pointShadowMatrix.length=x,b.spotShadowMatrix.length=P,c.directionalLength=h,c.pointLength=r,c.spotLength=p,c.rectAreaLength=v,c.hemiLength=n,c.numDirectionalShadows=y,c.numPointShadows=x,c.numSpotShadows=P,b.version=fk++},state:b}}function Hh(){var a=new ek,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(a){b.push(a)}, +pushShadow:function(a){c.push(a)}}}function gk(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var e=new Hh;b.set(c,new WeakMap);b.get(c).set(d,e);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(e=new Hh,b.get(c).set(d,e)):e=b.get(c).get(d);return e},dispose:function(){b=new WeakMap}}}function Db(a){O.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap= +this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.setValues(a)}function Eb(a){O.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new n;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Ih(a,b,c){function d(b, c,d,e,f,g){var h=b.geometry;var l=m;var p=b.customDepthMaterial;d.isPointLight&&(l=q,p=b.customDistanceMaterial);p?l=p:(p=!1,c.morphTargets&&(h&&h.isBufferGeometry?p=h.morphAttributes&&h.morphAttributes.position&&0c||g.y>c)console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),g.x>c&&(h.x=Math.floor(c/X.x), g.x=h.x*X.x,U.mapSize.x=h.x),g.y>c&&(h.y=Math.floor(c/X.y),g.y=h.y*X.y,U.mapSize.y=h.y);null!==U.map||U.isPointLightShadow||3!==this.type||(X={minFilter:1006,magFilter:1006,format:1023},U.map=new ka(g.x,g.y,X),U.map.texture.name=y.name+".shadowMap",U.mapPass=new ka(g.x,g.y,X),U.camera.updateProjectionMatrix());null===U.map&&(X={minFilter:1003,magFilter:1003,format:1023},U.map=new ka(g.x,g.y,X),U.map.texture.name=y.name+".shadowMap",U.camera.updateProjectionMatrix());a.setRenderTarget(U.map);a.clear(); X=U.getViewportCount();for(var P=0;Pd||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?L.floorPowerOfTwo:Math.floor, +a.polygonOffsetUnits)},setFlipSided:m,setCullFace:q,setLineWidth:function(b){b!==ac&&(dg&&a.lineWidth(b),ac=b)},setPolygonOffset:u,setScissorTest:function(a){a?g(3089):h(3089)},activeTexture:k,bindTexture:function(b,c){null===Pa&&k();var d=eg[Pa];void 0===d&&(d={type:void 0,texture:void 0},eg[Pa]=d);if(d.type!==b||d.texture!==c)a.bindTexture(b,c||K[b]),d.type=b,d.texture=c},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:",Z)}}, +texImage2D:function(){try{a.texImage2D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:",Z)}},texImage3D:function(){try{a.texImage3D.apply(a,arguments)}catch(Z){console.error("THREE.WebGLState:",Z)}},scissor:function(b){!1===F.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),F.copy(b))},viewport:function(b){!1===O.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),O.copy(b))},reset:function(){for(var b=0;bd||a.height>d)e=d/Math.max(a.width,a.height);if(1>e||!0===b){if("undefined"!==typeof HTMLImageElement&&a instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&a instanceof ImageBitmap)return d=b?L.floorPowerOfTwo:Math.floor, b=d(e*a.width),e=d(e*a.height),void 0===G&&(G=h(b,e)),c=c?h(b,e):G,c.width=b,c.height=e,c.getContext("2d").drawImage(a,0,0,b,e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+b+"x"+e+")."),c;"data"in a&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").")}return a}function m(a){return L.isPowerOfTwo(a.width)&&L.isPowerOfTwo(a.height)}function q(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!== a.minFilter}function u(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function k(a,c){if(!e.isWebGL2)return a;var d=a;6403===a&&(5126===c&&(d=33326),5131===c&&(d=33325),5121===c&&(d=33321));6407===a&&(5126===c&&(d=34837),5131===c&&(d=34843),5121===c&&(d=32849));6408===a&&(5126===c&&(d=34836),5131===c&&(d=34842),5121===c&&(d=32856));33325===d||33326===d||34842===d||34836===d?b.get("EXT_color_buffer_float"):(34843===d||34837===d)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."); return d}function r(a){return 1003===a||1004===a||1005===a?9728:9729}function p(b){b=b.target;b.removeEventListener("dispose",p);var c=d.get(b);void 0!==c.__webglInit&&(a.deleteTexture(c.__webglTexture),d.remove(b));b.isVideoTexture&&va.delete(b);g.memory.textures--}function v(b){b=b.target;b.removeEventListener("dispose",v);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e= @@ -151,34 +151,34 @@ h.texture,y),w(l.__webglFramebuffer,h,36064,3553),q(h.texture,y)&&u(3553,h.textu d.get(h.depthTexture).__webglTexture&&h.depthTexture.image.width===h.width&&h.depthTexture.image.height===h.height||(h.depthTexture.image.width=h.width,h.depthTexture.image.height=h.height,h.depthTexture.needsUpdate=!0);n(h.depthTexture,0);l=d.get(h.depthTexture).__webglTexture;if(1026===h.depthTexture.format)a.framebufferTexture2D(36160,36096,3553,l,0);else if(1027===h.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,l,0);else throw Error("Unknown depthTexture format");}else if(p)for(l.__webglDepthbuffer= [],p=0;6>p;p++)a.bindFramebuffer(36160,l.__webglFramebuffer[p]),l.__webglDepthbuffer[p]=a.createRenderbuffer(),A(l.__webglDepthbuffer[p],h);else a.bindFramebuffer(36160,l.__webglFramebuffer),l.__webglDepthbuffer=a.createRenderbuffer(),A(l.__webglDepthbuffer,h);a.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(a){var b=a.texture,f=m(a)||e.isWebGL2;if(q(b,f)){f=a.isWebGLRenderTargetCube?34067:3553;var g=d.get(b).__webglTexture;c.bindTexture(f,g);u(f,b,a.width,a.height);c.bindTexture(f, null)}};this.updateMultisampleRenderTarget=function(b){if(b.isWebGLMultisampleRenderTarget)if(e.isWebGL2){var c=d.get(b);a.bindFramebuffer(36008,c.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,c.__webglFramebuffer);c=b.width;var f=b.height,g=16384;b.depthBuffer&&(g|=256);b.stencilBuffer&&(g|=1024);a.blitFramebuffer(0,0,c,f,0,0,c,f,g,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(a,b){a&&a.isWebGLRenderTarget&& -(!1===H&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),H=!0),a=a.texture);n(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Hh(a,b,c){return{convert:function(a){if(1E3=== +(!1===H&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),H=!0),a=a.texture);n(a,b)};this.safeSetTextureCube=function(a,b){a&&a.isWebGLRenderTargetCube&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),D=!0),a=a.texture);a&&a.isCubeTexture||Array.isArray(a.image)&&6===a.image.length?y(a,b):x(a,b)}}function Jh(a,b,c){return{convert:function(a){if(1E3=== a)return 10497;if(1001===a)return 33071;if(1002===a)return 33648;if(1003===a)return 9728;if(1004===a)return 9984;if(1005===a)return 9986;if(1006===a)return 9729;if(1007===a)return 9985;if(1008===a)return 9987;if(1009===a)return 5121;if(1017===a)return 32819;if(1018===a)return 32820;if(1019===a)return 33635;if(1010===a)return 5120;if(1011===a)return 5122;if(1012===a)return 5123;if(1013===a)return 5124;if(1014===a)return 5125;if(1015===a)return 5126;if(1016===a){if(c.isWebGL2)return 5131;var d=b.get("OES_texture_half_float"); if(null!==d)return d.HALF_FLOAT_OES}if(1021===a)return 6406;if(1022===a)return 6407;if(1023===a)return 6408;if(1024===a)return 6409;if(1025===a)return 6410;if(1026===a)return 6402;if(1027===a)return 34041;if(1028===a)return 6403;if(100===a)return 32774;if(101===a)return 32778;if(102===a)return 32779;if(200===a)return 0;if(201===a)return 1;if(202===a)return 768;if(203===a)return 769;if(204===a)return 770;if(205===a)return 771;if(206===a)return 772;if(207===a)return 773;if(208===a)return 774;if(209=== a)return 775;if(210===a)return 776;if(33776===a||33777===a||33778===a||33779===a)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===a)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===a||35841===a||35842===a||35843===a)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===a)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841=== a)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return a;if(103===a||104===a){if(c.isWebGL2){if(103=== -a)return 32775;if(104===a)return 32776}d=b.get("EXT_blend_minmax");if(null!==d){if(103===a)return d.MIN_EXT;if(104===a)return d.MAX_EXT}}if(1020===a){if(c.isWebGL2)return 34042;d=b.get("WEBGL_depth_texture");if(null!==d)return d.UNSIGNED_INT_24_8_WEBGL}return 0}}}function eg(a,b,c,d){ka.call(this,a,b,d);this.stencilBuffer=this.depthBuffer=!1;this.numViews=c}function hk(a,b){function c(a){if(a.isArrayCamera)return a.cameras;k[0]=a;return k}function d(a){if(!a.isArrayCamera)return!0;a=a.cameras;if(a.length> -g)return!1;for(var b=1,c=a.length;b +g)return!1;for(var b=1,c=a.length;be.far||f.push({distance:a,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,object:g}))}function kg(a,b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,q,k){W.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a, +function Me(a,b){wa.call(this,a,b);this.type="LineLoop"}function Qa(a){O.call(this);this.type="PointsMaterial";this.color=new H(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(a)}function Kc(a,b){B.call(this);this.type="Points";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Qa({color:16777215*Math.random()});this.updateMorphTargets()}function jg(a,b,c,d,e,f,g){var h=kg.distanceSqToPoint(a);he.far||f.push({distance:a,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,object:g}))}function lg(a,b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,q,k){W.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a, b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Qd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);W.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){E.call(this);this.type= "WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d=l.length;mc;c++){var k=q[h[c]];var t=q[h[(c+1)%3]];f[0]=Math.min(k,t);f[1]=Math.max(k,t);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;q=a.index;var r=a.groups; 0===r.length&&(r=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=r.length;ac;c++)k=q.getX(m+c),t=q.getX(m+(c+1)%3),f[0]=Math.min(k,t),f[1]=Math.max(k,t),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l, @@ -251,24 +251,24 @@ b,c,d,e,f));this.mergeVertices()}function Rc(a,b,c,d,e,f){function g(a,b,c,d,e){ g(w,e,f,a,p);g(w+.01,e,f,a,v);y.subVectors(v,p);x.addVectors(v,p);z.crossVectors(y,x);x.crossVectors(z,y);z.normalize();x.normalize();for(w=0;w<=d;++w){var S=w/d*Math.PI*2,C=-b*Math.cos(S);S=b*Math.sin(S);t.x=p.x+(C*x.x+S*z.x);t.y=p.y+(C*x.y+S*z.y);t.z=p.z+(C*x.z+S*z.z);l.push(t.x,t.y,t.z);r.subVectors(t,p).normalize();m.push(r.x,r.y,r.z);q.push(k/c);q.push(w/d)}}for(w=1;w<=c;w++)for(k=1;k<=d;k++)a=(d+1)*w+(k-1),b=(d+1)*w+k,e=(d+1)*(w-1)+k,h.push((d+1)*(w-1)+(k-1),a,e),h.push(a,b,e);this.setIndex(h); this.addAttribute("position",new A(l,3));this.addAttribute("normal",new A(m,3));this.addAttribute("uv",new A(q,2))}function Zd(a,b,c,d,e){F.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};this.fromBufferGeometry(new Sc(a,b,c,d,e));this.mergeVertices()}function Sc(a,b,c,d,e){E.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||1;b=b||.4;c=Math.floor(c)||8;d=Math.floor(d)|| 6;e=e||2*Math.PI;var f=[],g=[],h=[],l=[],m=new n,q=new n,k=new n,t,r;for(t=0;t<=c;t++)for(r=0;r<=d;r++){var p=r/d*e,v=t/c*Math.PI*2;q.x=(a+b*Math.cos(v))*Math.cos(p);q.y=(a+b*Math.cos(v))*Math.sin(p);q.z=b*Math.sin(v);g.push(q.x,q.y,q.z);m.x=a*Math.cos(p);m.y=a*Math.sin(p);k.subVectors(q,m).normalize();h.push(k.x,k.y,k.z);l.push(r/d);l.push(t/c)}for(t=1;t<=c;t++)for(r=1;r<=d;r++)a=(d+1)*(t-1)+r-1,b=(d+1)*(t-1)+r,e=(d+1)*t+r,f.push((d+1)*t+r-1,a,e),f.push(a,b,e);this.setIndex(f);this.addAttribute("position", -new A(g,3));this.addAttribute("normal",new A(h,3));this.addAttribute("uv",new A(l,2))}function Oh(a,b,c,d,e){for(var f,g=0,h=b,l=c-d;h=b;e-=d)f=Ph(e,a[e],a[e+1],f);f&&ec(f,f.next)&&($d(f),f=f.next);return f}function ae(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!ec(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{$d(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} -function be(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=lg(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,q,k,t,r=1;do{l=h;var p=h=null;for(q=0;l;){q++;var n=l;for(m=k=0;mn!==p.next.y>n&&p.next.y!==p.y&&k<(p.next.x-p.x)*(n-p.y)/(p.next.y-p.y)+p.x&&(q=!q),p=p.next;while(p!==l);p=q}l=p}if(l){a=Rh(g,h);g=ae(g,g.next);a=ae(a,a.next);be(g,b,c,d,e,f);be(a,b,c,d,e,f);break a}h= -h.next}g=g.next}while(g!==a)}break}}}}function ik(a,b,c,d){var e=a.prev,f=a.next;if(0<=qa(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=lg(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, -f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function jk(a,b){return a.x-b.x}function kk(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= -g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Tc(eh.x)&&ce(c,a)&&(h=c,m=q)}c=c.next}return h}function lg(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b| -b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function lk(a){var b=a,c=a;do{if(b.xqa(a.prev,a,a.next)?0<=qa(a,b,a.next)&&0<=qa(a,a.prev,b):0>qa(a,b,a.prev)||0>qa(a,a.next,b)}function Rh(a,b){var c=new mg(a.i,a.x,a.y),d=new mg(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Ph(a,b,c,d){a=new mg(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function $d(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ= -a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function mg(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Sh(a){var b=a.length;2=b;e-=d)f=Rh(e,a[e],a[e+1],f);f&&ec(f,f.next)&&($d(f),f=f.next);return f}function ae(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!ec(a,a.next)&&0!==qa(a.prev,a,a.next))a=a.next;else{$d(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} +function be(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=mg(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,q,k,t,r=1;do{l=h;var p=h=null;for(q=0;l;){q++;var n=l;for(m=k=0;mn!==p.next.y>n&&p.next.y!==p.y&&k<(p.next.x-p.x)*(n-p.y)/(p.next.y-p.y)+p.x&&(q=!q),p=p.next;while(p!==l);p=q}l=p}if(l){a=Th(g,h);g=ae(g,g.next);a=ae(a,a.next);be(g,b,c,d,e,f);be(a,b,c,d,e,f);break a}h= +h.next}g=g.next}while(g!==a)}break}}}}function kk(a,b,c,d){var e=a.prev,f=a.next;if(0<=qa(e,a,f))return!1;var g=e.x>a.x?e.x>f.x?e.x:f.x:a.x>f.x?a.x:f.x,h=e.y>a.y?e.y>f.y?e.y:f.y:a.y>f.y?a.y:f.y,l=mg(e.x=l&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y, +f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=l;){if(c!==a.prev&&c!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,c.x,c.y)&&0<=qa(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&Tc(e.x,e.y,a.x,a.y,f.x,f.y,d.x,d.y)&&0<=qa(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function lk(a,b){return a.x-b.x}function mk(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f= +g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&Tc(eh.x)&&ce(c,a)&&(h=c,m=q)}c=c.next}return h}function mg(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b| +b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function nk(a){var b=a,c=a;do{if(b.xqa(a.prev,a,a.next)?0<=qa(a,b,a.next)&&0<=qa(a,a.prev,b):0>qa(a,b,a.prev)||0>qa(a,a.next,b)}function Th(a,b){var c=new ng(a.i,a.x,a.y),d=new ng(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev=c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function Rh(a,b,c,d){a=new ng(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function $d(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ= +a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ng(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Uh(a){var b=a.length;2Number.EPSILON){var l=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/l;b=b.y+d/l;g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new w(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)=== Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new w(f/e,d/e)}function h(a,b){for(K=a.length;0<=--K;){var c=K;var f=K-1;0>f&&(f=a.length-1);var g,h=x+2*E;for(g=0;gk;k++){var u=m[f[k]];var n=m[f[(k+1)%3]];d[0]=Math.min(u,n);d[1]=Math.max(u,n);u=d[0]+","+d[1];void 0===e[u]?e[u]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[u].face2=h}for(u in e)if(d=e[u],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new A(c,3))}function ic(a,b,c,d, e,f,g,h){F.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new qb(a,b,c,d,e,f,g,h));this.mergeVertices()}function qb(a,b,c,d,e,f,g,h){function l(c){var e,f=new w,l=new n,q=0,v=!0===c?a:b,x=!0===c?1:-1;var A=p;for(e=1;e<=d;e++)u.push(0,z*x,0),t.push(0,x,0),r.push(.5,.5),p++;var B=p;for(e=0;e<=d;e++){var E=e/d*h+g,D=Math.cos(E);E=Math.sin(E);l.x=v*E;l.y=z*x; l.z=v*D;u.push(l.x,l.y,l.z);t.push(0,x,0);f.x=.5*D+.5;f.y=.5*E*x+.5;r.push(f.x,f.y);p++}for(e=0;ethis.duration&&this.resetDuration()}function nk(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c; -case "vector":case "vector2":case "vector3":case "vector4":return ad;case "color":return Qe;case "quaternion":return le;case "bool":case "boolean":return Pe;case "string":return Se}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function ok(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=nk(a.type);if(void 0===a.times){var c=[],d=[];ta.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name, -a.times,a.values,a.interpolation)}function ng(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0,l=[];this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h= -a;return this};this.addHandler=function(a,b){l.push(a,b);return this};this.removeHandler=function(a){a=l.indexOf(a);-1!==a&&l.splice(a,2);return this};this.getHandler=function(a){for(var b=0,c=l.length;bthis.duration&&this.resetDuration()}function pk(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return $c; +case "vector":case "vector2":case "vector3":case "vector4":return ad;case "color":return Qe;case "quaternion":return le;case "bool":case "boolean":return Pe;case "string":return Se}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function qk(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=pk(a.type);if(void 0===a.times){var c=[],d=[];ta.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name, +a.times,a.values,a.interpolation)}function og(a,b,c){var d=this,e=!1,f=0,g=0,h=void 0,l=[];this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){g++;if(!1===e&&void 0!==d.onStart)d.onStart(a,f,g);e=!0};this.itemEnd=function(a){f++;if(void 0!==d.onProgress)d.onProgress(a,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(a){if(void 0!==d.onError)d.onError(a)};this.resolveURL=function(a){return h?h(a):a};this.setURLModifier=function(a){h= +a;return this};this.addHandler=function(a,b){l.push(a,b);return this};this.removeHandler=function(a){a=l.indexOf(a);-1!==a&&l.splice(a,2);return this};this.getHandler=function(a){for(var b=0,c=l.length;ba;a++)this.coefficients.push(new n)}function Xa(a,b){ca.call(this,void 0,b);this.sh=void 0!==a?a:new kf}function wg(a,b,c){Xa.call(this, -void 0,c);a=(new H).set(a);c=(new H).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function xg(a,b){Xa.call(this,void 0,b);a=(new H).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Yh(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= -!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function yg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function zg(){B.call(this);this.type="AudioListener";this.context=Ag.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new yg}function dd(a){B.call(this); -this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function Bg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function Cg(a,b){this.analyser= -a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Dg(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function Zh(a,b,c){c=c||Aa.parseTrackName(b); -this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function Aa(a,b,c){this.path=b;this.parsedPath=c||Aa.parseTrackName(b);this.node=Aa.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function $h(){this.uuid=L.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats= -{objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function ai(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex= -this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Eg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function lf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b); -this.value=a}function Fg(a,b,c){Gb.call(this,a,b);this.meshPerAttribute=c||1}function bi(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function ci(a,b){return a.distance-b.distance}function Gg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b, -c),!0===d)){a=a.children;d=0;for(var e=a.length;da;a++)this.coefficients.push(new n)}function Xa(a,b){ca.call(this,void 0,b);this.sh=void 0!==a?a:new kf}function xg(a,b,c){Xa.call(this, +void 0,c);a=(new H).set(a);c=(new H).set(b);b=new n(a.r,a.g,a.b);a=new n(c.r,c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function yg(a,b){Xa.call(this,void 0,b);a=(new H).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function $h(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new ja;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate= +!1;this.cameraR=new ja;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function zg(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Ag(){B.call(this);this.type="AudioListener";this.context=Bg.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new zg}function dd(a){B.call(this); +this.type="Audio";this.listener=a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function Cg(a){dd.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function Dg(a,b){this.analyser= +a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Eg(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function ai(a,b,c){c=c||Aa.parseTrackName(b); +this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function Aa(a,b,c){this.path=b;this.parsedPath=c||Aa.parseTrackName(b);this.node=Aa.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function bi(){this.uuid=L.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats= +{objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function ci(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex= +this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Fg(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function lf(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b); +this.value=a}function Gg(a,b,c){Gb.call(this,a,b);this.meshPerAttribute=c||1}function di(a,b,c,d){this.ray=new Sb(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function ei(a,b){return a.distance-b.distance}function Hg(a,b,c,d){if(!1!==a.visible&&(a.raycast(b, +c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Q({fog:!1});this.cone=new ba(a,b);this.add(this.cone);this.update()}function fi(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;cc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new Q({fog:!1});this.cone=new ba(a,b);this.add(this.cone);this.update()}function hi(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca?-1:0a?-1:0we;we++)ua[we]=(16>we?"0":"")+ we.toString(16);var L={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(ua[a&255]+ua[a>>8&255]+ua[a>>16&255]+ua[a>>24&255]+"-"+ua[b&255]+ua[b>>8&255]+"-"+ua[b>>16&15|64]+ua[b>>24&255]+"-"+ua[c&63|128]+ua[c>>8&255]+"-"+ua[c>>16&255]+ua[c>>24&255]+ua[d&255]+ua[d>>8&255]+ua[d>>16&255]+ua[d>>24&255]).toUpperCase()},clamp:function(a,b,c){return Math.max(b,Math.min(c, @@ -360,18 +360,18 @@ b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));retu this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w; var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this._onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g* f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize(),this._onChangeCallback(),this;a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this._onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2]; -this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Lg=new n,ii=new sa;Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= +this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var Mg=new n,ki=new sa;Object.assign(n.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this}, add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= -a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(ii.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(ii.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]* +a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(ki.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(ki.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]* d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-l*-e;return this}, project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/ a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a, Math.min(b,this.z));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= 0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+ Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this, -a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){Lg.copy(this).projectOnVector(a);return this.sub(Lg)},reflect:function(a){return this.sub(Lg.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(L.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, +a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){Mg.copy(this).projectOnVector(a);return this.sub(Mg)},reflect:function(a){return this.sub(Mg.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(L.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))}, distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta, a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x=== this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var qc=new n;Object.assign(da.prototype,{isMatrix3:!0,set:function(a, @@ -382,7 +382,7 @@ var c=a.elements;a=this.elements;var d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],l=c[5],m transpose:function(){var a=this.elements;var b=a[1];a[1]=a[3];a[3]=b;b=a[2];a[2]=a[6];a[6]=b;b=a[5];a[5]=a[7];a[7]=b;return this},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},setUvTransform:function(a,b,c,d,e,f,g){var h=Math.cos(e);e=Math.sin(e);this.set(c*h,c*e,-c*(h*f+e*g)+f+a,-d*e,d*h,-d*(-e*f+h*g)+g+ b,0,0,1)},scale:function(a,b){var c=this.elements;c[0]*=a;c[3]*=a;c[6]*=a;c[1]*=b;c[4]*=b;c[7]*=b;return this},rotate:function(a){var b=Math.cos(a);a=Math.sin(a);var c=this.elements,d=c[0],e=c[3],f=c[6],g=c[1],h=c[4],l=c[7];c[0]=b*d+a*g;c[3]=b*e+a*h;c[6]=b*f+a*l;c[1]=-a*d+b*g;c[4]=-a*e+b*h;c[7]=-a*f+b*l;return this},translate:function(a,b){var c=this.elements;c[0]+=a*c[2];c[3]+=a*c[5];c[6]+=a*c[8];c[1]+=b*c[2];c[4]+=b*c[5];c[7]+=b*c[8];return this},equals:function(a){var b=this.elements;a=a.elements; for(var c=0;9>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var md,Kb={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===md&&(md=document.createElementNS("http://www.w3.org/1999/xhtml", -"canvas"));md.width=a.width;md.height=a.height;var b=md.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=md}return 2048this.determinant()&&(e=-e);a.x=d[12];a.y=d[13];a.z=d[14];ra.copy(this);a=1/e;d=1/f;var h=1/g;ra.elements[0]*=a;ra.elements[1]*=a;ra.elements[2]*=a;ra.elements[4]*=d;ra.elements[5]*=d;ra.elements[6]*=d;ra.elements[8]*=h;ra.elements[9]*=h;ra.elements[10]*=h;b.setFromRotationMatrix(ra);c.x=e;c.y=f;c.z=g;return this},makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; -a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var ji=new V,ki=new sa;Qb.RotationOrders= +a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var li=new V,mi=new sa;Qb.RotationOrders= "XYZ YZX ZXY XZY YXZ ZYX".split(" ");Qb.DefaultOrder="XYZ";Object.defineProperties(Qb.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},order:{get:function(){return this._order},set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(Qb.prototype,{isEuler:!0,set:function(a, b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=L.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],l=e[5],m=e[9],k=e[2],n=e[6];e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.9999999>Math.abs(g)? (this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,l),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.9999999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.9999999>Math.abs(n)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.9999999>Math.abs(k)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)): (this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.9999999>Math.abs(f)?(this._x=Math.atan2(n,l),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;!1!==c&&this._onChangeCallback();return this},setFromQuaternion:function(a, -b,c){ji.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(ji,b,c)},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(a){ki.setFromEuler(this);return this.setFromQuaternion(ki,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a= +b,c){li.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(li,b,c)},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(a){mi.setFromEuler(this);return this.setFromQuaternion(mi,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a= []);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new n(this._x,this._y,this._z)},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});Object.assign(Pf.prototype,{set:function(a){this.mask=1<= +a.max.equals(this.max)}});var xk=new ab;Object.assign(nb.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a,b){var c=this.center;void 0!==b?c.copy(b):xk.setFromPoints(a).getCenter(c);for(var d=b=0,e=a.length;d= this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a); void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new n);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new ab);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this}, -translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});var wb=new n,Mg=new n,uf=new n,Ob=new n,Ng=new n,vf=new n,Og=new n;Object.assign(Sb.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){void 0===b&&(console.warn("THREE.Ray: .at() target is now required"), +translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});var wb=new n,Ng=new n,uf=new n,Ob=new n,Og=new n,vf=new n,Pg=new n;Object.assign(Sb.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){void 0===b&&(console.warn("THREE.Ray: .at() target is now required"), b=new n);return b.copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(a){this.origin.copy(this.at(a,wb));return this},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new n);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))}, -distanceSqToPoint:function(a){var b=wb.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);wb.copy(this.direction).multiplyScalar(b).add(this.origin);return wb.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){Mg.copy(a).add(b).multiplyScalar(.5);uf.copy(b).sub(a).normalize();Ob.copy(this.origin).sub(Mg);var e=.5*a.distanceTo(b),f=-this.direction.dot(uf),g=Ob.dot(this.direction),h=-Ob.dot(uf),l=Ob.lengthSq(),m=Math.abs(1-f*f);if(0b)return this.origin.distanceToSquared(a);wb.copy(this.direction).multiplyScalar(b).add(this.origin);return wb.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){Ng.copy(a).add(b).multiplyScalar(.5);uf.copy(b).sub(a).normalize();Ob.copy(this.origin).sub(Ng);var e=.5*a.distanceTo(b),f=-this.direction.dot(uf),g=Ob.dot(this.direction),h=-Ob.dot(uf),l=Ob.lengthSq(),m=Math.abs(1-f*f);if(0=-k?b<=k?(e=1/m,a*=e,b*=e,f=a*(a+f*b+2*g)+b*(f*a+b+2*h)+l):(b=e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):(b=-e,a=Math.max(0,-(f*b+g)),f=-a*a+b*(b+2*h)+l):b<=-k?(a=Math.max(0,-(-f*e+g)),b=0a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ +d&&d.copy(uf).multiplyScalar(b).add(Ng);return f},intersectSphere:function(a,b){wb.subVectors(a.center,this.origin);var c=wb.dot(this.direction),d=wb.dot(wb)-c*c;a=a.radius*a.radius;if(d>a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y- -f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,wb)},intersectTriangle:function(a,b,c,d,e){Ng.subVectors(b,a);vf.subVectors(c,a);Og.crossVectors(Ng,vf);b=this.direction.dot(Og);if(0b)d=-1,b=-b;else return null; -Ob.subVectors(this.origin,a);a=d*this.direction.dot(vf.crossVectors(Ob,vf));if(0>a)return null;c=d*this.direction.dot(Ng.cross(Ob));if(0>c||a+c>b)return null;a=-d*Ob.dot(Og);return 0>a?null:this.at(a/b,e)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var Ya=new n,xb=new n,Pg=new n,yb=new n,rd=new n,sd=new n,pi=new n,Qg=new n,Rg=new n,Sg=new n;Object.assign(R, -{getNormal:function(a,b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new n);d.subVectors(c,b);Ya.subVectors(a,b);d.cross(Ya);a=d.lengthSq();return 0d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,wb)},intersectTriangle:function(a,b,c,d,e){Og.subVectors(b,a);vf.subVectors(c,a);Pg.crossVectors(Og,vf);b=this.direction.dot(Pg);if(0b)d=-1,b=-b;else return null; +Ob.subVectors(this.origin,a);a=d*this.direction.dot(vf.crossVectors(Ob,vf));if(0>a)return null;c=d*this.direction.dot(Og.cross(Ob));if(0>c||a+c>b)return null;a=-d*Ob.dot(Pg);return 0>a?null:this.at(a/b,e)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var Ya=new n,xb=new n,Qg=new n,yb=new n,rd=new n,sd=new n,ri=new n,Rg=new n,Sg=new n,Tg=new n;Object.assign(R, +{getNormal:function(a,b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new n);d.subVectors(c,b);Ya.subVectors(a,b);d.cross(Ya);a=d.lengthSq();return 0=yb.x+yb.y},getUV:function(a,b,c,d,e,f,g,h){this.getBarycoord(a,b,c,d,yb);h.set(0,0);h.addScaledVector(e,yb.x);h.addScaledVector(f,yb.y);h.addScaledVector(g,yb.z);return h},isFrontFacing:function(a,b,c,d){Ya.subVectors(c,b);xb.subVectors(a,b);return 0>Ya.cross(xb).dot(d)?!0:!1}});Object.assign(R.prototype,{set:function(a,b, c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){Ya.subVectors(this.c,this.b);xb.subVectors(this.a,this.b);return.5*Ya.cross(xb).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"), a=new n);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return R.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new n);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return R.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,e){return R.getUV(a,this.a,this.b,this.c,b,c,d,e)},containsPoint:function(a){return R.containsPoint(a, -this.a,this.b,this.c)},isFrontFacing:function(a){return R.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new n);var c=this.a,d=this.b,e=this.c;rd.subVectors(d,c);sd.subVectors(e,c);Qg.subVectors(a,c);var f=rd.dot(Qg),g=sd.dot(Qg);if(0>=f&&0>=g)return b.copy(c);Rg.subVectors(a,d);var h=rd.dot(Rg),l=sd.dot(Rg);if(0<=h&&l<= -h)return b.copy(d);var m=f*l-h*g;if(0>=m&&0<=f&&0>=h)return d=f/(f-h),b.copy(c).addScaledVector(rd,d);Sg.subVectors(a,e);a=rd.dot(Sg);var k=sd.dot(Sg);if(0<=k&&a<=k)return b.copy(e);f=a*g-f*k;if(0>=f&&0<=g&&0>=k)return m=g/(g-k),b.copy(c).addScaledVector(sd,m);g=h*k-a*l;if(0>=g&&0<=l-h&&0<=a-k)return pi.subVectors(e,d),m=(l-h)/(l-h+(a-k)),b.copy(d).addScaledVector(pi,m);e=1/(g+f+m);d=f*e;m*=e;return b.copy(c).addScaledVector(rd,d).addScaledVector(sd,m)},equals:function(a){return a.a.equals(this.a)&& -a.b.equals(this.b)&&a.c.equals(this.c)}});var wk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017, +this.a,this.b,this.c)},isFrontFacing:function(a){return R.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new n);var c=this.a,d=this.b,e=this.c;rd.subVectors(d,c);sd.subVectors(e,c);Rg.subVectors(a,c);var f=rd.dot(Rg),g=sd.dot(Rg);if(0>=f&&0>=g)return b.copy(c);Sg.subVectors(a,d);var h=rd.dot(Sg),l=sd.dot(Sg);if(0<=h&&l<= +h)return b.copy(d);var m=f*l-h*g;if(0>=m&&0<=f&&0>=h)return d=f/(f-h),b.copy(c).addScaledVector(rd,d);Tg.subVectors(a,e);a=rd.dot(Tg);var k=sd.dot(Tg);if(0<=k&&a<=k)return b.copy(e);f=a*g-f*k;if(0>=f&&0<=g&&0>=k)return m=g/(g-k),b.copy(c).addScaledVector(sd,m);g=h*k-a*l;if(0>=g&&0<=l-h&&0<=a-k)return ri.subVectors(e,d),m=(l-h)/(l-h+(a-k)),b.copy(d).addScaledVector(ri,m);e=1/(g+f+m);d=f*e;m*=e;return b.copy(c).addScaledVector(rd,d).addScaledVector(sd,m)},equals:function(a){return a.a.equals(this.a)&& +a.b.equals(this.b)&&a.c.equals(this.c)}});var yk={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017, darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504, green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734, lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734, @@ -478,13 +478,13 @@ steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turqu this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){a=L.euclideanModulo(a,1);b=L.clamp(b,0,1);c=L.clamp(c,0,1);0===b?this.r=this.g=this.b=c:(b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=Rf(c,b,a+1/3),this.g=Rf(c,b,a),this.b=Rf(c,b,a-1/3));return this},setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c= /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100, parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r= -parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0=h?l/(e+f):l/(2-e-f);switch(e){case b:g=(c- d)/l+(cg;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cg;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;c\n\t#include \n}", fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}",side:1,blending:0});d.uniforms.tEquirect.value=b;b=new Y(new Gd(5, -5,5),d);c.add(b);d=new Dc(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Zb.prototype=Object.create(W.prototype);Zb.prototype.constructor=Zb;Zb.prototype.isDataTexture=!0;var Yg=new n,yk=new n,zk=new da;Object.assign(cb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, -b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=Yg.subVectors(c,b).cross(yk.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*= +5,5),d);c.add(b);d=new Dc(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Zb.prototype=Object.create(W.prototype);Zb.prototype.constructor=Zb;Zb.prototype.isDataTexture=!0;var Zg=new n,Ak=new n,Bk=new da;Object.assign(cb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a, +b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=Zg.subVectors(c,b).cross(Ak.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*= -1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new n);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(a,b){void 0===b&&(console.warn("THREE.Plane: .intersectLine() target is now required"),b=new n);var c= -a.delta(Yg),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else if(d=-(a.start.dot(this.normal)+this.constant)/d,!(0>d||1b&&0a&&0d||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],u=c[9],t=c[10],r=c[11],p=c[12],v=c[13],z=c[14];c=c[15];b[0].setComponents(f-a,k-g,r-n,c-p).normalize();b[1].setComponents(f+a,k+g,r+n,c+p).normalize();b[2].setComponents(f+ d,k+h,r+u,c+v).normalize();b[3].setComponents(f-d,k-h,r-u,c-v).normalize();b[4].setComponents(f-e,k-l,r-t,c-z).normalize();b[5].setComponents(f+e,k+l,r+t,c+z).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();td.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)},intersectsSprite:function(a){td.center.set(0,0,0);td.radius=.7071067811865476;td.applyMatrix4(a.matrixWorld);return this.intersectsSphere(td)}, intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)c;c++){var d=b[c];zf.x=0d.distanceToPoint(zf))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var N={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", @@ -587,7 +587,7 @@ aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform flo bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif", -color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 projectionMatrix ) {\n return projectionMatrix[ 2 ][ 3 ] == - 1.0;\n}", +color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 projectionMatrix ) {\n return projectionMatrix[ 2 ][ 3 ] == - 1.0;\n}", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif", defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif", emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}", @@ -621,7 +621,7 @@ shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#prag shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif", -specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}", +specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}", uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif", worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}", cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}", @@ -659,278 +659,278 @@ I.fog,{matcap:{value:null}}]),vertexShader:N.meshmatcap_vert,fragmentShader:N.me I.displacementmap,{opacity:{value:1}}]),vertexShader:N.normal_vert,fragmentShader:N.normal_frag},sprite:{uniforms:Ea([I.sprite,I.fog]),vertexShader:N.sprite_vert,fragmentShader:N.sprite_frag},background:{uniforms:{uvTransform:{value:new da},t2D:{value:null}},vertexShader:N.background_vert,fragmentShader:N.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:N.cube_vert,fragmentShader:N.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:N.equirect_vert, fragmentShader:N.equirect_frag},distanceRGBA:{uniforms:Ea([I.common,I.displacementmap,{referencePosition:{value:new n},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:N.distanceRGBA_vert,fragmentShader:N.distanceRGBA_frag},shadow:{uniforms:Ea([I.lights,I.fog,{color:{value:new H(0)},opacity:{value:1}}]),vertexShader:N.shadow_vert,fragmentShader:N.shadow_frag}};db.physical={uniforms:Ea([db.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new H(0)}, clearcoatNormalScale:{value:new w(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:N.meshphysical_vert,fragmentShader:N.meshphysical_frag};Fd.prototype=Object.create(F.prototype);Fd.prototype.constructor=Fd;$b.prototype=Object.create(E.prototype);$b.prototype.constructor=$b;ob.prototype=Object.create(W.prototype);ob.prototype.constructor=ob;ob.prototype.isCubeTexture=!0;Object.defineProperty(ob.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});Ec.prototype= -Object.create(W.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isDataTexture2DArray=!0;Fc.prototype=Object.create(W.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDataTexture3D=!0;var th=new W,nj=new Ec,pj=new Fc,uh=new ob,nh=[],ph=[],sh=new Float32Array(16),rh=new Float32Array(9),qh=new Float32Array(4);vh.prototype.updateCache=function(a){var b=this.cache;a instanceof Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));Ha(b,a)};wh.prototype.setValue=function(a, +Object.create(W.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isDataTexture2DArray=!0;Fc.prototype=Object.create(W.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isDataTexture3D=!0;var uh=new W,pj=new Ec,rj=new Fc,vh=new ob,oh=[],qh=[],th=new Float32Array(16),sh=new Float32Array(9),rh=new Float32Array(4);wh.prototype.updateCache=function(a){var b=this.cache;a instanceof Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));Ha(b,a)};xh.prototype.setValue=function(a, b,c){for(var d=this.seq,e=0,f=d.length;e!==f;++e){var g=d[e];g.setValue(a,b[g.id],c)}};var Yf=/([\w\d_]+)(\])?(\[|\.)?/g;Bb.prototype.setValue=function(a,b,c,d){b=this.map[b];void 0!==b&&b.setValue(a,c,d)};Bb.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};Bb.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}};Bb.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in -b&&c.push(f)}return c};var Uj=0,dk=0;Db.prototype=Object.create(O.prototype);Db.prototype.constructor=Db;Db.prototype.isMeshDepthMaterial=!0;Db.prototype.copy=function(a){O.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth= -a.wireframeLinewidth;return this};Eb.prototype=Object.create(O.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isMeshDistanceMaterial=!0;Eb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias= -a.displacementBias;return this};eg.prototype=Object.assign(Object.create(ka.prototype),{constructor:eg,isWebGLMultiviewRenderTarget:!0,copy:function(a){ka.prototype.copy.call(this,a);this.numViews=a.numViews;return this},setNumViews:function(a){this.numViews!==a&&(this.numViews=a,this.dispose());return this}});Hc.prototype=Object.assign(Object.create(B.prototype),{constructor:Hc,isGroup:!0});Jd.prototype=Object.assign(Object.create(ja.prototype),{constructor:Jd,isArrayCamera:!0});var Jh=new n,Kh= -new n;Object.assign(fg.prototype,Ba.prototype);Object.assign(Lh.prototype,Ba.prototype);Object.assign(Ie.prototype,{isFogExp2:!0,clone:function(){return new Ie(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(Je.prototype,{isFog:!0,clone:function(){return new Je(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(Gb.prototype, -"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Gb.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.stride;c*=b.stride;for(var d=0,e=this.stride;da.far||b.push({distance:e,point:ze.clone(),uv:R.getUV(ze,Af,Ae,Bf,ri,Zg,si,new w),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){B.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var Cf=new n,ti=new n;Nd.prototype=Object.assign(Object.create(B.prototype), -{constructor:Nd,isLOD:!0,copy:function(a){B.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=b[c].distance)b[c-1].object.visible=!1,b[c].object.visible=!0;else break;for(;cc||(h.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(h),ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=q.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(h), -ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(h),ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry, -this.material)).copy(this)}});var Ef=new n,Ff=new n;ba.prototype=Object.assign(Object.create(wa.prototype),{constructor:ba,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,e=b.count;d=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Lc.prototype=Object.create(W.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isCompressedTexture=!0;Pd.prototype=Object.create(W.prototype);Pd.prototype.constructor=Pd;Pd.prototype.isCanvasTexture=!0;Qd.prototype=Object.create(W.prototype);Qd.prototype.constructor=Qd;Qd.prototype.isDepthTexture=!0;Mc.prototype=Object.create(E.prototype);Mc.prototype.constructor=Mc;Rd.prototype=Object.create(F.prototype);Rd.prototype.constructor= -Rd;Nc.prototype=Object.create(E.prototype);Nc.prototype.constructor=Nc;Sd.prototype=Object.create(F.prototype);Sd.prototype.constructor=Sd;Da.prototype=Object.create(E.prototype);Da.prototype.constructor=Da;Td.prototype=Object.create(F.prototype);Td.prototype.constructor=Td;Oc.prototype=Object.create(Da.prototype);Oc.prototype.constructor=Oc;Ud.prototype=Object.create(F.prototype);Ud.prototype.constructor=Ud;cc.prototype=Object.create(Da.prototype);cc.prototype.constructor=cc;Vd.prototype=Object.create(F.prototype); -Vd.prototype.constructor=Vd;Pc.prototype=Object.create(Da.prototype);Pc.prototype.constructor=Pc;Wd.prototype=Object.create(F.prototype);Wd.prototype.constructor=Wd;Qc.prototype=Object.create(Da.prototype);Qc.prototype.constructor=Qc;Xd.prototype=Object.create(F.prototype);Xd.prototype.constructor=Xd;dc.prototype=Object.create(E.prototype);dc.prototype.constructor=dc;dc.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};Yd.prototype=Object.create(F.prototype); -Yd.prototype.constructor=Yd;Rc.prototype=Object.create(E.prototype);Rc.prototype.constructor=Rc;Zd.prototype=Object.create(F.prototype);Zd.prototype.constructor=Zd;Sc.prototype=Object.create(E.prototype);Sc.prototype.constructor=Sc;var Bk={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=Oh(a,0,e,c,!0),g=[];if(!f||f.next===f.prev)return g;var h;if(d){var l=c;d=[];var k;var n=0;for(k=b.length;n80*c){var r=h=a[0];var p=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-r,d-p);h=0!==h?1/h:0}be(f,g,c,r,p,h);return g}},pb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;epb.area(a)},triangulateShape:function(a,b){var c=[], -d=[],e=[];Sh(a);Th(c,a);var f=a.length;b.forEach(Sh);for(a=0;aMath.abs(g-l)?[new w(a,1-c),new w(h,1-d),new w(k,1-e),new w(u,1-b)]:[new w(g,1-c),new w(l,1-d),new w(n,1-e),new w(t, -1-b)]}};de.prototype=Object.create(F.prototype);de.prototype.constructor=de;Uc.prototype=Object.create(eb.prototype);Uc.prototype.constructor=Uc;ee.prototype=Object.create(F.prototype);ee.prototype.constructor=ee;Ib.prototype=Object.create(E.prototype);Ib.prototype.constructor=Ib;fe.prototype=Object.create(F.prototype);fe.prototype.constructor=fe;Vc.prototype=Object.create(E.prototype);Vc.prototype.constructor=Vc;ge.prototype=Object.create(F.prototype);ge.prototype.constructor=ge;Wc.prototype=Object.create(E.prototype); -Wc.prototype.constructor=Wc;gc.prototype=Object.create(F.prototype);gc.prototype.constructor=gc;gc.prototype.toJSON=function(){var a=F.prototype.toJSON.call(this);return Vh(this.parameters.shapes,a)};hc.prototype=Object.create(E.prototype);hc.prototype.constructor=hc;hc.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);return Vh(this.parameters.shapes,a)};Xc.prototype=Object.create(E.prototype);Xc.prototype.constructor=Xc;ic.prototype=Object.create(F.prototype);ic.prototype.constructor= -ic;qb.prototype=Object.create(E.prototype);qb.prototype.constructor=qb;he.prototype=Object.create(ic.prototype);he.prototype.constructor=he;ie.prototype=Object.create(qb.prototype);ie.prototype.constructor=ie;je.prototype=Object.create(F.prototype);je.prototype.constructor=je;Yc.prototype=Object.create(E.prototype);Yc.prototype.constructor=Yc;var xa=Object.freeze({WireframeGeometry:Mc,ParametricGeometry:Rd,ParametricBufferGeometry:Nc,TetrahedronGeometry:Td,TetrahedronBufferGeometry:Oc,OctahedronGeometry:Ud, -OctahedronBufferGeometry:cc,IcosahedronGeometry:Vd,IcosahedronBufferGeometry:Pc,DodecahedronGeometry:Wd,DodecahedronBufferGeometry:Qc,PolyhedronGeometry:Sd,PolyhedronBufferGeometry:Da,TubeGeometry:Xd,TubeBufferGeometry:dc,TorusKnotGeometry:Yd,TorusKnotBufferGeometry:Rc,TorusGeometry:Zd,TorusBufferGeometry:Sc,TextGeometry:de,TextBufferGeometry:Uc,SphereGeometry:ee,SphereBufferGeometry:Ib,RingGeometry:fe,RingBufferGeometry:Vc,PlaneGeometry:Fd,PlaneBufferGeometry:$b,LatheGeometry:ge,LatheBufferGeometry:Wc, -ShapeGeometry:gc,ShapeBufferGeometry:hc,ExtrudeGeometry:fc,ExtrudeBufferGeometry:eb,EdgesGeometry:Xc,ConeGeometry:he,ConeBufferGeometry:ie,CylinderGeometry:ic,CylinderBufferGeometry:qb,CircleGeometry:je,CircleBufferGeometry:Yc,BoxGeometry:Xg,BoxBufferGeometry:Gd});jc.prototype=Object.create(O.prototype);jc.prototype.constructor=jc;jc.prototype.isShadowMaterial=!0;jc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);return this};Zc.prototype=Object.create(la.prototype); -Zc.prototype.constructor=Zc;Zc.prototype.isRawShaderMaterial=!0;fb.prototype=Object.create(O.prototype);fb.prototype.constructor=fb;fb.prototype.isMeshStandardMaterial=!0;fb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive); -this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio= -a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};kc.prototype=Object.create(fb.prototype);kc.prototype.constructor=kc;kc.prototype.isMeshPhysicalMaterial=!0;kc.prototype.copy=function(a){fb.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity= -a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness=a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new H).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.transparency=a.transparency;return this};Ra.prototype=Object.create(O.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isMeshPhongMaterial=!0;Ra.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular); -this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale; -this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};lc.prototype=Object.create(Ra.prototype); -lc.prototype.constructor=lc;lc.prototype.isMeshToonMaterial=!0;lc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};mc.prototype=Object.create(O.prototype);mc.prototype.constructor=mc;mc.prototype.isMeshNormalMaterial=!0;mc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap= -a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};nc.prototype=Object.create(O.prototype);nc.prototype.constructor=nc;nc.prototype.isMeshLambertMaterial=!0;nc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap; -this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin= -a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};oc.prototype=Object.create(O.prototype);oc.prototype.constructor=oc;oc.prototype.isMeshMatcapMaterial=!0;oc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale); -this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};pc.prototype=Object.create(Q.prototype);pc.prototype.constructor=pc;pc.prototype.isLineDashedMaterial=!0;pc.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Ck= -Object.freeze({ShadowMaterial:jc,SpriteMaterial:Hb,RawShaderMaterial:Zc,ShaderMaterial:la,PointsMaterial:Qa,MeshPhysicalMaterial:kc,MeshStandardMaterial:fb,MeshPhongMaterial:Ra,MeshToonMaterial:lc,MeshNormalMaterial:mc,MeshLambertMaterial:nc,MeshDepthMaterial:Db,MeshDistanceMaterial:Eb,MeshBasicMaterial:Ga,MeshMatcapMaterial:oc,LineDashedMaterial:pc,LineBasicMaterial:Q,Material:O}),ta={arraySlice:function(a,b,c){return ta.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b, -c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,l=0;l!==b;++l)e[g++]=a[h+l];return e},flattenJSON:function(a, -b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};Object.assign(Ia.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex, -d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ta.arraySlice(c,e,f),this.values=ta.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times; -b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ta.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.", -this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(L.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(L.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);$g.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);ah.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);bh.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&($g.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),ah.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),bh.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set($g.calc(a), -ah.calc(a),bh.calc(a));return b};ya.prototype.copy=function(a){D.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(Xh(d,e.x,f.x,g.x,c.x),Xh(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){D.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths(); -return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Jb;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints()); -l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var t=0,r=f.length;tb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1));b.addScale(e[7],1.092548*c*a);b.addScale(e[8], -.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1],1.023328*d);b.addScale(e[2],1.023328*a);b.addScale(e[3],1.023328*c);b.addScale(e[4],.858086*c*d);b.addScale(e[5],.858086*d*a);b.addScale(e[6],.743125*a*a-.247708);b.addScale(e[7],.858086*c*a);b.addScale(e[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b= -0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c],b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a, -b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(kf,{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(ca.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){ca.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity= -a.intensity;return this},toJSON:function(a){return ca.prototype.toJSON.call(this,a)}});wg.prototype=Object.assign(Object.create(Xa.prototype),{constructor:wg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});xg.prototype=Object.assign(Object.create(Xa.prototype),{constructor:xg,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this, -a)}});var Bi=new V,Ci=new V;Object.assign(Yh.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov||b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(L.DEG2RAD*b.fov*.5)/b.zoom;Ci.elements[12]=-d;Bi.elements[12]=d; -d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d=-f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(Ci);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(Bi)}});Object.assign(yg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now(); -this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var vc=new n,Di=new sa,Ek=new n,wc=new n;zg.prototype=Object.assign(Object.create(B.prototype), -{constructor:zg,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter); -this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(a){B.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(vc,Di,Ek);wc.set(0,0,-1).applyQuaternion(Di);if(a.positionX){var c=this.context.currentTime+this.timeDelta; -a.positionX.linearRampToValueAtTime(vc.x,c);a.positionY.linearRampToValueAtTime(vc.y,c);a.positionZ.linearRampToValueAtTime(vc.z,c);a.forwardX.linearRampToValueAtTime(wc.x,c);a.forwardY.linearRampToValueAtTime(wc.y,c);a.forwardZ.linearRampToValueAtTime(wc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(vc.x,vc.y,vc.z),a.setOrientation(wc.x,wc.y,wc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(B.prototype), -{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setMediaStreamSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaStreamNode";this.source=this.context.createMediaStreamSource(a);this.connect(); -return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset, -this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); -else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c, -a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){sa.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h= -b+g;a[h]=a[h]*f+a[c+g]*d}}});var Gk=/[\[\]\.:\/]/g,Hk="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Ik=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Jk=/(WCOD+)?/.source.replace("WCOD",Hk),Kk=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Lk=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Mk=new RegExp("^"+Ik+Jk+Kk+Lk+"$"),Nk=["material","materials","bones"];Object.assign(Zh.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_]; -void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(Aa,{Composite:Zh,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new Aa.Composite(a,b,c):new Aa(a, -b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(Gk,"")},parseTrackName:function(a){var b=Mk.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var d=b.nodeName.substring(c+1);-1!==Nk.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+ -a);return b},findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var n=b++,u=a[n];c[u.uuid]=k;a[k]=u;c[l]=n;a[n]=h;h=0;for(l=e;h!==l;++h){u=d[h];var t=u[k];u[k]=u[n];u[n]=t}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var l= -arguments[g].uuid,k=d[l];if(void 0!==k)if(delete d[l],kb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0];b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1=== -e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else{this.time=b;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=b;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished? -this.paused=!0:this.enabled=!1,this.time=b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this.time=b,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:d}))}else this.time=b;if(f&&1===(e&1))return c-b}return b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd= -b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}});Eg.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Eg,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName, -k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m=d[h],n=m.name,u=k[n];if(void 0===u){u=f[h];if(void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,g,n));continue}u=new Dg(Aa.create(c,n,b&&b._propertyBindings[h].binding.parsedPath),m.ValueTypeName,m.getValueSize());++u.referenceCount;this._addInactiveBinding(u,g,n)}f[h]=u;a[h].resultBuffer=u.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid, -c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions= -[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}, -_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new w);return b.set((a.x-this.min.x)/(this.max.x-this.min.x), -(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new w);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Fi.copy(a).clamp(this.min,this.max).sub(a).length()},intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min); -this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Gi=new n,Jf=new n;Object.assign(Ig.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"), -a=new n);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new n);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=new n);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(a, -b){Gi.subVectors(a,this.start);Jf.subVectors(this.end,this.start);a=Jf.dot(Jf);a=Jf.dot(Gi)/a;b&&(a=L.clamp(a,0,1));return a},closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new n);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}}); -pe.prototype=Object.create(B.prototype);pe.prototype.constructor=pe;pe.prototype.isImmediateRenderObject=!0;var mb=new n,zb=new n,fh=new da,Ok=["a","b","c"];qe.prototype=Object.create(ba.prototype);qe.prototype.constructor=qe;qe.prototype.update=function(){this.object.updateMatrixWorld(!0);fh.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,b=this.geometry.attributes.position,c=this.object.geometry;if(c&&c.isGeometry)for(var d=c.vertices,e=c.faces,f=c=0,g=e.length;fMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side= -0>b?1:0;this.lookAt(this.plane.normal);B.prototype.updateMatrixWorld.call(this,a)};var Ni=new n,pf,Jg;tb.prototype=Object.create(B.prototype);tb.prototype.constructor=tb;tb.prototype.setDirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(Ni.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(Ni,Math.acos(a.y)))};tb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(1E-4,a-b),1);this.line.updateMatrix(); -this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};tb.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};tb.prototype.copy=function(a){B.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};tb.prototype.clone=function(){return(new this.constructor).copy(this)};ve.prototype=Object.create(ba.prototype);ve.prototype.constructor=ve;D.create=function(a,b){console.log("THREE.Curve.create() has been deprecated"); -a.prototype=Object.create(D.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(rb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); -a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new F,c=0,d=a.length;c/gm,Fh=/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,fk=0;Db.prototype=Object.create(O.prototype);Db.prototype.constructor=Db;Db.prototype.isMeshDepthMaterial=!0;Db.prototype.copy=function(a){O.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap; +this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};Eb.prototype=Object.create(O.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isMeshDistanceMaterial=!0;Eb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets; +this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;return this};fg.prototype=Object.assign(Object.create(ka.prototype),{constructor:fg,isWebGLMultiviewRenderTarget:!0,copy:function(a){ka.prototype.copy.call(this,a);this.numViews=a.numViews;return this},setNumViews:function(a){this.numViews!==a&&(this.numViews=a,this.dispose());return this}});Hc.prototype=Object.assign(Object.create(B.prototype), +{constructor:Hc,isGroup:!0});Jd.prototype=Object.assign(Object.create(ja.prototype),{constructor:Jd,isArrayCamera:!0});var Lh=new n,Mh=new n;Object.assign(gg.prototype,Ba.prototype);Object.assign(Nh.prototype,Ba.prototype);Object.assign(Ie.prototype,{isFogExp2:!0,clone:function(){return new Ie(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(Je.prototype,{isFog:!0,clone:function(){return new Je(this.color,this.near, +this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(Gb.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Gb.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.stride; +c*=b.stride;for(var d=0,e=this.stride;da.far||b.push({distance:e,point:ze.clone(),uv:R.getUV(ze,Af,Ae,Bf,ti,$g,ui,new w),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)}, +copy:function(a){B.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var Cf=new n,vi=new n;Nd.prototype=Object.assign(Object.create(B.prototype),{constructor:Nd,isLOD:!0,copy:function(a){B.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=b[c].distance)b[c-1].object.visible=!1,b[c].object.visible=!0;else break;for(;cc||(h.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(h),ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld), +index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,u=q.length/3-1;dc||(h.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(h),ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(f=d.vertices,g=f.length,d=0;dc||(h.applyMatrix4(this.matrixWorld), +t=a.ray.origin.distanceTo(h),ta.far||b.push({distance:t,point:e.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var Ef=new n,Ff=new n;ba.prototype=Object.assign(Object.create(wa.prototype),{constructor:ba,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,e=b.count;d< +e;d+=2)Ef.fromBufferAttribute(b,d),Ff.fromBufferAttribute(b,d+1),c[d]=0===d?0:c[d-1],c[d+1]=c[d]+Ef.distanceTo(Ff);a.addAttribute("lineDistance",new A(c,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(a.isGeometry)for(b=a.vertices,c=a.lineDistances,d=0,e=b.length;d=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Lc.prototype=Object.create(W.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isCompressedTexture=!0;Pd.prototype=Object.create(W.prototype);Pd.prototype.constructor=Pd;Pd.prototype.isCanvasTexture=!0;Qd.prototype=Object.create(W.prototype); +Qd.prototype.constructor=Qd;Qd.prototype.isDepthTexture=!0;Mc.prototype=Object.create(E.prototype);Mc.prototype.constructor=Mc;Rd.prototype=Object.create(F.prototype);Rd.prototype.constructor=Rd;Nc.prototype=Object.create(E.prototype);Nc.prototype.constructor=Nc;Sd.prototype=Object.create(F.prototype);Sd.prototype.constructor=Sd;Da.prototype=Object.create(E.prototype);Da.prototype.constructor=Da;Td.prototype=Object.create(F.prototype);Td.prototype.constructor=Td;Oc.prototype=Object.create(Da.prototype); +Oc.prototype.constructor=Oc;Ud.prototype=Object.create(F.prototype);Ud.prototype.constructor=Ud;cc.prototype=Object.create(Da.prototype);cc.prototype.constructor=cc;Vd.prototype=Object.create(F.prototype);Vd.prototype.constructor=Vd;Pc.prototype=Object.create(Da.prototype);Pc.prototype.constructor=Pc;Wd.prototype=Object.create(F.prototype);Wd.prototype.constructor=Wd;Qc.prototype=Object.create(Da.prototype);Qc.prototype.constructor=Qc;Xd.prototype=Object.create(F.prototype);Xd.prototype.constructor= +Xd;dc.prototype=Object.create(E.prototype);dc.prototype.constructor=dc;dc.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};Yd.prototype=Object.create(F.prototype);Yd.prototype.constructor=Yd;Rc.prototype=Object.create(E.prototype);Rc.prototype.constructor=Rc;Zd.prototype=Object.create(F.prototype);Zd.prototype.constructor=Zd;Sc.prototype=Object.create(E.prototype);Sc.prototype.constructor=Sc;var Dk={triangulate:function(a,b,c){c=c||2;var d= +b&&b.length,e=d?b[0]*c:a.length,f=Qh(a,0,e,c,!0),g=[];if(!f||f.next===f.prev)return g;var h;if(d){var l=c;d=[];var k;var n=0;for(k=b.length;n80*c){var r=h=a[0];var p=d=a[1];for(l=c;lh&&(h=n),b>d&&(d=b);h=Math.max(h-r,d-p);h=0!==h?1/h: +0}be(f,g,c,r,p,h);return g}},pb={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;epb.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];Uh(a);Vh(c,a);var f=a.length;b.forEach(Uh);for(a=0;aMath.abs(g-l)?[new w(a,1-c),new w(h,1-d),new w(k,1-e),new w(u,1-b)]:[new w(g,1-c),new w(l,1-d),new w(n,1-e),new w(t,1-b)]}};de.prototype=Object.create(F.prototype);de.prototype.constructor=de;Uc.prototype=Object.create(eb.prototype);Uc.prototype.constructor=Uc;ee.prototype=Object.create(F.prototype);ee.prototype.constructor=ee;Ib.prototype=Object.create(E.prototype);Ib.prototype.constructor= +Ib;fe.prototype=Object.create(F.prototype);fe.prototype.constructor=fe;Vc.prototype=Object.create(E.prototype);Vc.prototype.constructor=Vc;ge.prototype=Object.create(F.prototype);ge.prototype.constructor=ge;Wc.prototype=Object.create(E.prototype);Wc.prototype.constructor=Wc;gc.prototype=Object.create(F.prototype);gc.prototype.constructor=gc;gc.prototype.toJSON=function(){var a=F.prototype.toJSON.call(this);return Xh(this.parameters.shapes,a)};hc.prototype=Object.create(E.prototype);hc.prototype.constructor= +hc;hc.prototype.toJSON=function(){var a=E.prototype.toJSON.call(this);return Xh(this.parameters.shapes,a)};Xc.prototype=Object.create(E.prototype);Xc.prototype.constructor=Xc;ic.prototype=Object.create(F.prototype);ic.prototype.constructor=ic;qb.prototype=Object.create(E.prototype);qb.prototype.constructor=qb;he.prototype=Object.create(ic.prototype);he.prototype.constructor=he;ie.prototype=Object.create(qb.prototype);ie.prototype.constructor=ie;je.prototype=Object.create(F.prototype);je.prototype.constructor= +je;Yc.prototype=Object.create(E.prototype);Yc.prototype.constructor=Yc;var xa=Object.freeze({WireframeGeometry:Mc,ParametricGeometry:Rd,ParametricBufferGeometry:Nc,TetrahedronGeometry:Td,TetrahedronBufferGeometry:Oc,OctahedronGeometry:Ud,OctahedronBufferGeometry:cc,IcosahedronGeometry:Vd,IcosahedronBufferGeometry:Pc,DodecahedronGeometry:Wd,DodecahedronBufferGeometry:Qc,PolyhedronGeometry:Sd,PolyhedronBufferGeometry:Da,TubeGeometry:Xd,TubeBufferGeometry:dc,TorusKnotGeometry:Yd,TorusKnotBufferGeometry:Rc, +TorusGeometry:Zd,TorusBufferGeometry:Sc,TextGeometry:de,TextBufferGeometry:Uc,SphereGeometry:ee,SphereBufferGeometry:Ib,RingGeometry:fe,RingBufferGeometry:Vc,PlaneGeometry:Fd,PlaneBufferGeometry:$b,LatheGeometry:ge,LatheBufferGeometry:Wc,ShapeGeometry:gc,ShapeBufferGeometry:hc,ExtrudeGeometry:fc,ExtrudeBufferGeometry:eb,EdgesGeometry:Xc,ConeGeometry:he,ConeBufferGeometry:ie,CylinderGeometry:ic,CylinderBufferGeometry:qb,CircleGeometry:je,CircleBufferGeometry:Yc,BoxGeometry:Yg,BoxBufferGeometry:Gd}); +jc.prototype=Object.create(O.prototype);jc.prototype.constructor=jc;jc.prototype.isShadowMaterial=!0;jc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);return this};Zc.prototype=Object.create(la.prototype);Zc.prototype.constructor=Zc;Zc.prototype.isRawShaderMaterial=!0;fb.prototype=Object.create(O.prototype);fb.prototype.constructor=fb;fb.prototype.isMeshStandardMaterial=!0;fb.prototype.copy=function(a){O.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color); +this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale= +a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this}; +kc.prototype=Object.create(fb.prototype);kc.prototype.constructor=kc;kc.prototype.isMeshPhysicalMaterial=!0;kc.prototype.copy=function(a){fb.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness=a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new H).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.transparency=a.transparency; +return this};Ra.prototype=Object.create(O.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isMeshPhongMaterial=!0;Ra.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity; +this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth; +this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};lc.prototype=Object.create(Ra.prototype);lc.prototype.constructor=lc;lc.prototype.isMeshToonMaterial=!0;lc.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};mc.prototype=Object.create(O.prototype);mc.prototype.constructor=mc;mc.prototype.isMeshNormalMaterial=!0; +mc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this}; +nc.prototype=Object.create(O.prototype);nc.prototype.constructor=nc;nc.prototype.isMeshLambertMaterial=!0;nc.prototype.copy=function(a){O.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap= +a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};oc.prototype=Object.create(O.prototype);oc.prototype.constructor=oc;oc.prototype.isMeshMatcapMaterial=!0;oc.prototype.copy=function(a){O.prototype.copy.call(this, +a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};pc.prototype= +Object.create(Q.prototype);pc.prototype.constructor=pc;pc.prototype.isLineDashedMaterial=!0;pc.prototype.copy=function(a){Q.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Ek=Object.freeze({ShadowMaterial:jc,SpriteMaterial:Hb,RawShaderMaterial:Zc,ShaderMaterial:la,PointsMaterial:Qa,MeshPhysicalMaterial:kc,MeshStandardMaterial:fb,MeshPhongMaterial:Ra,MeshToonMaterial:lc,MeshNormalMaterial:mc,MeshLambertMaterial:nc,MeshDepthMaterial:Db, +MeshDistanceMaterial:Eb,MeshBasicMaterial:Ga,MeshMatcapMaterial:oc,LineDashedMaterial:pc,LineBasicMaterial:Q,Material:O}),ta={arraySlice:function(a,b,c){return ta.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b= +a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,l=0;l!==b;++l)e[g++]=a[h+l];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d], +void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};Object.assign(Ia.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f, +1),e=f-1),a=this.getValueSize(),this.times=ta.arraySlice(c,e,f),this.values=ta.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.", +this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ta.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(L.clamp(d[l- +1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(L.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);ah.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,l);bh.initNonuniformCatmullRom(f.y, +g.y,h.y,c.y,d,e,l);ch.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(ah.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),bh.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),ch.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(ah.calc(a),bh.calc(a),ch.calc(a));return b};ya.prototype.copy=function(a){D.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length- +3?c.length-1:a+2];b.set(Zh(d,e.x,f.x,g.x,c.x),Zh(d,e.y,f.y,g.y,c.y));return b};Va.prototype.copy=function(a){D.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths; +for(var a=[],b=0,c=0,d=this.curves.length;cNumber.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0; +0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=pb.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new Jb;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],n=[],u=0;k[u]=void 0;n[u]=[];for(var t=0,r=f.length;tb;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0, +0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.282095);b.addScale(e[1],.488603*d);b.addScale(e[2],.488603*a);b.addScale(e[3],.488603*c);b.addScale(e[4],1.092548*c*d);b.addScale(e[5],1.092548*d*a);b.addScale(e[6],.315392*(3*a*a-1));b.addScale(e[7],1.092548*c*a);b.addScale(e[8],.546274*(c*c-d*d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var e=this.coefficients;b.copy(e[0]).multiplyScalar(.886227);b.addScale(e[1], +1.023328*d);b.addScale(e[2],1.023328*a);b.addScale(e[3],1.023328*c);b.addScale(e[4],.858086*c*d);b.addScale(e[5],.858086*d*a);b.addScale(e[6],.743125*a*a-.247708);b.addScale(e[7],.858086*c*a);b.addScale(e[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c], +b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(kf, +{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});Xa.prototype=Object.assign(Object.create(ca.prototype),{constructor:Xa,isLightProbe:!0,copy:function(a){ca.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=a.intensity;return this},toJSON:function(a){return ca.prototype.toJSON.call(this,a)}});xg.prototype=Object.assign(Object.create(Xa.prototype), +{constructor:xg,isHemisphereLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});yg.prototype=Object.assign(Object.create(Xa.prototype),{constructor:yg,isAmbientLightProbe:!0,copy:function(a){Xa.prototype.copy.call(this,a);return this},toJSON:function(a){return Xa.prototype.toJSON.call(this,a)}});var Di=new V,Ei=new V;Object.assign($h.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov|| +b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,e=d*b.near/b.focus,f=b.near*Math.tan(L.DEG2RAD*b.fov*.5)/b.zoom;Ei.elements[12]=-d;Di.elements[12]=d;d=-f*b.aspect+e;var g=f*b.aspect+e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraL.projectionMatrix.copy(c);d= +-f*b.aspect-e;g=f*b.aspect-e;c.elements[0]=2*b.near/(g-d);c.elements[8]=(g+d)/(g-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(Ei);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(Di)}});Object.assign(zg.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta(); +return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var vc=new n,Fi=new sa,Gk=new n,wc=new n;Ag.prototype=Object.assign(Object.create(B.prototype),{constructor:Ag,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination), +this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a, +this.context.currentTime,.01);return this},updateMatrixWorld:function(a){B.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(vc,Fi,Gk);wc.set(0,0,-1).applyQuaternion(Fi);if(a.positionX){var c=this.context.currentTime+this.timeDelta;a.positionX.linearRampToValueAtTime(vc.x,c);a.positionY.linearRampToValueAtTime(vc.y,c);a.positionZ.linearRampToValueAtTime(vc.z,c);a.forwardX.linearRampToValueAtTime(wc.x,c); +a.forwardY.linearRampToValueAtTime(wc.y,c);a.forwardZ.linearRampToValueAtTime(wc.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(vc.x,vc.y,vc.z),a.setOrientation(wc.x,wc.y,wc.z,b.x,b.y,b.z)}});dd.prototype=Object.assign(Object.create(B.prototype),{constructor:dd,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this}, +setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setMediaStreamSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaStreamNode";this.source=this.context.createMediaStreamSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing."); +else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control."); +else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a, +b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){sa.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});var Ik=/[\[\]\.:\/]/g,Jk="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Kk=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Lk=/(WCOD+)?/.source.replace("WCOD",Jk),Mk=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Nk=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"), +Ok=new RegExp("^"+Kk+Lk+Mk+Nk+"$"),Pk=["material","materials","bones"];Object.assign(ai.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_, +c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(Aa,{Composite:ai,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new Aa.Composite(a,b,c):new Aa(a,b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(Ik,"")},parseTrackName:function(a){var b=Ok.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!== +c){var d=b.nodeName.substring(c+1);-1!==Pk.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b},findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var n=b++,u=a[n];c[u.uuid]=k;a[k]=u;c[l]=n;a[n]=h;h=0;for(l=e;h!==l;++h){u=d[h];var t=u[k];u[k]=u[n];u[n]=t}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var l=arguments[g].uuid,k=d[l];if(void 0!==k)if(delete d[l],kb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0]; +b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1===e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else{this.time=b;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=b;this._mixer.dispatchEvent({type:"finished", +action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this.time=b,this._mixer.dispatchEvent({type:"loop", +action:this,loopDelta:d}))}else this.time=b;if(f&&1===(e&1))return c-b}return b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]= +c;return this}});Fg.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Fg,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m=d[h],n=m.name,u=k[n];if(void 0===u){u=f[h];if(void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,g,n));continue}u=new Eg(Aa.create(c,n,b&&b._propertyBindings[h].binding.parsedPath), +m.ValueTypeName,m.getValueSize());++u.referenceCount;this._addInactiveBinding(u,g,n)}f[h]=u;a[h].resultBuffer=u.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}}, +_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, +get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a, +b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new w);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new w);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Hi.copy(a).clamp(this.min, +this.max).sub(a).length()},intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Ii=new n,Jf=new n;Object.assign(Jg.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start); +this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new n);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new n);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0=== +b&&(console.warn("THREE.Line3: .at() target is now required"),b=new n);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(a,b){Ii.subVectors(a,this.start);Jf.subVectors(this.end,this.start);a=Jf.dot(Jf);a=Jf.dot(Ii)/a;b&&(a=L.clamp(a,0,1));return a},closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new n);return this.delta(c).multiplyScalar(a).add(this.start)}, +applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});pe.prototype=Object.create(B.prototype);pe.prototype.constructor=pe;pe.prototype.isImmediateRenderObject=!0;var mb=new n,zb=new n,gh=new da,Qk=["a","b","c"];qe.prototype=Object.create(ba.prototype);qe.prototype.constructor=qe;qe.prototype.update=function(){this.object.updateMatrixWorld(!0);gh.getNormalMatrix(this.object.matrixWorld); +var a=this.object.matrixWorld,b=this.geometry.attributes.position,c=this.object.geometry;if(c&&c.isGeometry)for(var d=c.vertices,e=c.faces,f=c=0,g=e.length;fMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);B.prototype.updateMatrixWorld.call(this,a)};var Pi=new n,pf,Kg;tb.prototype=Object.create(B.prototype);tb.prototype.constructor=tb;tb.prototype.setDirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(Pi.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(Pi,Math.acos(a.y)))}; +tb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(1E-4,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};tb.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};tb.prototype.copy=function(a){B.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};tb.prototype.clone=function(){return(new this.constructor).copy(this)}; +ve.prototype=Object.create(ba.prototype);ve.prototype.constructor=ve;D.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(D.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(rb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); +a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new F,c=0,d=a.length;c/gm; +var includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; - function replace( match, include ) { +function resolveIncludes( string ) { - var replace = ShaderChunk[ include ]; + return string.replace( includePattern, includeReplacer ); - if ( replace === undefined ) { +} - throw new Error( 'Can not resolve #include <' + include + '>' ); +function includeReplacer( match, include ) { - } + var string = ShaderChunk[ include ]; - return parseIncludes( replace ); + if ( string === undefined ) { + + throw new Error( 'Can not resolve #include <' + include + '>' ); } - return string.replace( pattern, replace ); + return resolveIncludes( string ); } -function unrollLoops( string ) { +// Unroll Loops - var pattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; +var loopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; - function replace( match, start, end, snippet ) { +function unrollLoops( string ) { - var unroll = ''; + return string.replace( loopPattern, loopReplacer ); - for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { +} - unroll += snippet - .replace( /\[ i \]/g, '[ ' + i + ' ]' ) - .replace( /UNROLLED_LOOP_INDEX/g, i ); +function loopReplacer( match, start, end, snippet ) { - } + var string = ''; + + for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) { - return unroll; + string += snippet + .replace( /\[ i \]/g, '[ ' + i + ' ]' ) + .replace( /UNROLLED_LOOP_INDEX/g, i ); } - return string.replace( pattern, replace ); + return string; } +// + function generatePrecision( parameters ) { var precisionstring = "precision " + parameters.precision + " float;\nprecision " + parameters.precision + " int;"; @@ -17899,11 +17921,11 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters } - vertexShader = parseIncludes( vertexShader ); + vertexShader = resolveIncludes( vertexShader ); vertexShader = replaceLightNums( vertexShader, parameters ); vertexShader = replaceClippingPlaneNums( vertexShader, parameters ); - fragmentShader = parseIncludes( fragmentShader ); + fragmentShader = resolveIncludes( fragmentShader ); fragmentShader = replaceLightNums( fragmentShader, parameters ); fragmentShader = replaceClippingPlaneNums( fragmentShader, parameters ); diff --git a/docs/api/en/math/Vector3.html b/docs/api/en/math/Vector3.html index c85098b28c283b54c1c5bb64fa77aa2ee1579f29..9289baa5ca4d24eda58629d084e668eed8a7271e 100644 --- a/docs/api/en/math/Vector3.html +++ b/docs/api/en/math/Vector3.html @@ -121,7 +121,7 @@ var d = a.distanceTo( b );

[method:Float angleTo]( [param:Vector3 v] )

- Returns the angle between this vector and vector [page:Vector3 v] in radians. + Returns the angle between this vector and vector [page:Vector3 v] in radians. Neither this vector nor [page:Vector3 v] can be the zero vector.

[method:this ceil]()

@@ -320,8 +320,8 @@ var d = a.distanceTo( b ); normal from this vector.

-

[method:this projectOnVector]( [param:Vector3] )

-

[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto another vector.

+

[method:this projectOnVector]( [param:Vector3 v] )

+

[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto [page:Vector3 v]. [page:Vector3 v] cannot be the zero vector.

[method:this reflect]( [param:Vector3 normal] )

diff --git a/docs/api/en/renderers/WebGLRenderer.html b/docs/api/en/renderers/WebGLRenderer.html index 4e7b3ac2e90faf5c3b016f8643b8f38fcff25b4a..21ba4daf1236d079e9f984acb8c59b256aad8093 100644 --- a/docs/api/en/renderers/WebGLRenderer.html +++ b/docs/api/en/renderers/WebGLRenderer.html @@ -188,6 +188,7 @@

  • triangles
  • points
  • lines
  • +
  • frame
  • programs diff --git a/docs/api/zh/renderers/WebGLRenderer.html b/docs/api/zh/renderers/WebGLRenderer.html index 47b88e9779b7036f29c3b48907d9f5dca51cec92..205b1065a7a66f924d34f3b76377a8ade506e6ac 100644 --- a/docs/api/zh/renderers/WebGLRenderer.html +++ b/docs/api/zh/renderers/WebGLRenderer.html @@ -167,6 +167,7 @@
  • triangles
  • points
  • lines
  • +
  • frame
  • programs diff --git a/docs/examples/en/exporters/GLTFExporter.html b/docs/examples/en/exporters/GLTFExporter.html index 3baaeb2b638550d68643ab7ce35ecf900b36d759..6560fa1e789f6dc91781c827683eaad7aa2dc251 100644 --- a/docs/examples/en/exporters/GLTFExporter.html +++ b/docs/examples/en/exporters/GLTFExporter.html @@ -94,6 +94,7 @@
  • truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.
  • binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.
  • embedImages - bool. Export with images embedded into the glTF asset. Default is true.
  • +
  • maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. This option works only if embedImages is true. Default is Infinity.
  • animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.
  • forceIndices - bool. Generate indices for non-index geometry and export with them. Default is false.
  • forcePowerOfTwoTextures - bool. Export with images resized to POT size. This option works only if embedImages is true. Default is false.
  • diff --git a/docs/examples/zh/exporters/GLTFExporter.html b/docs/examples/zh/exporters/GLTFExporter.html index 3baaeb2b638550d68643ab7ce35ecf900b36d759..6560fa1e789f6dc91781c827683eaad7aa2dc251 100644 --- a/docs/examples/zh/exporters/GLTFExporter.html +++ b/docs/examples/zh/exporters/GLTFExporter.html @@ -94,6 +94,7 @@
  • truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.
  • binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.
  • embedImages - bool. Export with images embedded into the glTF asset. Default is true.
  • +
  • maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. This option works only if embedImages is true. Default is Infinity.
  • animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.
  • forceIndices - bool. Generate indices for non-index geometry and export with them. Default is false.
  • forcePowerOfTwoTextures - bool. Export with images resized to POT size. This option works only if embedImages is true. Default is false.
  • diff --git a/editor/css/dark.css b/editor/css/dark.css index d93353407289a768f8caafcab6bb75223f10b346..b7f1f79f2f7c631b180d020f415006f72302bd22 100644 --- a/editor/css/dark.css +++ b/editor/css/dark.css @@ -273,7 +273,6 @@ select { .Panel { color: #888; - border-top: 1px solid #222; } /* */ diff --git a/editor/css/light.css b/editor/css/light.css index 81eaadbe461a2e355d6778d93a465e8a9134738f..4492c745370adfcd3987d5246e3062fc85ecc78a 100644 --- a/editor/css/light.css +++ b/editor/css/light.css @@ -267,7 +267,6 @@ select { .Panel { color: #888; - border-top: 1px solid #ccc; } /* */ diff --git a/editor/css/main.css b/editor/css/main.css index 85efe336ab28a274b7db21bb708a178ac3636782..c1921f3b59ac501117c82bb162b7bb0383f15ca1 100644 --- a/editor/css/main.css +++ b/editor/css/main.css @@ -63,6 +63,7 @@ textarea, input { outline: none; } /* osx */ .TabbedPanel .Tabs .Tab { padding: 10px; vertical-align: middle; + text-transform: uppercase; } .TabbedPanel .Tabs .Panels { diff --git a/editor/js/Editor.js b/editor/js/Editor.js index 90217ca7dcf114d6d9549f3c4e29dba7c1b0af7a..06deabc2d10ab90de51f9713dda747c074b64b20 100644 --- a/editor/js/Editor.js +++ b/editor/js/Editor.js @@ -57,7 +57,9 @@ var Editor = function () { helperAdded: new Signal(), helperRemoved: new Signal(), + materialAdded: new Signal(), materialChanged: new Signal(), + materialRemoved: new Signal(), scriptAdded: new Signal(), scriptChanged: new Signal(), @@ -234,6 +236,34 @@ Editor.prototype = { addMaterial: function ( material ) { this.materials[ material.uuid ] = material; + this.signals.materialAdded.dispatch(); + + }, + + removeMaterial: function ( material ) { + + delete this.materials[ material.uuid ]; + this.signals.materialRemoved.dispatch(); + + }, + + getMaterialById: function ( id ) { + + var material; + var materials = Object.values( this.materials ); + + for ( var i = 0; i < materials.length; i ++ ) { + + if ( materials[ i ].id === id ) { + + material = materials[ i ]; + break; + + } + + } + + return material; }, diff --git a/editor/js/Sidebar.Material.js b/editor/js/Sidebar.Material.js index 9656749fac34a879dc3ce62acc18abb9dc684233..ae0ae4b358ffe389a39707db54c5c7d999007663 100644 --- a/editor/js/Sidebar.Material.js +++ b/editor/js/Sidebar.Material.js @@ -17,12 +17,6 @@ Sidebar.Material = function ( editor ) { container.setDisplay( 'none' ); container.setPaddingTop( '20px' ); - // New / Copy / Paste - - var copiedMaterial; - - var managerRow = new UI.Row(); - // Current material slot var materialSlotRow = new UI.Row(); @@ -35,43 +29,6 @@ Sidebar.Material = function ( editor ) { container.add( materialSlotRow ); - managerRow.add( new UI.Text( '' ).setWidth( '90px' ) ); - - managerRow.add( new UI.Button( strings.getKey( 'sidebar/material/new' ) ).onClick( function () { - - var material = new THREE[ materialClass.getValue() ](); - editor.execute( new SetMaterialCommand( editor, currentObject, material, currentMaterialSlot ), 'New Material: ' + materialClass.getValue() ); - update(); - - } ) ); - - managerRow.add( new UI.Button( strings.getKey( 'sidebar/material/copy' ) ).setMarginLeft( '4px' ).onClick( function () { - - copiedMaterial = currentObject.material; - - if ( Array.isArray( copiedMaterial ) ) { - - if ( copiedMaterial.length === 0 ) return; - - copiedMaterial = copiedMaterial[ currentMaterialSlot ]; - - } - - } ) ); - - managerRow.add( new UI.Button( strings.getKey( 'sidebar/material/paste' ) ).setMarginLeft( '4px' ).onClick( function () { - - if ( copiedMaterial === undefined ) return; - - editor.execute( new SetMaterialCommand( editor, currentObject, copiedMaterial, currentMaterialSlot ), 'Pasted Material: ' + materialClass.getValue() ); - refreshUI(); - update(); - - } ) ); - - container.add( managerRow ); - - // type var materialClassRow = new UI.Row(); @@ -655,9 +612,9 @@ Sidebar.Material = function ( editor ) { var sheen = sheenEnabled ? new THREE.Color(materialSheen.getHexValue()) : null; editor.execute( new SetMaterialValueCommand( editor, currentObject, 'sheen', sheen, currentMaterialSlot ) ); - + } - + if ( material.sheen !== undefined && material.sheen !== null && material.sheen.getHex() !== materialSheen.getHexValue() ) { editor.execute( new SetMaterialColorCommand( editor, currentObject, 'sheen', materialSheen.getHexValue(), currentMaterialSlot ) ); @@ -1297,9 +1254,9 @@ Sidebar.Material = function ( editor ) { materialMetalness.setValue( material.metalness ); } - + if ( material.sheen !== undefined && material.sheen !== null ) { - + materialSheenEnabled.setValue( true ); materialSheen.setHexValue( material.sheen.getHexString() ); diff --git a/editor/js/Sidebar.Project.js b/editor/js/Sidebar.Project.js index 9e7c82bdacf6ecf71130d2b1c3b4f966230be20a..ab92e63bdb29bdd97f92c8db2910ffc8ee48a11b 100644 --- a/editor/js/Sidebar.Project.js +++ b/editor/js/Sidebar.Project.js @@ -19,8 +19,14 @@ Sidebar.Project = function ( editor ) { var container = new UI.Panel(); container.setBorderTop( '0' ); + container.setPadding( '0' ); container.setPaddingTop( '20px' ); + var projectsettings = new UI.Panel(); + projectsettings.setBorderTop( '0' ); + + container.add( projectsettings ); + // Title var titleRow = new UI.Row(); @@ -33,7 +39,7 @@ Sidebar.Project = function ( editor ) { titleRow.add( new UI.Text( strings.getKey( 'sidebar/project/title' ) ).setWidth( '90px' ) ); titleRow.add( title ); - container.add( titleRow ); + projectsettings.add( titleRow ); // Editable @@ -47,7 +53,7 @@ Sidebar.Project = function ( editor ) { editableRow.add( new UI.Text( strings.getKey( 'sidebar/project/editable' ) ).setWidth( '90px' ) ); editableRow.add( editable ); - container.add( editableRow ); + projectsettings.add( editableRow ); // VR @@ -61,7 +67,7 @@ Sidebar.Project = function ( editor ) { vrRow.add( new UI.Text( strings.getKey( 'sidebar/project/vr' ) ).setWidth( '90px' ) ); vrRow.add( vr ); - container.add( vrRow ); + projectsettings.add( vrRow ); // Renderer @@ -89,7 +95,7 @@ Sidebar.Project = function ( editor ) { rendererTypeRow.add( new UI.Text( strings.getKey( 'sidebar/project/renderer' ) ).setWidth( '90px' ) ); rendererTypeRow.add( rendererType ); - container.add( rendererTypeRow ); + projectsettings.add( rendererTypeRow ); if ( config.getKey( 'project/renderer' ) !== undefined ) { @@ -119,7 +125,7 @@ Sidebar.Project = function ( editor ) { } ); rendererPropertiesRow.add( rendererShadows ); - container.add( rendererPropertiesRow ); + projectsettings.add( rendererPropertiesRow ); // @@ -165,6 +171,70 @@ Sidebar.Project = function ( editor ) { createRenderer( config.getKey( 'project/renderer' ), config.getKey( 'project/renderer/antialias' ), config.getKey( 'project/renderer/shadows' ) ); + // Materials + + var materials = new UI.Panel(); + + var headerRow = new UI.Row(); + headerRow.add( new UI.Text( strings.getKey( 'sidebar/project/materials' ) ) ); + + materials.add( headerRow ); + + var listbox = new UI.Listbox(); + signals.materialAdded.add( function () { + + listbox.setItems( Object.values( editor.materials ) ); + + } ); + materials.add( listbox ); + + var buttonsRow = new UI.Row(); + buttonsRow.setPadding( '10px 0px' ); + materials.add( buttonsRow ); + + /* + var addButton = new UI.Button().setLabel( 'Add' ).setMarginRight( '5px' ); + addButton.onClick( function () { + + editor.addMaterial( new THREE.MeshStandardMaterial() ); + + } ); + buttonsRow.add( addButton ); + */ + + var assignMaterial = new UI.Button().setLabel( 'Assign' ).setMargin( '0px 5px' ); + assignMaterial.onClick( function () { + + if ( editor.selected !== null ) { + + var material = editor.getMaterialById( parseInt( listbox.getValue() ) ); + + if ( material !== undefined ) { + + editor.execute( new SetMaterialCommand( editor, editor.selected, material ) ); + + } + + } + + } ); + buttonsRow.add( assignMaterial ); + + container.add( materials ); + + // events + + signals.objectSelected.add( function ( object ) { + + if ( object !== null ) { + + var index = Object.values( editor.materials ).indexOf( object.material ); + listbox.selectIndex( index ); + + } + + } ); + return container; }; diff --git a/editor/js/Sidebar.Properties.js b/editor/js/Sidebar.Properties.js index 5cf9c3e5b89c7786093bd4213aa5800f849dd90e..056ab85e52808ac2467ac3f0cd351322b94ef7c7 100644 --- a/editor/js/Sidebar.Properties.js +++ b/editor/js/Sidebar.Properties.js @@ -12,6 +12,7 @@ Sidebar.Properties = function ( editor ) { container.addTab( 'object', strings.getKey( 'sidebar/properties/object' ), new Sidebar.Object( editor ) ); container.addTab( 'geometry', strings.getKey( 'sidebar/properties/geometry' ), new Sidebar.Geometry( editor ) ); container.addTab( 'material', strings.getKey( 'sidebar/properties/material' ), new Sidebar.Material( editor ) ); + container.select( 'object' ); return container; diff --git a/editor/js/Sidebar.js b/editor/js/Sidebar.js index e3d3e9023f083e9178e29da71a3d9559a1c22f25..ef38815b8b1cb7ae09f1f0b72421746d8abef1ba 100644 --- a/editor/js/Sidebar.js +++ b/editor/js/Sidebar.js @@ -24,6 +24,7 @@ var Sidebar = function ( editor ) { container.addTab( 'scene', strings.getKey( 'sidebar/scene' ), scene ); container.addTab( 'project', strings.getKey( 'sidebar/project' ), new Sidebar.Project( editor ) ); container.addTab( 'settings', strings.getKey( 'sidebar/settings' ), settings ); + container.select( 'scene' ); return container; diff --git a/editor/js/Strings.js b/editor/js/Strings.js index 975db9132627bd8a37d98e73a44154c8608e8efe..3e12cd4909749b6eaa9e1a9f091c52a454183a11 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -280,6 +280,7 @@ var Strings = function ( config ) { 'sidebar/project/renderer': 'Renderer', 'sidebar/project/antialias': 'antialias', 'sidebar/project/shadows': 'shadows', + 'sidebar/project/materials': 'Materials', 'sidebar/settings': 'Settings', 'sidebar/settings/language': 'Language', @@ -555,6 +556,7 @@ var Strings = function ( config ) { 'sidebar/project/renderer': '渲染器', 'sidebar/project/antialias': '抗锯齿', 'sidebar/project/shadows': '阴影', + 'sidebar/project/materials': 'Materials', 'sidebar/settings': '设置', 'sidebar/settings/language': '语言', diff --git a/editor/js/libs/ui.js b/editor/js/libs/ui.js index 6dff610583cbf1de1f73caa2bcf536f73a329ff5..7f846a1c6df3f0c41117f4c7e88bc3c8b3154456 100644 --- a/editor/js/libs/ui.js +++ b/editor/js/libs/ui.js @@ -1025,8 +1025,8 @@ UI.TabbedPanel = function ( ) { UI.Element.call( this ); - var dom = document.createElement('div'); - + var dom = document.createElement( 'div' ); + this.dom = dom; this.setClass( 'TabbedPanel' ); @@ -1047,7 +1047,7 @@ UI.TabbedPanel = function ( ) { return this; -} +}; UI.TabbedPanel.prototype = Object.create( UI.Element.prototype ); UI.TabbedPanel.prototype.constructor = UI.TabbedPanel; @@ -1057,9 +1057,10 @@ UI.TabbedPanel.prototype.select = function ( id ) { var tab; var panel; var scope = this; - + // Deselect current selection if ( this.selected && this.selected.length ) { + tab = this.tabs.find( function ( item ) { return item.dom.id === scope.selected } ); panel = this.panels.find( function ( item ) { return item.dom.id === scope.selected } ); @@ -1069,7 +1070,7 @@ UI.TabbedPanel.prototype.select = function ( id ) { } - if( panel ) { + if ( panel ) { panel.setDisplay( 'none' ); @@ -1079,14 +1080,14 @@ UI.TabbedPanel.prototype.select = function ( id ) { tab = this.tabs.find( function ( item ) { return item.dom.id === id } ); panel = this.panels.find( function ( item ) { return item.dom.id === id } ); - + if ( tab ) { tab.addClass( 'selected' ); } - if( panel ) { + if ( panel ) { panel.setDisplay( '' ); @@ -1096,7 +1097,7 @@ UI.TabbedPanel.prototype.select = function ( id ) { return this; -} +}; UI.TabbedPanel.prototype.addTab = function ( id, label, items ) { @@ -1114,7 +1115,7 @@ UI.TabbedPanel.prototype.addTab = function ( id, label, items ) { this.select( id ); -} +}; UI.TabbedPanel.Tab = function ( text, parent ) { @@ -1124,15 +1125,16 @@ UI.TabbedPanel.Tab = function ( text, parent ) { this.setClass( 'Tab' ); var scope = this; + this.dom.addEventListener( 'click', function ( event ) { scope.parent.select( scope.dom.id ); - } ) + } ); return this; -} +}; UI.TabbedPanel.Tab.prototype = Object.create( UI.Text.prototype ); UI.TabbedPanel.Tab.prototype.constructor = UI.TabbedPanel.Tab; @@ -1154,10 +1156,10 @@ UI.Listbox = function ( ) { return this; -} +}; UI.Listbox.prototype = Object.create( UI.Element.prototype ); -UI.Listbox.prototype.constructor = UI.ListboxItem; +UI.Listbox.prototype.constructor = UI.Listbox; UI.Listbox.prototype.setItems = function ( items ) { @@ -1167,25 +1169,25 @@ UI.Listbox.prototype.setItems = function ( items ) { } - this.render( ); + this.render(); -} +}; UI.Listbox.prototype.render = function ( ) { - while( this.listitems.length ) { + while ( this.listitems.length ) { - var item = this.listitems[0]; + var item = this.listitems[ 0 ]; item.dom.remove(); - this.listitems.splice(0, 1); + this.listitems.splice( 0, 1 ); } for ( var i = 0; i < this.items.length; i ++ ) { - var item = this.items[i]; + var item = this.items[ i ]; var listitem = new UI.Listbox.ListboxItem( this ); listitem.setId( item.id || `Listbox-${i}` ); @@ -1194,10 +1196,10 @@ UI.Listbox.prototype.render = function ( ) { } -} +}; // Assuming user passes valid list items -UI.Listbox.prototype.add = function ( ) { +UI.Listbox.prototype.add = function () { var items = Array.from( arguments ); @@ -1205,25 +1207,25 @@ UI.Listbox.prototype.add = function ( ) { UI.Element.prototype.add.apply( this, items ); -} +}; UI.Listbox.prototype.selectIndex = function ( index ) { if ( index >= 0 && index < this.items.length ) { - this.setValue( this.listitems[ index ].getId( ) ); + this.setValue( this.listitems[ index ].getId() ); } - this.selectIndex = index; + this.selectedIndex = index; -} +}; -UI.Listbox.prototype.getValue = function ( index ) { +UI.Listbox.prototype.getValue = function () { return this.selectedValue; -} +}; UI.Listbox.prototype.setValue = function ( value ) { @@ -1231,12 +1233,12 @@ UI.Listbox.prototype.setValue = function ( value ) { var element = this.listitems[ i ]; - if ( element.getId( ) === value ) { + if ( element.getId() === value ) { element.addClass( 'active' ); } else { - + element.removeClass( 'active' ); } @@ -1249,7 +1251,7 @@ UI.Listbox.prototype.setValue = function ( value ) { changeEvent.initEvent( 'change', true, true ); this.dom.dispatchEvent( changeEvent ); -} +}; // Listbox Item UI.Listbox.ListboxItem = function ( parent ) { @@ -1264,10 +1266,12 @@ UI.Listbox.ListboxItem = function ( parent ) { var scope = this; - function onClick ( ) { - - if( scope.parent ) { + function onClick() { + + if ( scope.parent ) { + scope.parent.setValue( scope.getId( ) ); + } } @@ -1276,7 +1280,7 @@ UI.Listbox.ListboxItem = function ( parent ) { return this; -} +}; UI.Listbox.ListboxItem.prototype = Object.create( UI.Element.prototype ); UI.Listbox.ListboxItem.prototype.constructor = UI.Listbox.ListboxItem; diff --git a/editor/sw.js b/editor/sw.js index 0f51845022352580618e7752469446591e6d002d..6f73a38f2b2ebf0b7d42b3670d5bb407d5ec4a67 100644 --- a/editor/sw.js +++ b/editor/sw.js @@ -1,13 +1,12 @@ // r108 -const staticAssets = [ +const assets = [ './', '../files/favicon.ico', '../build/three.js', - '../examples/js/controls/EditorControls.js', '../examples/js/controls/TransformControls.js', '../examples/js/libs/chevrotain.min.js', @@ -42,6 +41,9 @@ const staticAssets = [ '../examples/js/renderers/SoftwareRenderer.js', '../examples/js/renderers/SVGRenderer.js', + './manifest.json', + './images/icon.png', + './js/libs/codemirror/codemirror.css', './js/libs/codemirror/theme/monokai.css', @@ -92,6 +94,7 @@ const staticAssets = [ './css/dark.css', './css/light.css', + './js/EditorControls.js', './js/Storage.js', './js/Editor.js', @@ -122,6 +125,7 @@ const staticAssets = [ './js/Sidebar.Geometry.BoxGeometry.js', './js/Sidebar.Geometry.CircleGeometry.js', './js/Sidebar.Geometry.CylinderGeometry.js', + './js/Sidebar.Geometry.DodecahedronGeometry.js', './js/Sidebar.Geometry.ExtrudeGeometry.js', './js/Sidebar.Geometry.IcosahedronGeometry.js', './js/Sidebar.Geometry.OctahedronGeometry.js', @@ -179,10 +183,19 @@ const staticAssets = [ ]; -self.addEventListener( 'install', async function ( event ) { +self.addEventListener( 'install', async function () { const cache = await caches.open( 'threejs-editor' ); - cache.addAll( staticAssets ); + + assets.forEach( function ( asset ) { + + cache.add( asset ).catch( function () { + + console.error( '[SW] Cound\'t cache:', asset ); + + } ); + + } ); } ); @@ -196,6 +209,14 @@ self.addEventListener( 'fetch', async function ( event ) { async function cacheFirst( request ) { const cachedResponse = await caches.match( request ); - return cachedResponse || fetch( request ); + + if ( cachedResponse === undefined ) { + + console.error( '[SW] Not cached:', request.url ); + return fetch( request ); + + } + + return cachedResponse; } diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index f175ba4f74a76cad737fb2eb26b71ddd72b8ee14..3dbf4ad00eb2a5c3de8d06f082d9316cf644c73b 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/examples/js/exporters/GLTFExporter.js @@ -78,6 +78,7 @@ THREE.GLTFExporter.prototype = { onlyVisible: true, truncateDrawRange: true, embedImages: true, + maxTextureSize: Infinity, animations: [], forceIndices: false, forcePowerOfTwoTextures: false, @@ -751,10 +752,10 @@ THREE.GLTFExporter.prototype = { var canvas = cachedCanvas = cachedCanvas || document.createElement( 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; + canvas.width = Math.min( image.width, options.maxTextureSize ); + canvas.height = Math.min( image.height, options.maxTextureSize ); - if ( options.forcePowerOfTwoTextures && ! isPowerOfTwo( image ) ) { + if ( options.forcePowerOfTwoTextures && ! isPowerOfTwo( canvas ) ) { console.warn( 'GLTFExporter: Resized non-power-of-two image.', image ); diff --git a/examples/js/libs/basis/README.md b/examples/js/libs/basis/README.md index 295b7a544418d4be8f2c4d324a71aed8e4b64db1..0c9961a3d8a2624ac6c65c59028f45dd25ad2a64 100644 --- a/examples/js/libs/basis/README.md +++ b/examples/js/libs/basis/README.md @@ -36,7 +36,7 @@ basisLoader.load( 'diffuse.basis', function ( texture ) { ``` For further documentation about the Basis compressor and transcoder, refer to -the [Basis GitHub repository](https://github.com/BinomialLLC/basis_universal). The JavaScript wrapper requires one modification from the version provided in the Basis repository – the declaration on the first line is changed from `var Module` to `Module`, to accomodate lazy initialization in a Web Worker ([details](https://github.com/mrdoob/three.js/issues/16524)). +the [Basis GitHub repository](https://github.com/BinomialLLC/basis_universal). ## License diff --git a/examples/js/libs/basis/basis_transcoder.js b/examples/js/libs/basis/basis_transcoder.js index a64c35a4c16a7a8184548e9b0d1a7bdabc7b7d41..8e4ddc40f05b63971ac92d48aec08bbf0d2e67a4 100644 --- a/examples/js/libs/basis/basis_transcoder.js +++ b/examples/js/libs/basis/basis_transcoder.js @@ -1 +1,21 @@ -Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+"/";var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);Module["quit"]=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){return read(f)}}Module["readBinary"]=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=function(status){quit(status)}}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=function(title){document.title=title}}else{}var out=Module["print"]||(typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null);var err=Module["printErr"]||(typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var asm2wasmImports={"f64-rem":function(x,y){return x%y},"debugger":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!=="object"){err("no native wasm support detected")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(u8Array[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;var WASM_PAGE_SIZE=65536;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var DYNAMIC_BASE=5401280,DYNAMICTOP_PTR=158368;var TOTAL_STACK=5242880;var INITIAL_TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="basis_transcoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(Module["wasmBinary"]){return new Uint8Array(Module["wasmBinary"])}if(Module["readBinary"]){return Module["readBinary"](wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!Module["wasmBinary"]&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(env){var info={"env":env,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}if(!Module["wasmBinary"]&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function"){WebAssembly.instantiateStreaming(fetch(wasmBinaryFile,{credentials:"same-origin"}),info).then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})}else{instantiateArrayBuffer(receiveInstantiatedSource)}return{}}Module["asm"]=function(global,env,providedBuffer){env["memory"]=wasmMemory;env["table"]=wasmTable=new WebAssembly.Table({"initial":70,"maximum":70,"element":"anyfunc"});env["__memory_base"]=1024;env["__table_base"]=0;var exports=createWasm(env);return exports};__ATINIT__.push({func:function(){globalCtors()}});function ___cxa_allocate_exception(size){return _malloc(size)}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}function ___cxa_free_exception(ptr){try{return _free(ptr)}catch(e){}}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:function(adjusted){if(!adjusted||EXCEPTIONS.infos[adjusted])return adjusted;for(var key in EXCEPTIONS.infos){var ptr=+key;var adj=EXCEPTIONS.infos[ptr].adjusted;var len=adj.length;for(var i=0;i0);info.refcount--;if(info.refcount===0&&!info.rethrown){if(info.destructor){Module["dynCall_vi"](info.destructor,ptr)}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}},clearRef:function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0}};function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:[ptr],type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr}var SYSCALLS={buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}});clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function runDestructor(handle){var $$=handle.$$;if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}this.$$.count.value-=1;var toDelete=0===this.$$.count.value;if(toDelete){runDestructor(this)}if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}var delayFunction=undefined;var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype["isAliasOf"]=ClassHandle_isAliasOf;ClassHandle.prototype["clone"]=ClassHandle_clone;ClassHandle.prototype["delete"]=ClassHandle_delete;ClassHandle.prototype["isDeleted"]=ClassHandle_isDeleted;ClassHandle.prototype["deleteLater"]=ClassHandle_deleteLater}function ClassHandle(){}var registeredPointers={};function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,__emval_register(function(){clonedHandle["delete"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle["delete"]()}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return Object.create(prototype,{$$:{value:record}})}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype["fromWireType"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(dynCall){var args=[];for(var i=1;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}var destructors=[];var args=new Array(argCount);args[0]=rawConstructor;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn),argCount-1);return[]})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=function(value){return value};if(minRange===0){var bitshift=32-8*size;fromWireType=function(value){return value<>>bitshift}}var isUnsignedType=name.indexOf("unsigned")!=-1;registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(valuemaxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return isUnsignedType?value>>>0:value|0},"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap["buffer"],data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var endChar=HEAPU8[value+4+length];var endCharSwap=0;if(endChar!=0){endCharSwap=endChar;HEAPU8[value+4+length]=0}var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(HEAPU8[currentBytePtr]==0){var stringSegment=UTF8ToString(decodeStartPtr);if(str===undefined)str=stringSegment;else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}if(endCharSwap!=0)HEAPU8[value+4+length]=endCharSwap}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;i>2];var a=new Array(length);var start=value+4>>shift;for(var i=0;i>2]=length;var start=ptr+4>>shift;for(var i=0;i>2]=rd;return returnType["toWireType"](destructors,handle)}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}else{return symbol}}var emval_methodCallers=[];function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=requireHandle(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function emval_get_global(){return function(){return Function}()("return this")()}function __emval_get_global(name){if(name===0){return __emval_register(emval_get_global())}else{name=getStringOrSymbol(name);return __emval_register(emval_get_global()[name])}}function __emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function __emval_lookupTypes(argCount,argTypes,argWireTypes){var a=new Array(argCount);for(var i=0;i>2)+i],"parameter "+i)}return a}function __emval_get_method_caller(argCount,argTypes){var types=__emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var params=["retType"];var args=[retType];var argsList="";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function craftEmvalAllocator(argCount){var argsList="";for(var i=0;i> 2) + "+i+'], "parameter '+i+'");\n'+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return __emval_register(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","__emval_register",functionBody)(requireRegisteredType,Module,__emval_register)}var emval_newers={};function __emval_new(handle,argCount,argTypes,args){handle=requireHandle(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)}function __emval_new_cstring(v){return __emval_register(getStringOrSymbol(v))}function __emval_run_destructors(handle){var destructors=emval_handle_array[handle].value;runDestructors(destructors);__emval_decref(handle)}function _abort(){Module["abort"]()}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){buffer=wasmMemory.buffer;return true}else{return false}}catch(e){return false}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize>2]=value;return value}embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");InternalError=Module["InternalError"]=extendError(Error,"InternalError");init_ClassHandle();init_RegisteredPointer();init_embind();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");init_emval();var asmGlobalArg={};var asmLibraryArg={"d":abort,"B":setTempRet0,"i":___cxa_allocate_exception,"h":___cxa_throw,"n":___setErrNo,"A":___syscall140,"m":___syscall146,"z":___syscall6,"y":__embind_register_bool,"x":__embind_register_class,"w":__embind_register_class_constructor,"g":__embind_register_class_function,"K":__embind_register_emval,"v":__embind_register_float,"J":__embind_register_function,"f":__embind_register_integer,"c":__embind_register_memory_view,"u":__embind_register_std_string,"I":__embind_register_std_wstring,"H":__embind_register_void,"t":__emval_as,"s":__emval_call_void_method,"b":__emval_decref,"G":__emval_get_global,"r":__emval_get_method_caller,"q":__emval_get_module_property,"k":__emval_get_property,"l":__emval_incref,"p":__emval_new,"j":__emval_new_cstring,"o":__emval_run_destructors,"e":_abort,"F":_emscripten_get_heap_size,"E":_emscripten_memcpy_big,"D":_emscripten_resize_heap,"C":abortOnCannotGrowMemory,"a":DYNAMICTOP_PTR};var asm=Module["asm"](asmGlobalArg,asmLibraryArg,buffer);Module["asm"]=asm;var ___errno_location=Module["___errno_location"]=function(){return Module["asm"]["L"].apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return Module["asm"]["M"].apply(null,arguments)};var _free=Module["_free"]=function(){return Module["asm"]["N"].apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return Module["asm"]["O"].apply(null,arguments)};var globalCtors=Module["globalCtors"]=function(){return Module["asm"]["ca"].apply(null,arguments)};var dynCall_ii=Module["dynCall_ii"]=function(){return Module["asm"]["P"].apply(null,arguments)};var dynCall_iidiiii=Module["dynCall_iidiiii"]=function(){return Module["asm"]["Q"].apply(null,arguments)};var dynCall_iii=Module["dynCall_iii"]=function(){return Module["asm"]["R"].apply(null,arguments)};var dynCall_iiii=Module["dynCall_iiii"]=function(){return Module["asm"]["S"].apply(null,arguments)};var dynCall_iiiii=Module["dynCall_iiiii"]=function(){return Module["asm"]["T"].apply(null,arguments)};var dynCall_iiiiii=Module["dynCall_iiiiii"]=function(){return Module["asm"]["U"].apply(null,arguments)};var dynCall_iiiiiiii=Module["dynCall_iiiiiiii"]=function(){return Module["asm"]["V"].apply(null,arguments)};var dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=function(){return Module["asm"]["W"].apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return Module["asm"]["X"].apply(null,arguments)};var dynCall_v=Module["dynCall_v"]=function(){return Module["asm"]["Y"].apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return Module["asm"]["Z"].apply(null,arguments)};var dynCall_vii=Module["dynCall_vii"]=function(){return Module["asm"]["_"].apply(null,arguments)};var dynCall_viiii=Module["dynCall_viiii"]=function(){return Module["asm"]["$"].apply(null,arguments)};var dynCall_viiiii=Module["dynCall_viiiii"]=function(){return Module["asm"]["aa"].apply(null,arguments)};var dynCall_viiiiii=Module["dynCall_viiiiii"]=function(){return Module["asm"]["ba"].apply(null,arguments)};Module["asm"]=asm;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run(); + +var BASIS = (function() { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + return ( +function(BASIS) { + BASIS = BASIS || {}; + +var Module=typeof BASIS!=="undefined"?BASIS:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_NODE){scriptDirectory=__dirname+"/";var nodeFS;var nodePath;read_=function shell_read(filename,binary){var ret;if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){arguments_=scriptArgs}else if(typeof arguments!="undefined"){arguments_=arguments}if(typeof quit==="function"){quit_=function(status){quit(status)}}if(typeof print!=="undefined"){if(typeof console==="undefined")console={};console.log=print;console.warn=console.error=typeof printErr!=="undefined"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}read_=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var asm2wasmImports={"f64-rem":function(x,y){return x%y},"debugger":function(){}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime;if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(typeof WebAssembly!=="object"){err("no native wasm support detected")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(u8Array[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;var WASM_PAGE_SIZE=65536;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var DYNAMIC_BASE=5482368,DYNAMICTOP_PTR=239456;var INITIAL_TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_TOTAL_MEMORY/WASM_PAGE_SIZE})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_TOTAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}var wasmBinaryFile="basis_transcoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(env){var info={"env":env,"wasi_unstable":env,"global":{"NaN":NaN,Infinity:Infinity},"global.Math":Math,"asm2wasm":asm2wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&typeof fetch==="function"){fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}Module["asm"]=function(global,env,providedBuffer){env["memory"]=wasmMemory;env["table"]=wasmTable=new WebAssembly.Table({"initial":342,"maximum":342,"element":"anyfunc"});env["__memory_base"]=1024;env["__table_base"]=0;var exports=createWasm(env);return exports};__ATINIT__.push({func:function(){globalCtors()}});function ___cxa_allocate_exception(size){return _malloc(size)}var ___exception_infos={};function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}var ___exception_last=0;function ___cxa_throw(ptr,type,destructor){___exception_infos[ptr]={ptr:ptr,adjusted:[ptr],type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};___exception_last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exceptions=1}else{__ZSt18uncaught_exceptionv.uncaught_exceptions++}throw ptr}function ___cxa_uncaught_exceptions(){return __ZSt18uncaught_exceptionv.uncaught_exceptions}var PATH={splitPath:function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:function(l,r){return PATH.normalize(l+"/"+r)}};var SYSCALLS={buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:0,get:function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(){var ret=UTF8ToString(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();return low},getZero:function(){SYSCALLS.get()}};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _fd_write(stream,iov,iovcnt,pnum){try{var num=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___wasi_fd_write(){return _fd_write.apply(null,arguments)}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}var finalizationGroup=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function attachFinalizer(handle){if("undefined"===typeof FinalizationGroup){attachFinalizer=function(handle){return handle};return handle}finalizationGroup=new FinalizationGroup(function(iter){for(var result=iter.next();!result.done;result=iter.next()){var $$=result.value;if(!$$.ptr){console.warn("object already deleted: "+$$.ptr)}else{releaseClassHandle($$)}}});attachFinalizer=function(handle){finalizationGroup.register(handle,handle.$$,handle.$$);return handle};detachFinalizer=function(handle){finalizationGroup.unregister(handle.$$)};return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}var delayFunction=undefined;var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype["isAliasOf"]=ClassHandle_isAliasOf;ClassHandle.prototype["clone"]=ClassHandle_clone;ClassHandle.prototype["delete"]=ClassHandle_delete;ClassHandle.prototype["isDeleted"]=ClassHandle_isDeleted;ClassHandle.prototype["deleteLater"]=ClassHandle_deleteLater}function ClassHandle(){}var registeredPointers={};function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,__emval_register(function(){clonedHandle["delete"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle["delete"]()}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype["fromWireType"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(dynCall){var args=[];for(var i=1;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}var destructors=[];var args=new Array(argCount);args[0]=rawConstructor;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn),argCount-1);return[]})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=function(value){return value};if(minRange===0){var bitshift=32-8*size;fromWireType=function(value){return value<>>bitshift}}var isUnsignedType=name.indexOf("unsigned")!=-1;registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(valuemaxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return isUnsignedType?value>>>0:value|0},"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap["buffer"],data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var endChar=HEAPU8[value+4+length];var endCharSwap=0;if(endChar!=0){endCharSwap=endChar;HEAPU8[value+4+length]=0}var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(HEAPU8[currentBytePtr]==0){var stringSegment=UTF8ToString(decodeStartPtr);if(str===undefined)str=stringSegment;else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}if(endCharSwap!=0)HEAPU8[value+4+length]=endCharSwap}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;i>2];var a=new Array(length);var start=value+4>>shift;for(var i=0;i>2]=length;var start=ptr+4>>shift;for(var i=0;i>2]=rd;return returnType["toWireType"](destructors,handle)}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}else{return symbol}}var emval_methodCallers=[];function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=requireHandle(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function emval_get_global(){if(typeof globalThis==="object"){return globalThis}return function(){return Function}()("return this")()}function __emval_get_global(name){if(name===0){return __emval_register(emval_get_global())}else{name=getStringOrSymbol(name);return __emval_register(emval_get_global()[name])}}function __emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function __emval_lookupTypes(argCount,argTypes,argWireTypes){var a=new Array(argCount);for(var i=0;i>2)+i],"parameter "+i)}return a}function __emval_get_method_caller(argCount,argTypes){var types=__emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var params=["retType"];var args=[retType];var argsList="";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function craftEmvalAllocator(argCount){var argsList="";for(var i=0;i> 2) + "+i+'], "parameter '+i+'");\n'+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return __emval_register(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","__emval_register",functionBody)(requireRegisteredType,Module,__emval_register)}var emval_newers={};function __emval_new(handle,argCount,argTypes,args){handle=requireHandle(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)}function __emval_new_cstring(v){return __emval_register(getStringOrSymbol(v))}function __emval_run_destructors(handle){var destructors=emval_handle_array[handle].value;runDestructors(destructors);__emval_decref(handle)}function _abort(){Module["abort"]()}function _emscripten_get_heap_size(){return HEAP8.length}function _llvm_trap(){abort("trap!")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest)}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run(); + + + return BASIS +} +); +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = BASIS; + else if (typeof define === 'function' && define['amd']) + define([], function() { return BASIS; }); + else if (typeof exports === 'object') + exports["BASIS"] = BASIS; + \ No newline at end of file diff --git a/examples/js/libs/basis/basis_transcoder.wasm b/examples/js/libs/basis/basis_transcoder.wasm index c5b4d204411003d75e80410b345cc7138dfbe21c..9298699dae5f4ec7b9f0497cd5f7113931ef139a 100644 Binary files a/examples/js/libs/basis/basis_transcoder.wasm and b/examples/js/libs/basis/basis_transcoder.wasm differ diff --git a/examples/js/loaders/BasisTextureLoader.js b/examples/js/loaders/BasisTextureLoader.js index f0ada254352584413162005af4c9384c51b7f186..f2780fe9c5b23e51aa9568136945e69b503e7d17 100644 --- a/examples/js/loaders/BasisTextureLoader.js +++ b/examples/js/loaders/BasisTextureLoader.js @@ -4,8 +4,6 @@ * @author Shrek Shao / https://github.com/shrekshao */ -/* global Module, createBasisModule */ - /** * Loader for Basis Universal GPU Texture Codec. * @@ -32,6 +30,7 @@ THREE.BasisTextureLoader = function ( manager ) { this.workerSourceURL = ''; this.workerConfig = { format: null, + astcSupported: false, etcSupported: false, dxtSupported: false, pvrtcSupported: false, @@ -63,22 +62,27 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader. var config = this.workerConfig; + config.astcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_astc' ); config.etcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_etc1' ); config.dxtSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_s3tc' ); config.pvrtcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || !! renderer.extensions.get( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - if ( config.etcSupported ) { + if ( config.astcSupported ) { - config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFETC1; + config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFASTC_4x4; } else if ( config.dxtSupported ) { - config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFBC1; + config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFBC3; } else if ( config.pvrtcSupported ) { - config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY; + config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA; + + } else if ( config.etcSupported ) { + + config.format = THREE.BasisTextureLoader.BASIS_FORMAT.cTFETC1; } else { @@ -136,25 +140,30 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader. var config = this.workerConfig; - var { width, height, mipmaps } = message; + var { width, height, hasAlpha, mipmaps, format } = message; var texture; - if ( config.etcSupported ) { - - texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGB_ETC1_Format ); - - } else if ( config.dxtSupported ) { - - texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.BasisTextureLoader.DXT_FORMAT_MAP[ config.format ], THREE.UnsignedByteType ); - - } else if ( config.pvrtcSupported ) { - - texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGB_PVRTC_4BPPV1_Format ); - - } else { - - throw new Error( 'THREE.BasisTextureLoader: No supported format available.' ); + switch ( format ) { + + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFASTC_4x4: + texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGBA_ASTC_4x4_Format ); + break; + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFBC1: + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFBC3: + texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.BasisTextureLoader.DXT_FORMAT_MAP[ config.format ], THREE.UnsignedByteType ); + break; + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFETC1: + texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGB_ETC1_Format ); + break; + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB: + texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGB_PVRTC_4BPPV1_Format ); + break; + case THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA: + texture = new THREE.CompressedTexture( mipmaps, width, height, THREE.RGBA_PVRTC_4BPPV1_Format ); + break; + default: + throw new Error( 'THREE.BasisTextureLoader: No supported format available.' ); } @@ -214,12 +223,7 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader. var body = [ '/* basis_transcoder.js */', - 'var Module;', - 'function createBasisModule () {', - ' ' + jsContent, - ' return Module;', - '}', - '', + jsContent, '/* worker */', fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) ) ].join( '\n' ); @@ -312,13 +316,22 @@ THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader. THREE.BasisTextureLoader.BASIS_FORMAT = { cTFETC1: 0, - cTFBC1: 1, - cTFBC4: 2, - cTFPVRTC1_4_OPAQUE_ONLY: 3, - cTFBC7_M6_OPAQUE_ONLY: 4, - cTFETC2: 5, - cTFBC3: 6, - cTFBC5: 7, + cTFETC2: 1, + cTFBC1: 2, + cTFBC3: 3, + cTFBC4: 4, + cTFBC5: 5, + cTFBC7_M6_OPAQUE_ONLY: 6, + cTFBC7_M5: 7, + cTFPVRTC1_4_RGB: 8, + cTFPVRTC1_4_RGBA: 9, + cTFASTC_4x4: 10, + cTFATC_RGB: 11, + cTFATC_RGBA_INTERPOLATED_ALPHA: 12, + cTFRGBA32: 13, + cTFRGB565: 14, + cTFBGR565: 15, + cTFRGBA4444: 16, }; // DXT formats, from: @@ -359,7 +372,7 @@ THREE.BasisTextureLoader.BasisWorker = function () { try { - var { width, height, mipmaps } = transcode( message.buffer ); + var { width, height, hasAlpha, mipmaps, format } = transcode( message.buffer ); var buffers = []; @@ -369,7 +382,7 @@ THREE.BasisTextureLoader.BasisWorker = function () { } - self.postMessage( { type: 'transcode', id: message.id, width, height, mipmaps }, buffers ); + self.postMessage( { type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format }, buffers ); } catch ( error ) { @@ -388,19 +401,15 @@ THREE.BasisTextureLoader.BasisWorker = function () { function init( wasmBinary ) { + var BasisModule; transcoderPending = new Promise( ( resolve ) => { - // The 'Module' global is used by the Basis wrapper, which will check for - // the 'wasmBinary' property before trying to load the file itself. - - // TODO(donmccurdy): This only works with a modified version of the - // emscripten-generated wrapper. The default seems to have a bug making it - // impossible to override the WASM binary. - Module = { wasmBinary, onRuntimeInitialized: resolve }; + BasisModule = { wasmBinary, onRuntimeInitialized: resolve }; + BASIS( BasisModule ); } ).then( () => { - var { BasisFile, initializeBasis } = Module; + var { BasisFile, initializeBasis } = BasisModule; _BasisFile = BasisFile; @@ -408,8 +417,6 @@ THREE.BasisTextureLoader.BasisWorker = function () { } ); - createBasisModule(); - } function transcode( buffer ) { @@ -419,6 +426,7 @@ THREE.BasisTextureLoader.BasisWorker = function () { var width = basisFile.getImageWidth( 0, 0 ); var height = basisFile.getImageHeight( 0, 0 ); var levels = basisFile.getNumLevels( 0 ); + var hasAlpha = basisFile.getHasAlpha(); function cleanup() { @@ -427,6 +435,20 @@ THREE.BasisTextureLoader.BasisWorker = function () { } + if ( ! hasAlpha ) { + + switch ( config.format ) { + + case 9: // Hardcoded: THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA + config.format = 8; // Hardcoded: THREE.BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB; + break; + default: + break; + + } + + } + if ( ! width || ! height || ! levels ) { cleanup(); @@ -441,12 +463,6 @@ THREE.BasisTextureLoader.BasisWorker = function () { } - if ( basisFile.getHasAlpha() ) { - - console.warn( 'THREE.BasisTextureLoader: Alpha not yet implemented.' ); - - } - var mipmaps = []; for ( var mip = 0; mip < levels; mip ++ ) { @@ -460,7 +476,7 @@ THREE.BasisTextureLoader.BasisWorker = function () { 0, mip, config.format, - config.etcSupported ? 0 : ( config.dxtSupported ? 1 : 0 ), + hasAlpha, 0 ); @@ -477,7 +493,7 @@ THREE.BasisTextureLoader.BasisWorker = function () { cleanup(); - return { width, height, mipmaps }; + return { width, height, hasAlpha, mipmaps, format: config.format }; } diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index 6f387b9fb45df8ab5ae10fdc5f07057e5c73b194..967f399b03559015b0d9d5bd5f8503cd5495d816 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -269,8 +269,7 @@ THREE.GLTFLoader = ( function () { /** * DDS Texture Extension * - * Specification: - * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds + * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds * */ function GLTFTextureDDSExtension( ddsLoader ) { @@ -287,9 +286,9 @@ THREE.GLTFLoader = ( function () { } /** - * Lights Extension + * Punctual Lights Extension * - * Specification: PENDING + * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual */ function GLTFLightsExtension( json ) { @@ -356,9 +355,9 @@ THREE.GLTFLoader = ( function () { }; /** - * Unlit Materials Extension (pending) + * Unlit Materials Extension * - * PR: https://github.com/KhronosGroup/glTF/pull/1163 + * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit */ function GLTFMaterialsUnlitExtension() { @@ -473,7 +472,7 @@ THREE.GLTFLoader = ( function () { /** * DRACO Mesh Compression Extension * - * Specification: https://github.com/KhronosGroup/glTF/pull/874 + * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression */ function GLTFDracoMeshCompressionExtension( json, dracoLoader ) { @@ -551,7 +550,7 @@ THREE.GLTFLoader = ( function () { /** * Texture Transform Extension * - * Specification: + * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform */ function GLTFTextureTransformExtension() { diff --git a/examples/js/loaders/OBJLoader.js b/examples/js/loaders/OBJLoader.js index 2f4e039932b851dde5111a3e8f52e0a609b3db9d..557dd8ff840538e3e3984c5e17d076a939814048 100644 --- a/examples/js/loaders/OBJLoader.js +++ b/examples/js/loaders/OBJLoader.js @@ -286,6 +286,12 @@ THREE.OBJLoader = ( function () { this.addVertex( ia, ib, ic ); + if ( this.colors.length > 0 ) { + + this.addColor( ia, ib, ic ); + + } + if ( ua !== undefined && ua !== '' ) { var uvLen = this.uvs.length; @@ -309,12 +315,6 @@ THREE.OBJLoader = ( function () { } - if ( this.colors.length > 0 ) { - - this.addColor( ia, ib, ic ); - - } - }, addPointGeometry: function ( vertices ) { diff --git a/examples/js/shaders/CopyShader.js b/examples/js/shaders/CopyShader.js index 0cd00e4db01346f555ffb22752e83950cba24e6a..b118e73448431b51f9562ad3af5117dc3f92b0a9 100644 --- a/examples/js/shaders/CopyShader.js +++ b/examples/js/shaders/CopyShader.js @@ -9,7 +9,7 @@ THREE.CopyShader = { uniforms: { "tDiffuse": { value: null }, - "opacity": { value: 1.0 } + "opacity": { value: 1.0 } }, diff --git a/examples/js/shaders/DepthLimitedBlurShader.js b/examples/js/shaders/DepthLimitedBlurShader.js index d9e71acea35743a6b7d4896bad69f6b156c36607..d63d23f570c2484479ee3a39fa267d2ffde86a67 100644 --- a/examples/js/shaders/DepthLimitedBlurShader.js +++ b/examples/js/shaders/DepthLimitedBlurShader.js @@ -4,19 +4,19 @@ THREE.DepthLimitedBlurShader = { defines: { - 'KERNEL_RADIUS': 4, - 'DEPTH_PACKING': 1, - 'PERSPECTIVE_CAMERA': 1 + "KERNEL_RADIUS": 4, + "DEPTH_PACKING": 1, + "PERSPECTIVE_CAMERA": 1 }, uniforms: { - 'tDiffuse': { value: null }, - 'size': { value: new THREE.Vector2( 512, 512 ) }, - 'sampleUvOffsets': { value: [ new THREE.Vector2( 0, 0 ) ] }, - 'sampleWeights': { value: [ 1.0 ] }, - 'tDepth': { value: null }, - 'cameraNear': { value: 10 }, - 'cameraFar': { value: 1000 }, - 'depthCutoff': { value: 10 }, + "tDiffuse": { value: null }, + "size": { value: new THREE.Vector2( 512, 512 ) }, + "sampleUvOffsets": { value: [ new THREE.Vector2( 0, 0 ) ] }, + "sampleWeights": { value: [ 1.0 ] }, + "tDepth": { value: null }, + "cameraNear": { value: 10 }, + "cameraFar": { value: 1000 }, + "depthCutoff": { value: 10 }, }, vertexShader: [ "#include ", @@ -149,9 +149,9 @@ THREE.BlurShaderUtils = { configure: function ( material, kernelRadius, stdDev, uvIncrement ) { - material.defines[ 'KERNEL_RADIUS' ] = kernelRadius; - material.uniforms[ 'sampleUvOffsets' ].value = THREE.BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement ); - material.uniforms[ 'sampleWeights' ].value = THREE.BlurShaderUtils.createSampleWeights( kernelRadius, stdDev ); + material.defines[ "KERNEL_RADIUS" ] = kernelRadius; + material.uniforms[ "sampleUvOffsets" ].value = THREE.BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement ); + material.uniforms[ "sampleWeights" ].value = THREE.BlurShaderUtils.createSampleWeights( kernelRadius, stdDev ); material.needsUpdate = true; } diff --git a/examples/js/shaders/DigitalGlitch.js b/examples/js/shaders/DigitalGlitch.js index 223cd171b6efa2d09b179c3d6bbb8e3939cbd42f..7722ec219e35530be49ccd2ae777e8edf0535145 100644 --- a/examples/js/shaders/DigitalGlitch.js +++ b/examples/js/shaders/DigitalGlitch.js @@ -37,7 +37,7 @@ THREE.DigitalGlitch = { ].join( "\n" ), fragmentShader: [ - "uniform int byp;",//should we apply the glitch ? + "uniform int byp;", //should we apply the glitch ? "uniform sampler2D tDiffuse;", "uniform sampler2D tDisp;", diff --git a/examples/js/shaders/DotScreenShader.js b/examples/js/shaders/DotScreenShader.js index 530d147a2f8b68e8f1d9721be4e9ebb4f2b4f15c..cbfdb4dd43ad5ca129ed23f4ee0a6af159e437cb 100644 --- a/examples/js/shaders/DotScreenShader.js +++ b/examples/js/shaders/DotScreenShader.js @@ -11,10 +11,10 @@ THREE.DotScreenShader = { uniforms: { "tDiffuse": { value: null }, - "tSize": { value: new THREE.Vector2( 256, 256 ) }, - "center": { value: new THREE.Vector2( 0.5, 0.5 ) }, - "angle": { value: 1.57 }, - "scale": { value: 1.0 } + "tSize": { value: new THREE.Vector2( 256, 256 ) }, + "center": { value: new THREE.Vector2( 0.5, 0.5 ) }, + "angle": { value: 1.57 }, + "scale": { value: 1.0 } }, diff --git a/examples/js/shaders/FXAAShader.js b/examples/js/shaders/FXAAShader.js index 4be33d0b33a1c8375a4cca3ea7debebb5c292fda..731e203646324608fd945be6117c685a400bae8b 100644 --- a/examples/js/shaders/FXAAShader.js +++ b/examples/js/shaders/FXAAShader.js @@ -31,1085 +31,1085 @@ THREE.FXAAShader = { ].join( "\n" ), fragmentShader: [ - "precision highp float;", - "", - "uniform sampler2D tDiffuse;", - "", - "uniform vec2 resolution;", - "", - "varying vec2 vUv;", - "", - "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", - "", - "//----------------------------------------------------------------------------------", - "// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag", - "// SDK Version: v3.00", - "// Email: gameworks@nvidia.com", - "// Site: http://developer.nvidia.com/", - "//", - "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", - "//", - "// Redistribution and use in source and binary forms, with or without", - "// modification, are permitted provided that the following conditions", - "// are met:", - "// * Redistributions of source code must retain the above copyright", - "// notice, this list of conditions and the following disclaimer.", - "// * Redistributions in binary form must reproduce the above copyright", - "// notice, this list of conditions and the following disclaimer in the", - "// documentation and/or other materials provided with the distribution.", - "// * Neither the name of NVIDIA CORPORATION nor the names of its", - "// contributors may be used to endorse or promote products derived", - "// from this software without specific prior written permission.", - "//", - "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", - "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", - "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", - "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR", - "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", - "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", - "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", - "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", - "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", - "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", - "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", - "//", - "//----------------------------------------------------------------------------------", - "", - "#define FXAA_PC 1", - "#define FXAA_GLSL_100 1", - "#define FXAA_QUALITY_PRESET 12", - "", - "#define FXAA_GREEN_AS_LUMA 1", - "", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_PC_CONSOLE", - " //", - " // The console algorithm for PC is included", - " // for developers targeting really low spec machines.", - " // Likely better to just run FXAA_PC, and use a really low preset.", - " //", - " #define FXAA_PC_CONSOLE 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GLSL_120", - " #define FXAA_GLSL_120 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GLSL_130", - " #define FXAA_GLSL_130 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_3", - " #define FXAA_HLSL_3 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_4", - " #define FXAA_HLSL_4 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_5", - " #define FXAA_HLSL_5 0", - "#endif", - "/*==========================================================================*/", - "#ifndef FXAA_GREEN_AS_LUMA", - " //", - " // For those using non-linear color,", - " // and either not able to get luma in alpha, or not wanting to,", - " // this enables FXAA to run using green as a proxy for luma.", - " // So with this enabled, no need to pack luma in alpha.", - " //", - " // This will turn off AA on anything which lacks some amount of green.", - " // Pure red and blue or combination of only R and B, will get no AA.", - " //", - " // Might want to lower the settings for both,", - " // fxaaConsoleEdgeThresholdMin", - " // fxaaQualityEdgeThresholdMin", - " // In order to insure AA does not get turned off on colors", - " // which contain a minor amount of green.", - " //", - " // 1 = On.", - " // 0 = Off.", - " //", - " #define FXAA_GREEN_AS_LUMA 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_EARLY_EXIT", - " //", - " // Controls algorithm's early exit path.", - " // On PS3 turning this ON adds 2 cycles to the shader.", - " // On 360 turning this OFF adds 10ths of a millisecond to the shader.", - " // Turning this off on console will result in a more blurry image.", - " // So this defaults to on.", - " //", - " // 1 = On.", - " // 0 = Off.", - " //", - " #define FXAA_EARLY_EXIT 1", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_DISCARD", - " //", - " // Only valid for PC OpenGL currently.", - " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", - " //", - " // 1 = Use discard on pixels which don't need AA.", - " // For APIs which enable concurrent TEX+ROP from same surface.", - " // 0 = Return unchanged color on pixels which don't need AA.", - " //", - " #define FXAA_DISCARD 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_FAST_PIXEL_OFFSET", - " //", - " // Used for GLSL 120 only.", - " //", - " // 1 = GL API supports fast pixel offsets", - " // 0 = do not use fast pixel offsets", - " //", - " #ifdef GL_EXT_gpu_shader4", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifdef GL_NV_gpu_shader5", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifdef GL_ARB_gpu_shader5", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifndef FXAA_FAST_PIXEL_OFFSET", - " #define FXAA_FAST_PIXEL_OFFSET 0", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GATHER4_ALPHA", - " //", - " // 1 = API supports gather4 on alpha channel.", - " // 0 = API does not support gather4 on alpha channel.", - " //", - " #if (FXAA_HLSL_5 == 1)", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifdef GL_ARB_gpu_shader5", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifdef GL_NV_gpu_shader5", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifndef FXAA_GATHER4_ALPHA", - " #define FXAA_GATHER4_ALPHA 0", - " #endif", - "#endif", - "", - "", - "/*============================================================================", - " FXAA QUALITY - TUNING KNOBS", - "------------------------------------------------------------------------------", - "NOTE the other tuning knobs are now in the shader function inputs!", - "============================================================================*/", - "#ifndef FXAA_QUALITY_PRESET", - " //", - " // Choose the quality preset.", - " // This needs to be compiled into the shader as it effects code.", - " // Best option to include multiple presets is to", - " // in each shader define the preset, then include this file.", - " //", - " // OPTIONS", - " // -----------------------------------------------------------------------", - " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", - " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", - " // 39 - no dither, very expensive", - " //", - " // NOTES", - " // -----------------------------------------------------------------------", - " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", - " // 13 = about same speed as FXAA 3.9 and better than 12", - " // 23 = closest to FXAA 3.9 visually and performance wise", - " // _ = the lowest digit is directly related to performance", - " // _ = the highest digit is directly related to style", - " //", - " #define FXAA_QUALITY_PRESET 12", - "#endif", - "", - "", - "/*============================================================================", - "", - " FXAA QUALITY - PRESETS", - "", - "============================================================================*/", - "", - "/*============================================================================", - " FXAA QUALITY - MEDIUM DITHER PRESETS", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 10)", - " #define FXAA_QUALITY_PS 3", - " #define FXAA_QUALITY_P0 1.5", - " #define FXAA_QUALITY_P1 3.0", - " #define FXAA_QUALITY_P2 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 11)", - " #define FXAA_QUALITY_PS 4", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 3.0", - " #define FXAA_QUALITY_P3 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 12)", - " #define FXAA_QUALITY_PS 5", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 4.0", - " #define FXAA_QUALITY_P4 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 13)", - " #define FXAA_QUALITY_PS 6", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 4.0", - " #define FXAA_QUALITY_P5 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 14)", - " #define FXAA_QUALITY_PS 7", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 4.0", - " #define FXAA_QUALITY_P6 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 15)", - " #define FXAA_QUALITY_PS 8", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 4.0", - " #define FXAA_QUALITY_P7 12.0", - "#endif", - "", - "/*============================================================================", - " FXAA QUALITY - LOW DITHER PRESETS", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 20)", - " #define FXAA_QUALITY_PS 3", - " #define FXAA_QUALITY_P0 1.5", - " #define FXAA_QUALITY_P1 2.0", - " #define FXAA_QUALITY_P2 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 21)", - " #define FXAA_QUALITY_PS 4", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 22)", - " #define FXAA_QUALITY_PS 5", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 23)", - " #define FXAA_QUALITY_PS 6", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 24)", - " #define FXAA_QUALITY_PS 7", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 3.0", - " #define FXAA_QUALITY_P6 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 25)", - " #define FXAA_QUALITY_PS 8", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 4.0", - " #define FXAA_QUALITY_P7 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 26)", - " #define FXAA_QUALITY_PS 9", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 4.0", - " #define FXAA_QUALITY_P8 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 27)", - " #define FXAA_QUALITY_PS 10", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 4.0", - " #define FXAA_QUALITY_P9 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 28)", - " #define FXAA_QUALITY_PS 11", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 4.0", - " #define FXAA_QUALITY_P10 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 29)", - " #define FXAA_QUALITY_PS 12", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 2.0", - " #define FXAA_QUALITY_P10 4.0", - " #define FXAA_QUALITY_P11 8.0", - "#endif", - "", - "/*============================================================================", - " FXAA QUALITY - EXTREME QUALITY", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 39)", - " #define FXAA_QUALITY_PS 12", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.0", - " #define FXAA_QUALITY_P2 1.0", - " #define FXAA_QUALITY_P3 1.0", - " #define FXAA_QUALITY_P4 1.0", - " #define FXAA_QUALITY_P5 1.5", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 2.0", - " #define FXAA_QUALITY_P10 4.0", - " #define FXAA_QUALITY_P11 8.0", - "#endif", - "", - "", - "", - "/*============================================================================", - "", - " API PORTING", - "", - "============================================================================*/", - "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", - " #define FxaaBool bool", - " #define FxaaDiscard discard", - " #define FxaaFloat float", - " #define FxaaFloat2 vec2", - " #define FxaaFloat3 vec3", - " #define FxaaFloat4 vec4", - " #define FxaaHalf float", - " #define FxaaHalf2 vec2", - " #define FxaaHalf3 vec3", - " #define FxaaHalf4 vec4", - " #define FxaaInt2 ivec2", - " #define FxaaSat(x) clamp(x, 0.0, 1.0)", - " #define FxaaTex sampler2D", - "#else", - " #define FxaaBool bool", - " #define FxaaDiscard clip(-1)", - " #define FxaaFloat float", - " #define FxaaFloat2 float2", - " #define FxaaFloat3 float3", - " #define FxaaFloat4 float4", - " #define FxaaHalf half", - " #define FxaaHalf2 half2", - " #define FxaaHalf3 half3", - " #define FxaaHalf4 half4", - " #define FxaaSat(x) saturate(x)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_100 == 1)", - " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_120 == 1)", - " // Requires,", - " // #version 120", - " // And at least,", - " // #extension GL_EXT_gpu_shader4 : enable", - " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", - " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", - " #if (FXAA_FAST_PIXEL_OFFSET == 1)", - " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", - " #else", - " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", - " #endif", - " #if (FXAA_GATHER4_ALPHA == 1)", - " // use #extension GL_ARB_gpu_shader5 : enable", - " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", - " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", - " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", - " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_130 == 1)", - " // Requires \"#version 130\" or better", - " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", - " #if (FXAA_GATHER4_ALPHA == 1)", - " // use #extension GL_ARB_gpu_shader5 : enable", - " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", - " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", - " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", - " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_3 == 1)", - " #define FxaaInt2 float2", - " #define FxaaTex sampler2D", - " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", - " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_4 == 1)", - " #define FxaaInt2 int2", - " struct FxaaTex { SamplerState smpl; Texture2D tex; };", - " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_5 == 1)", - " #define FxaaInt2 int2", - " struct FxaaTex { SamplerState smpl; Texture2D tex; };", - " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", - " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", - " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", - " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", - " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", - "#endif", - "", - "", - "/*============================================================================", - " GREEN AS LUMA OPTION SUPPORT FUNCTION", - "============================================================================*/", - "#if (FXAA_GREEN_AS_LUMA == 0)", - " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", - "#else", - " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", - "#endif", - "", - "", - "", - "", - "/*============================================================================", - "", - " FXAA3 QUALITY - PC", - "", - "============================================================================*/", - "#if (FXAA_PC == 1)", - "/*--------------------------------------------------------------------------*/", - "FxaaFloat4 FxaaPixelShader(", - " //", - " // Use noperspective interpolation here (turn off perspective interpolation).", - " // {xy} = center of pixel", - " FxaaFloat2 pos,", - " //", - " // Used only for FXAA Console, and not used on the 360 version.", - " // Use noperspective interpolation here (turn off perspective interpolation).", - " // {xy_} = upper left of pixel", - " // {_zw} = lower right of pixel", - " FxaaFloat4 fxaaConsolePosPos,", - " //", - " // Input color texture.", - " // {rgb_} = color in linear or perceptual color space", - " // if (FXAA_GREEN_AS_LUMA == 0)", - " // {__a} = luma in perceptual color space (not linear)", - " FxaaTex tex,", - " //", - " // Only used on the optimized 360 version of FXAA Console.", - " // For everything but 360, just use the same input here as for \"tex\".", - " // For 360, same texture, just alias with a 2nd sampler.", - " // This sampler needs to have an exponent bias of -1.", - " FxaaTex fxaaConsole360TexExpBiasNegOne,", - " //", - " // Only used on the optimized 360 version of FXAA Console.", - " // For everything but 360, just use the same input here as for \"tex\".", - " // For 360, same texture, just alias with a 3nd sampler.", - " // This sampler needs to have an exponent bias of -2.", - " FxaaTex fxaaConsole360TexExpBiasNegTwo,", - " //", - " // Only used on FXAA Quality.", - " // This must be from a constant/uniform.", - " // {x_} = 1.0/screenWidthInPixels", - " // {_y} = 1.0/screenHeightInPixels", - " FxaaFloat2 fxaaQualityRcpFrame,", - " //", - " // Only used on FXAA Console.", - " // This must be from a constant/uniform.", - " // This effects sub-pixel AA quality and inversely sharpness.", - " // Where N ranges between,", - " // N = 0.50 (default)", - " // N = 0.33 (sharper)", - " // {x__} = -N/screenWidthInPixels", - " // {_y_} = -N/screenHeightInPixels", - " // {_z_} = N/screenWidthInPixels", - " // {__w} = N/screenHeightInPixels", - " FxaaFloat4 fxaaConsoleRcpFrameOpt,", - " //", - " // Only used on FXAA Console.", - " // Not used on 360, but used on PS3 and PC.", - " // This must be from a constant/uniform.", - " // {x__} = -2.0/screenWidthInPixels", - " // {_y_} = -2.0/screenHeightInPixels", - " // {_z_} = 2.0/screenWidthInPixels", - " // {__w} = 2.0/screenHeightInPixels", - " FxaaFloat4 fxaaConsoleRcpFrameOpt2,", - " //", - " // Only used on FXAA Console.", - " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", - " // This must be from a constant/uniform.", - " // {x__} = 8.0/screenWidthInPixels", - " // {_y_} = 8.0/screenHeightInPixels", - " // {_z_} = -4.0/screenWidthInPixels", - " // {__w} = -4.0/screenHeightInPixels", - " FxaaFloat4 fxaaConsole360RcpFrameOpt2,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_SUBPIX define.", - " // It is here now to allow easier tuning.", - " // Choose the amount of sub-pixel aliasing removal.", - " // This can effect sharpness.", - " // 1.00 - upper limit (softer)", - " // 0.75 - default amount of filtering", - " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)", - " // 0.25 - almost off", - " // 0.00 - completely off", - " FxaaFloat fxaaQualitySubpix,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", - " // It is here now to allow easier tuning.", - " // The minimum amount of local contrast required to apply algorithm.", - " // 0.333 - too little (faster)", - " // 0.250 - low quality", - " // 0.166 - default", - " // 0.125 - high quality", - " // 0.063 - overkill (slower)", - " FxaaFloat fxaaQualityEdgeThreshold,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", - " // It is here now to allow easier tuning.", - " // Trims the algorithm from processing darks.", - " // 0.0833 - upper limit (default, the start of visible unfiltered edges)", - " // 0.0625 - high quality (faster)", - " // 0.0312 - visible limit (slower)", - " // Special notes when using FXAA_GREEN_AS_LUMA,", - " // Likely want to set this to zero.", - " // As colors that are mostly not-green", - " // will appear very dark in the green channel!", - " // Tune by looking at mostly non-green content,", - " // then start at zero and increase until aliasing is a problem.", - " FxaaFloat fxaaQualityEdgeThresholdMin,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", - " // It is here now to allow easier tuning.", - " // This does not effect PS3, as this needs to be compiled in.", - " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", - " // Due to the PS3 being ALU bound,", - " // there are only three safe values here: 2 and 4 and 8.", - " // These options use the shaders ability to a free *|/ by 2|4|8.", - " // For all other platforms can be a non-power of two.", - " // 8.0 is sharper (default!!!)", - " // 4.0 is softer", - " // 2.0 is really soft (good only for vector graphics inputs)", - " FxaaFloat fxaaConsoleEdgeSharpness,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", - " // It is here now to allow easier tuning.", - " // This does not effect PS3, as this needs to be compiled in.", - " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", - " // Due to the PS3 being ALU bound,", - " // there are only two safe values here: 1/4 and 1/8.", - " // These options use the shaders ability to a free *|/ by 2|4|8.", - " // The console setting has a different mapping than the quality setting.", - " // Other platforms can use other values.", - " // 0.125 leaves less aliasing, but is softer (default!!!)", - " // 0.25 leaves more aliasing, and is sharper", - " FxaaFloat fxaaConsoleEdgeThreshold,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", - " // It is here now to allow easier tuning.", - " // Trims the algorithm from processing darks.", - " // The console setting has a different mapping than the quality setting.", - " // This only applies when FXAA_EARLY_EXIT is 1.", - " // This does not apply to PS3,", - " // PS3 was simplified to avoid more shader instructions.", - " // 0.06 - faster but more aliasing in darks", - " // 0.05 - default", - " // 0.04 - slower and less aliasing in darks", - " // Special notes when using FXAA_GREEN_AS_LUMA,", - " // Likely want to set this to zero.", - " // As colors that are mostly not-green", - " // will appear very dark in the green channel!", - " // Tune by looking at mostly non-green content,", - " // then start at zero and increase until aliasing is a problem.", - " FxaaFloat fxaaConsoleEdgeThresholdMin,", - " //", - " // Extra constants for 360 FXAA Console only.", - " // Use zeros or anything else for other platforms.", - " // These must be in physical constant registers and NOT immediates.", - " // Immediates will result in compiler un-optimizing.", - " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", - " FxaaFloat4 fxaaConsole360ConstDir", - ") {", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posM;", - " posM.x = pos.x;", - " posM.y = pos.y;", - " #if (FXAA_GATHER4_ALPHA == 1)", - " #if (FXAA_DISCARD == 0)", - " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " #define lumaM rgbyM.w", - " #else", - " #define lumaM rgbyM.y", - " #endif", - " #endif", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", - " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", - " #else", - " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", - " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", - " #endif", - " #if (FXAA_DISCARD == 1)", - " #define lumaM luma4A.w", - " #endif", - " #define lumaE luma4A.z", - " #define lumaS luma4A.x", - " #define lumaSE luma4A.y", - " #define lumaNW luma4B.w", - " #define lumaN luma4B.z", - " #define lumaW luma4B.x", - " #else", - " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " #define lumaM rgbyM.w", - " #else", - " #define lumaM rgbyM.y", - " #endif", - " #if (FXAA_GLSL_100 == 1)", - " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", - " #else", - " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", - " #endif", - " #endif", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat maxSM = max(lumaS, lumaM);", - " FxaaFloat minSM = min(lumaS, lumaM);", - " FxaaFloat maxESM = max(lumaE, maxSM);", - " FxaaFloat minESM = min(lumaE, minSM);", - " FxaaFloat maxWN = max(lumaN, lumaW);", - " FxaaFloat minWN = min(lumaN, lumaW);", - " FxaaFloat rangeMax = max(maxWN, maxESM);", - " FxaaFloat rangeMin = min(minWN, minESM);", - " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", - " FxaaFloat range = rangeMax - rangeMin;", - " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", - " FxaaBool earlyExit = range < rangeMaxClamped;", - "/*--------------------------------------------------------------------------*/", - " if(earlyExit)", - " #if (FXAA_DISCARD == 1)", - " FxaaDiscard;", - " #else", - " return rgbyM;", - " #endif", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_GATHER4_ALPHA == 0)", - " #if (FXAA_GLSL_100 == 1)", - " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", - " #else", - " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", - " #endif", - " #else", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", - " #endif", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNS = lumaN + lumaS;", - " FxaaFloat lumaWE = lumaW + lumaE;", - " FxaaFloat subpixRcpRange = 1.0/range;", - " FxaaFloat subpixNSWE = lumaNS + lumaWE;", - " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", - " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNESE = lumaNE + lumaSE;", - " FxaaFloat lumaNWNE = lumaNW + lumaNE;", - " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", - " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNWSW = lumaNW + lumaSW;", - " FxaaFloat lumaSWSE = lumaSW + lumaSE;", - " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", - " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", - " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", - " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", - " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", - " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", - " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", - " FxaaBool horzSpan = edgeHorz >= edgeVert;", - " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", - "/*--------------------------------------------------------------------------*/", - " if(!horzSpan) lumaN = lumaW;", - " if(!horzSpan) lumaS = lumaE;", - " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", - " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat gradientN = lumaN - lumaM;", - " FxaaFloat gradientS = lumaS - lumaM;", - " FxaaFloat lumaNN = lumaN + lumaM;", - " FxaaFloat lumaSS = lumaS + lumaM;", - " FxaaBool pairN = abs(gradientN) >= abs(gradientS);", - " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", - " if(pairN) lengthSign = -lengthSign;", - " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posB;", - " posB.x = posM.x;", - " posB.y = posM.y;", - " FxaaFloat2 offNP;", - " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", - " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", - " if(!horzSpan) posB.x += lengthSign * 0.5;", - " if( horzSpan) posB.y += lengthSign * 0.5;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posN;", - " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", - " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", - " FxaaFloat2 posP;", - " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", - " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", - " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", - " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", - " FxaaFloat subpixE = subpixC * subpixC;", - " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", - "/*--------------------------------------------------------------------------*/", - " if(!pairN) lumaNN = lumaSS;", - " FxaaFloat gradientScaled = gradient * 1.0/4.0;", - " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", - " FxaaFloat subpixF = subpixD * subpixE;", - " FxaaBool lumaMLTZero = lumaMM < 0.0;", - "/*--------------------------------------------------------------------------*/", - " lumaEndN -= lumaNN * 0.5;", - " lumaEndP -= lumaNN * 0.5;", - " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", - " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", - " FxaaBool doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", - "/*--------------------------------------------------------------------------*/", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 3)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 4)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 5)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 6)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 7)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 8)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 9)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 10)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 11)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 12)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat dstN = posM.x - posN.x;", - " FxaaFloat dstP = posP.x - posM.x;", - " if(!horzSpan) dstN = posM.y - posN.y;", - " if(!horzSpan) dstP = posP.y - posM.y;", - "/*--------------------------------------------------------------------------*/", - " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", - " FxaaFloat spanLength = (dstP + dstN);", - " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", - " FxaaFloat spanLengthRcp = 1.0/spanLength;", - "/*--------------------------------------------------------------------------*/", - " FxaaBool directionN = dstN < dstP;", - " FxaaFloat dst = min(dstN, dstP);", - " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", - " FxaaFloat subpixG = subpixF * subpixF;", - " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", - " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", - " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", - " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", - " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", - " #if (FXAA_DISCARD == 1)", - " return FxaaTexTop(tex, posM);", - " #else", - " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", - " #endif", - "}", - "/*==========================================================================*/", - "#endif", - "", - "void main() {", - " gl_FragColor = FxaaPixelShader(", - " vUv,", - " vec4(0.0),", - " tDiffuse,", - " tDiffuse,", - " tDiffuse,", - " resolution,", - " vec4(0.0),", - " vec4(0.0),", - " vec4(0.0),", - " 0.75,", - " 0.166,", - " 0.0833,", - " 0.0,", - " 0.0,", - " 0.0,", - " vec4(0.0)", - " );", - "", - " // TODO avoid querying texture twice for same texel", - " gl_FragColor.a = texture2D(tDiffuse, vUv).a;", - "}" - ].join("\n") + "precision highp float;", + "", + "uniform sampler2D tDiffuse;", + "", + "uniform vec2 resolution;", + "", + "varying vec2 vUv;", + "", + "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", + "", + "//----------------------------------------------------------------------------------", + "// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag", + "// SDK Version: v3.00", + "// Email: gameworks@nvidia.com", + "// Site: http://developer.nvidia.com/", + "//", + "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", + "//", + "// Redistribution and use in source and binary forms, with or without", + "// modification, are permitted provided that the following conditions", + "// are met:", + "// * Redistributions of source code must retain the above copyright", + "// notice, this list of conditions and the following disclaimer.", + "// * Redistributions in binary form must reproduce the above copyright", + "// notice, this list of conditions and the following disclaimer in the", + "// documentation and/or other materials provided with the distribution.", + "// * Neither the name of NVIDIA CORPORATION nor the names of its", + "// contributors may be used to endorse or promote products derived", + "// from this software without specific prior written permission.", + "//", + "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", + "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", + "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", + "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR", + "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", + "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", + "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", + "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", + "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", + "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", + "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", + "//", + "//----------------------------------------------------------------------------------", + "", + "#define FXAA_PC 1", + "#define FXAA_GLSL_100 1", + "#define FXAA_QUALITY_PRESET 12", + "", + "#define FXAA_GREEN_AS_LUMA 1", + "", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_PC_CONSOLE", + " //", + " // The console algorithm for PC is included", + " // for developers targeting really low spec machines.", + " // Likely better to just run FXAA_PC, and use a really low preset.", + " //", + " #define FXAA_PC_CONSOLE 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GLSL_120", + " #define FXAA_GLSL_120 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GLSL_130", + " #define FXAA_GLSL_130 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_3", + " #define FXAA_HLSL_3 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_4", + " #define FXAA_HLSL_4 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_5", + " #define FXAA_HLSL_5 0", + "#endif", + "/*==========================================================================*/", + "#ifndef FXAA_GREEN_AS_LUMA", + " //", + " // For those using non-linear color,", + " // and either not able to get luma in alpha, or not wanting to,", + " // this enables FXAA to run using green as a proxy for luma.", + " // So with this enabled, no need to pack luma in alpha.", + " //", + " // This will turn off AA on anything which lacks some amount of green.", + " // Pure red and blue or combination of only R and B, will get no AA.", + " //", + " // Might want to lower the settings for both,", + " // fxaaConsoleEdgeThresholdMin", + " // fxaaQualityEdgeThresholdMin", + " // In order to insure AA does not get turned off on colors", + " // which contain a minor amount of green.", + " //", + " // 1 = On.", + " // 0 = Off.", + " //", + " #define FXAA_GREEN_AS_LUMA 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_EARLY_EXIT", + " //", + " // Controls algorithm's early exit path.", + " // On PS3 turning this ON adds 2 cycles to the shader.", + " // On 360 turning this OFF adds 10ths of a millisecond to the shader.", + " // Turning this off on console will result in a more blurry image.", + " // So this defaults to on.", + " //", + " // 1 = On.", + " // 0 = Off.", + " //", + " #define FXAA_EARLY_EXIT 1", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_DISCARD", + " //", + " // Only valid for PC OpenGL currently.", + " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", + " //", + " // 1 = Use discard on pixels which don't need AA.", + " // For APIs which enable concurrent TEX+ROP from same surface.", + " // 0 = Return unchanged color on pixels which don't need AA.", + " //", + " #define FXAA_DISCARD 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_FAST_PIXEL_OFFSET", + " //", + " // Used for GLSL 120 only.", + " //", + " // 1 = GL API supports fast pixel offsets", + " // 0 = do not use fast pixel offsets", + " //", + " #ifdef GL_EXT_gpu_shader4", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifdef GL_NV_gpu_shader5", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifdef GL_ARB_gpu_shader5", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifndef FXAA_FAST_PIXEL_OFFSET", + " #define FXAA_FAST_PIXEL_OFFSET 0", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GATHER4_ALPHA", + " //", + " // 1 = API supports gather4 on alpha channel.", + " // 0 = API does not support gather4 on alpha channel.", + " //", + " #if (FXAA_HLSL_5 == 1)", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifdef GL_ARB_gpu_shader5", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifdef GL_NV_gpu_shader5", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifndef FXAA_GATHER4_ALPHA", + " #define FXAA_GATHER4_ALPHA 0", + " #endif", + "#endif", + "", + "", + "/*============================================================================", + " FXAA QUALITY - TUNING KNOBS", + "------------------------------------------------------------------------------", + "NOTE the other tuning knobs are now in the shader function inputs!", + "============================================================================*/", + "#ifndef FXAA_QUALITY_PRESET", + " //", + " // Choose the quality preset.", + " // This needs to be compiled into the shader as it effects code.", + " // Best option to include multiple presets is to", + " // in each shader define the preset, then include this file.", + " //", + " // OPTIONS", + " // -----------------------------------------------------------------------", + " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", + " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", + " // 39 - no dither, very expensive", + " //", + " // NOTES", + " // -----------------------------------------------------------------------", + " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", + " // 13 = about same speed as FXAA 3.9 and better than 12", + " // 23 = closest to FXAA 3.9 visually and performance wise", + " // _ = the lowest digit is directly related to performance", + " // _ = the highest digit is directly related to style", + " //", + " #define FXAA_QUALITY_PRESET 12", + "#endif", + "", + "", + "/*============================================================================", + "", + " FXAA QUALITY - PRESETS", + "", + "============================================================================*/", + "", + "/*============================================================================", + " FXAA QUALITY - MEDIUM DITHER PRESETS", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 10)", + " #define FXAA_QUALITY_PS 3", + " #define FXAA_QUALITY_P0 1.5", + " #define FXAA_QUALITY_P1 3.0", + " #define FXAA_QUALITY_P2 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 11)", + " #define FXAA_QUALITY_PS 4", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 3.0", + " #define FXAA_QUALITY_P3 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 12)", + " #define FXAA_QUALITY_PS 5", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 4.0", + " #define FXAA_QUALITY_P4 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 13)", + " #define FXAA_QUALITY_PS 6", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 4.0", + " #define FXAA_QUALITY_P5 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 14)", + " #define FXAA_QUALITY_PS 7", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 4.0", + " #define FXAA_QUALITY_P6 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 15)", + " #define FXAA_QUALITY_PS 8", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 4.0", + " #define FXAA_QUALITY_P7 12.0", + "#endif", + "", + "/*============================================================================", + " FXAA QUALITY - LOW DITHER PRESETS", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 20)", + " #define FXAA_QUALITY_PS 3", + " #define FXAA_QUALITY_P0 1.5", + " #define FXAA_QUALITY_P1 2.0", + " #define FXAA_QUALITY_P2 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 21)", + " #define FXAA_QUALITY_PS 4", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 22)", + " #define FXAA_QUALITY_PS 5", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 23)", + " #define FXAA_QUALITY_PS 6", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 24)", + " #define FXAA_QUALITY_PS 7", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 3.0", + " #define FXAA_QUALITY_P6 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 25)", + " #define FXAA_QUALITY_PS 8", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 4.0", + " #define FXAA_QUALITY_P7 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 26)", + " #define FXAA_QUALITY_PS 9", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 4.0", + " #define FXAA_QUALITY_P8 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 27)", + " #define FXAA_QUALITY_PS 10", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 4.0", + " #define FXAA_QUALITY_P9 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 28)", + " #define FXAA_QUALITY_PS 11", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 4.0", + " #define FXAA_QUALITY_P10 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 29)", + " #define FXAA_QUALITY_PS 12", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 2.0", + " #define FXAA_QUALITY_P10 4.0", + " #define FXAA_QUALITY_P11 8.0", + "#endif", + "", + "/*============================================================================", + " FXAA QUALITY - EXTREME QUALITY", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 39)", + " #define FXAA_QUALITY_PS 12", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.0", + " #define FXAA_QUALITY_P2 1.0", + " #define FXAA_QUALITY_P3 1.0", + " #define FXAA_QUALITY_P4 1.0", + " #define FXAA_QUALITY_P5 1.5", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 2.0", + " #define FXAA_QUALITY_P10 4.0", + " #define FXAA_QUALITY_P11 8.0", + "#endif", + "", + "", + "", + "/*============================================================================", + "", + " API PORTING", + "", + "============================================================================*/", + "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", + " #define FxaaBool bool", + " #define FxaaDiscard discard", + " #define FxaaFloat float", + " #define FxaaFloat2 vec2", + " #define FxaaFloat3 vec3", + " #define FxaaFloat4 vec4", + " #define FxaaHalf float", + " #define FxaaHalf2 vec2", + " #define FxaaHalf3 vec3", + " #define FxaaHalf4 vec4", + " #define FxaaInt2 ivec2", + " #define FxaaSat(x) clamp(x, 0.0, 1.0)", + " #define FxaaTex sampler2D", + "#else", + " #define FxaaBool bool", + " #define FxaaDiscard clip(-1)", + " #define FxaaFloat float", + " #define FxaaFloat2 float2", + " #define FxaaFloat3 float3", + " #define FxaaFloat4 float4", + " #define FxaaHalf half", + " #define FxaaHalf2 half2", + " #define FxaaHalf3 half3", + " #define FxaaHalf4 half4", + " #define FxaaSat(x) saturate(x)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_100 == 1)", + " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_120 == 1)", + " // Requires,", + " // #version 120", + " // And at least,", + " // #extension GL_EXT_gpu_shader4 : enable", + " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", + " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", + " #if (FXAA_FAST_PIXEL_OFFSET == 1)", + " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", + " #else", + " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", + " #endif", + " #if (FXAA_GATHER4_ALPHA == 1)", + " // use #extension GL_ARB_gpu_shader5 : enable", + " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", + " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", + " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", + " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_130 == 1)", + " // Requires \"#version 130\" or better", + " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", + " #if (FXAA_GATHER4_ALPHA == 1)", + " // use #extension GL_ARB_gpu_shader5 : enable", + " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", + " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", + " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", + " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_3 == 1)", + " #define FxaaInt2 float2", + " #define FxaaTex sampler2D", + " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", + " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_4 == 1)", + " #define FxaaInt2 int2", + " struct FxaaTex { SamplerState smpl; Texture2D tex; };", + " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_5 == 1)", + " #define FxaaInt2 int2", + " struct FxaaTex { SamplerState smpl; Texture2D tex; };", + " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", + " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", + " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", + " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", + " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", + "#endif", + "", + "", + "/*============================================================================", + " GREEN AS LUMA OPTION SUPPORT FUNCTION", + "============================================================================*/", + "#if (FXAA_GREEN_AS_LUMA == 0)", + " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", + "#else", + " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", + "#endif", + "", + "", + "", + "", + "/*============================================================================", + "", + " FXAA3 QUALITY - PC", + "", + "============================================================================*/", + "#if (FXAA_PC == 1)", + "/*--------------------------------------------------------------------------*/", + "FxaaFloat4 FxaaPixelShader(", + " //", + " // Use noperspective interpolation here (turn off perspective interpolation).", + " // {xy} = center of pixel", + " FxaaFloat2 pos,", + " //", + " // Used only for FXAA Console, and not used on the 360 version.", + " // Use noperspective interpolation here (turn off perspective interpolation).", + " // {xy_} = upper left of pixel", + " // {_zw} = lower right of pixel", + " FxaaFloat4 fxaaConsolePosPos,", + " //", + " // Input color texture.", + " // {rgb_} = color in linear or perceptual color space", + " // if (FXAA_GREEN_AS_LUMA == 0)", + " // {__a} = luma in perceptual color space (not linear)", + " FxaaTex tex,", + " //", + " // Only used on the optimized 360 version of FXAA Console.", + " // For everything but 360, just use the same input here as for \"tex\".", + " // For 360, same texture, just alias with a 2nd sampler.", + " // This sampler needs to have an exponent bias of -1.", + " FxaaTex fxaaConsole360TexExpBiasNegOne,", + " //", + " // Only used on the optimized 360 version of FXAA Console.", + " // For everything but 360, just use the same input here as for \"tex\".", + " // For 360, same texture, just alias with a 3nd sampler.", + " // This sampler needs to have an exponent bias of -2.", + " FxaaTex fxaaConsole360TexExpBiasNegTwo,", + " //", + " // Only used on FXAA Quality.", + " // This must be from a constant/uniform.", + " // {x_} = 1.0/screenWidthInPixels", + " // {_y} = 1.0/screenHeightInPixels", + " FxaaFloat2 fxaaQualityRcpFrame,", + " //", + " // Only used on FXAA Console.", + " // This must be from a constant/uniform.", + " // This effects sub-pixel AA quality and inversely sharpness.", + " // Where N ranges between,", + " // N = 0.50 (default)", + " // N = 0.33 (sharper)", + " // {x__} = -N/screenWidthInPixels", + " // {_y_} = -N/screenHeightInPixels", + " // {_z_} = N/screenWidthInPixels", + " // {__w} = N/screenHeightInPixels", + " FxaaFloat4 fxaaConsoleRcpFrameOpt,", + " //", + " // Only used on FXAA Console.", + " // Not used on 360, but used on PS3 and PC.", + " // This must be from a constant/uniform.", + " // {x__} = -2.0/screenWidthInPixels", + " // {_y_} = -2.0/screenHeightInPixels", + " // {_z_} = 2.0/screenWidthInPixels", + " // {__w} = 2.0/screenHeightInPixels", + " FxaaFloat4 fxaaConsoleRcpFrameOpt2,", + " //", + " // Only used on FXAA Console.", + " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", + " // This must be from a constant/uniform.", + " // {x__} = 8.0/screenWidthInPixels", + " // {_y_} = 8.0/screenHeightInPixels", + " // {_z_} = -4.0/screenWidthInPixels", + " // {__w} = -4.0/screenHeightInPixels", + " FxaaFloat4 fxaaConsole360RcpFrameOpt2,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_SUBPIX define.", + " // It is here now to allow easier tuning.", + " // Choose the amount of sub-pixel aliasing removal.", + " // This can effect sharpness.", + " // 1.00 - upper limit (softer)", + " // 0.75 - default amount of filtering", + " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)", + " // 0.25 - almost off", + " // 0.00 - completely off", + " FxaaFloat fxaaQualitySubpix,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", + " // It is here now to allow easier tuning.", + " // The minimum amount of local contrast required to apply algorithm.", + " // 0.333 - too little (faster)", + " // 0.250 - low quality", + " // 0.166 - default", + " // 0.125 - high quality", + " // 0.063 - overkill (slower)", + " FxaaFloat fxaaQualityEdgeThreshold,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", + " // It is here now to allow easier tuning.", + " // Trims the algorithm from processing darks.", + " // 0.0833 - upper limit (default, the start of visible unfiltered edges)", + " // 0.0625 - high quality (faster)", + " // 0.0312 - visible limit (slower)", + " // Special notes when using FXAA_GREEN_AS_LUMA,", + " // Likely want to set this to zero.", + " // As colors that are mostly not-green", + " // will appear very dark in the green channel!", + " // Tune by looking at mostly non-green content,", + " // then start at zero and increase until aliasing is a problem.", + " FxaaFloat fxaaQualityEdgeThresholdMin,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", + " // It is here now to allow easier tuning.", + " // This does not effect PS3, as this needs to be compiled in.", + " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", + " // Due to the PS3 being ALU bound,", + " // there are only three safe values here: 2 and 4 and 8.", + " // These options use the shaders ability to a free *|/ by 2|4|8.", + " // For all other platforms can be a non-power of two.", + " // 8.0 is sharper (default!!!)", + " // 4.0 is softer", + " // 2.0 is really soft (good only for vector graphics inputs)", + " FxaaFloat fxaaConsoleEdgeSharpness,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", + " // It is here now to allow easier tuning.", + " // This does not effect PS3, as this needs to be compiled in.", + " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", + " // Due to the PS3 being ALU bound,", + " // there are only two safe values here: 1/4 and 1/8.", + " // These options use the shaders ability to a free *|/ by 2|4|8.", + " // The console setting has a different mapping than the quality setting.", + " // Other platforms can use other values.", + " // 0.125 leaves less aliasing, but is softer (default!!!)", + " // 0.25 leaves more aliasing, and is sharper", + " FxaaFloat fxaaConsoleEdgeThreshold,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", + " // It is here now to allow easier tuning.", + " // Trims the algorithm from processing darks.", + " // The console setting has a different mapping than the quality setting.", + " // This only applies when FXAA_EARLY_EXIT is 1.", + " // This does not apply to PS3,", + " // PS3 was simplified to avoid more shader instructions.", + " // 0.06 - faster but more aliasing in darks", + " // 0.05 - default", + " // 0.04 - slower and less aliasing in darks", + " // Special notes when using FXAA_GREEN_AS_LUMA,", + " // Likely want to set this to zero.", + " // As colors that are mostly not-green", + " // will appear very dark in the green channel!", + " // Tune by looking at mostly non-green content,", + " // then start at zero and increase until aliasing is a problem.", + " FxaaFloat fxaaConsoleEdgeThresholdMin,", + " //", + " // Extra constants for 360 FXAA Console only.", + " // Use zeros or anything else for other platforms.", + " // These must be in physical constant registers and NOT immediates.", + " // Immediates will result in compiler un-optimizing.", + " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", + " FxaaFloat4 fxaaConsole360ConstDir", + ") {", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posM;", + " posM.x = pos.x;", + " posM.y = pos.y;", + " #if (FXAA_GATHER4_ALPHA == 1)", + " #if (FXAA_DISCARD == 0)", + " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " #define lumaM rgbyM.w", + " #else", + " #define lumaM rgbyM.y", + " #endif", + " #endif", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", + " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", + " #else", + " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", + " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", + " #endif", + " #if (FXAA_DISCARD == 1)", + " #define lumaM luma4A.w", + " #endif", + " #define lumaE luma4A.z", + " #define lumaS luma4A.x", + " #define lumaSE luma4A.y", + " #define lumaNW luma4B.w", + " #define lumaN luma4B.z", + " #define lumaW luma4B.x", + " #else", + " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " #define lumaM rgbyM.w", + " #else", + " #define lumaM rgbyM.y", + " #endif", + " #if (FXAA_GLSL_100 == 1)", + " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", + " #else", + " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", + " #endif", + " #endif", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat maxSM = max(lumaS, lumaM);", + " FxaaFloat minSM = min(lumaS, lumaM);", + " FxaaFloat maxESM = max(lumaE, maxSM);", + " FxaaFloat minESM = min(lumaE, minSM);", + " FxaaFloat maxWN = max(lumaN, lumaW);", + " FxaaFloat minWN = min(lumaN, lumaW);", + " FxaaFloat rangeMax = max(maxWN, maxESM);", + " FxaaFloat rangeMin = min(minWN, minESM);", + " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", + " FxaaFloat range = rangeMax - rangeMin;", + " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", + " FxaaBool earlyExit = range < rangeMaxClamped;", + "/*--------------------------------------------------------------------------*/", + " if(earlyExit)", + " #if (FXAA_DISCARD == 1)", + " FxaaDiscard;", + " #else", + " return rgbyM;", + " #endif", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_GATHER4_ALPHA == 0)", + " #if (FXAA_GLSL_100 == 1)", + " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", + " #else", + " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", + " #endif", + " #else", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", + " #endif", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNS = lumaN + lumaS;", + " FxaaFloat lumaWE = lumaW + lumaE;", + " FxaaFloat subpixRcpRange = 1.0/range;", + " FxaaFloat subpixNSWE = lumaNS + lumaWE;", + " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", + " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNESE = lumaNE + lumaSE;", + " FxaaFloat lumaNWNE = lumaNW + lumaNE;", + " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", + " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNWSW = lumaNW + lumaSW;", + " FxaaFloat lumaSWSE = lumaSW + lumaSE;", + " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", + " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", + " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", + " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", + " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", + " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", + " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", + " FxaaBool horzSpan = edgeHorz >= edgeVert;", + " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", + "/*--------------------------------------------------------------------------*/", + " if(!horzSpan) lumaN = lumaW;", + " if(!horzSpan) lumaS = lumaE;", + " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", + " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat gradientN = lumaN - lumaM;", + " FxaaFloat gradientS = lumaS - lumaM;", + " FxaaFloat lumaNN = lumaN + lumaM;", + " FxaaFloat lumaSS = lumaS + lumaM;", + " FxaaBool pairN = abs(gradientN) >= abs(gradientS);", + " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", + " if(pairN) lengthSign = -lengthSign;", + " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posB;", + " posB.x = posM.x;", + " posB.y = posM.y;", + " FxaaFloat2 offNP;", + " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", + " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", + " if(!horzSpan) posB.x += lengthSign * 0.5;", + " if( horzSpan) posB.y += lengthSign * 0.5;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posN;", + " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", + " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", + " FxaaFloat2 posP;", + " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", + " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", + " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", + " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", + " FxaaFloat subpixE = subpixC * subpixC;", + " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", + "/*--------------------------------------------------------------------------*/", + " if(!pairN) lumaNN = lumaSS;", + " FxaaFloat gradientScaled = gradient * 1.0/4.0;", + " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", + " FxaaFloat subpixF = subpixD * subpixE;", + " FxaaBool lumaMLTZero = lumaMM < 0.0;", + "/*--------------------------------------------------------------------------*/", + " lumaEndN -= lumaNN * 0.5;", + " lumaEndP -= lumaNN * 0.5;", + " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", + " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", + " FxaaBool doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", + "/*--------------------------------------------------------------------------*/", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 3)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 4)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 5)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 6)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 7)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 8)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 9)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 10)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 11)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 12)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat dstN = posM.x - posN.x;", + " FxaaFloat dstP = posP.x - posM.x;", + " if(!horzSpan) dstN = posM.y - posN.y;", + " if(!horzSpan) dstP = posP.y - posM.y;", + "/*--------------------------------------------------------------------------*/", + " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", + " FxaaFloat spanLength = (dstP + dstN);", + " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", + " FxaaFloat spanLengthRcp = 1.0/spanLength;", + "/*--------------------------------------------------------------------------*/", + " FxaaBool directionN = dstN < dstP;", + " FxaaFloat dst = min(dstN, dstP);", + " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", + " FxaaFloat subpixG = subpixF * subpixF;", + " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", + " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", + " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", + " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", + " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", + " #if (FXAA_DISCARD == 1)", + " return FxaaTexTop(tex, posM);", + " #else", + " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", + " #endif", + "}", + "/*==========================================================================*/", + "#endif", + "", + "void main() {", + " gl_FragColor = FxaaPixelShader(", + " vUv,", + " vec4(0.0),", + " tDiffuse,", + " tDiffuse,", + " tDiffuse,", + " resolution,", + " vec4(0.0),", + " vec4(0.0),", + " vec4(0.0),", + " 0.75,", + " 0.166,", + " 0.0833,", + " 0.0,", + " 0.0,", + " 0.0,", + " vec4(0.0)", + " );", + "", + " // TODO avoid querying texture twice for same texel", + " gl_FragColor.a = texture2D(tDiffuse, vUv).a;", + "}" + ].join( "\n" ) }; diff --git a/examples/js/shaders/FilmShader.js b/examples/js/shaders/FilmShader.js index f8ef09bcc5666c1c82716ccb475536f2045d11c6..5bfc7bc0b4d5c649589ec50e9ad95408b052e007 100644 --- a/examples/js/shaders/FilmShader.js +++ b/examples/js/shaders/FilmShader.js @@ -70,25 +70,25 @@ THREE.FilmShader = { "void main() {", - // sample the source + // sample the source " vec4 cTextureScreen = texture2D( tDiffuse, vUv );", - // make some noise + // make some noise " float dx = rand( vUv + time );", - // add noise + // add noise " vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );", - // get us a sine and cosine + // get us a sine and cosine " vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );", - // add scanlines + // add scanlines " cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;", - // interpolate between source and result by intensity + // interpolate between source and result by intensity " cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );", - // convert to grayscale if desired + // convert to grayscale if desired " if( grayscale ) {", " cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );", diff --git a/examples/js/shaders/HalftoneShader.js b/examples/js/shaders/HalftoneShader.js index da23911ae2343e2f94aab78e97988629a59cdc16..8b8a7b7d86817a4000e63124a53f74bacb341b0b 100644 --- a/examples/js/shaders/HalftoneShader.js +++ b/examples/js/shaders/HalftoneShader.js @@ -27,14 +27,14 @@ THREE.HalftoneShader = { vertexShader: [ - "varying vec2 vUV;", + "varying vec2 vUV;", - "void main() {", + "void main() {", - "vUV = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", + " vUV = uv;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", - "}" + "}" ].join( "\n" ), diff --git a/examples/js/shaders/HueSaturationShader.js b/examples/js/shaders/HueSaturationShader.js index 240db81f2b8ec026638b8a6ec601d234669e9307..323eb7530617b805d2d623f6d67f510864f16526 100644 --- a/examples/js/shaders/HueSaturationShader.js +++ b/examples/js/shaders/HueSaturationShader.js @@ -43,7 +43,7 @@ THREE.HueSaturationShader = { " gl_FragColor = texture2D( tDiffuse, vUv );", - // hue + // hue " float angle = hue * 3.14159265;", " float s = sin(angle), c = cos(angle);", " vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;", @@ -54,7 +54,7 @@ THREE.HueSaturationShader = { " dot(gl_FragColor.rgb, weights.yzx)", " );", - // saturation + // saturation " float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;", " if (saturation > 0.0) {", " gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));", diff --git a/examples/js/shaders/LuminosityHighPassShader.js b/examples/js/shaders/LuminosityHighPassShader.js index e620c88e4adb0192ca29f0fd729da117c1c0ff5c..9ffa1386a4ddc2ccd6cb727315f9a04fe6e1b7dc 100644 --- a/examples/js/shaders/LuminosityHighPassShader.js +++ b/examples/js/shaders/LuminosityHighPassShader.js @@ -31,7 +31,7 @@ THREE.LuminosityHighPassShader = { "}" - ].join("\n"), + ].join( "\n" ), fragmentShader: [ @@ -59,6 +59,6 @@ THREE.LuminosityHighPassShader = { "}" - ].join("\n") + ].join( "\n" ) }; diff --git a/examples/js/shaders/OceanShaders.js b/examples/js/shaders/OceanShaders.js index 70d138160eed97e3304d4a6fd6860b63716a0540..8ca7fef521e56474f1a95da4fa61d3425be16282 100644 --- a/examples/js/shaders/OceanShaders.js +++ b/examples/js/shaders/OceanShaders.js @@ -22,18 +22,18 @@ // [7] ocean_main -> Vertex and Fragment shader used to create the final render */ -THREE.OceanShaders = {} -THREE.OceanShaders[ 'ocean_sim_vertex' ] = { +THREE.OceanShaders = {}; +THREE.OceanShaders[ "ocean_sim_vertex" ] = { vertexShader: [ - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'void main (void) {', - 'vUV = position.xy * 0.5 + 0.5;', - 'gl_Position = vec4(position, 1.0 );', - '}' - ].join( '\n' ) + "void main (void) {", + " vUV = position.xy * 0.5 + 0.5;", + " gl_Position = vec4(position, 1.0 );", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_subtransform' ] = { +THREE.OceanShaders[ "ocean_subtransform" ] = { uniforms: { "u_input": { value: null }, "u_transformSize": { value: 512.0 }, @@ -42,131 +42,131 @@ THREE.OceanShaders[ 'ocean_subtransform' ] = { fragmentShader: [ //GPU FFT using a Stockham formulation - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'uniform sampler2D u_input;', - 'uniform float u_transformSize;', - 'uniform float u_subtransformSize;', + "uniform sampler2D u_input;", + "uniform float u_transformSize;", + "uniform float u_subtransformSize;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'vec2 multiplyComplex (vec2 a, vec2 b) {', - 'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);', - '}', + "vec2 multiplyComplex (vec2 a, vec2 b) {", + " return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);", + "}", - 'void main (void) {', - '#ifdef HORIZONTAL', - 'float index = vUV.x * u_transformSize - 0.5;', - '#else', - 'float index = vUV.y * u_transformSize - 0.5;', - '#endif', + "void main (void) {", + " #ifdef HORIZONTAL", + " float index = vUV.x * u_transformSize - 0.5;", + " #else", + " float index = vUV.y * u_transformSize - 0.5;", + " #endif", - 'float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);', + " float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);", - //transform two complex sequences simultaneously - '#ifdef HORIZONTAL', - 'vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;', - 'vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;', - '#else', - 'vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;', - 'vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;', - '#endif', + //transform two complex sequences simultaneously + " #ifdef HORIZONTAL", + " vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;", + " vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;", + " #else", + " vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;", + " vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;", + " #endif", - 'float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);', - 'vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));', + " float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);", + " vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));", - 'vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);', - 'vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);', + " vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);", + " vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);", - 'gl_FragColor = vec4(outputA, outputB);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(outputA, outputB);", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_initial_spectrum' ] = { +THREE.OceanShaders[ "ocean_initial_spectrum" ] = { uniforms: { "u_wind": { value: new THREE.Vector2( 10.0, 10.0 ) }, "u_resolution": { value: 512.0 }, "u_size": { value: 250.0 } }, vertexShader: [ - 'void main (void) {', - 'gl_Position = vec4(position, 1.0);', - '}' - ].join( '\n' ), + "void main (void) {", + " gl_Position = vec4(position, 1.0);", + "}" + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', - 'const float CM = 0.23;', + "const float G = 9.81;", + "const float KM = 370.0;", + "const float CM = 0.23;", - 'uniform vec2 u_wind;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform vec2 u_wind;", + "uniform float u_resolution;", + "uniform float u_size;", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + pow2(k / KM)));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + pow2(k / KM)));", + "}", - '#if __VERSION__ == 100', - 'float tanh (float x) {', - 'return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));', - '}', - '#endif', + "#if __VERSION__ == 100", + "float tanh (float x) {", + " return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));", + "}", + "#endif", - 'void main (void) {', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', + "void main (void) {", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", - 'vec2 K = (2.0 * PI * vec2(n, m)) / u_size;', - 'float k = length(K);', + " vec2 K = (2.0 * PI * vec2(n, m)) / u_size;", + " float k = length(K);", - 'float l_wind = length(u_wind);', + " float l_wind = length(u_wind);", - 'float Omega = 0.84;', - 'float kp = G * pow2(Omega / l_wind);', + " float Omega = 0.84;", + " float kp = G * pow2(Omega / l_wind);", - 'float c = omega(k) / k;', - 'float cp = omega(kp) / kp;', + " float c = omega(k) / k;", + " float cp = omega(kp) / kp;", - 'float Lpm = exp(-1.25 * pow2(kp / k));', - 'float gamma = 1.7;', - 'float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));', - 'float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));', - 'float Jp = pow(gamma, Gamma);', - 'float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));', - 'float alphap = 0.006 * sqrt(Omega);', - 'float Bl = 0.5 * alphap * cp / c * Fp;', + " float Lpm = exp(-1.25 * pow2(kp / k));", + " float gamma = 1.7;", + " float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));", + " float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));", + " float Jp = pow(gamma, Gamma);", + " float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));", + " float alphap = 0.006 * sqrt(Omega);", + " float Bl = 0.5 * alphap * cp / c * Fp;", - 'float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);', - 'float uStar = 0.41 * l_wind / log(10.0 / z0);', - 'float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));', - 'float Fm = exp(-0.25 * pow2(k / KM - 1.0));', - 'float Bh = 0.5 * alpham * CM / c * Fm * Lpm;', + " float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);", + " float uStar = 0.41 * l_wind / log(10.0 / z0);", + " float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));", + " float Fm = exp(-0.25 * pow2(k / KM - 1.0));", + " float Bh = 0.5 * alpham * CM / c * Fm * Lpm;", - 'float a0 = log(2.0) / 4.0;', - 'float am = 0.13 * uStar / CM;', - 'float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));', + " float a0 = log(2.0) / 4.0;", + " float am = 0.13 * uStar / CM;", + " float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));", - 'float cosPhi = dot(normalize(u_wind), normalize(K));', + " float cosPhi = dot(normalize(u_wind), normalize(K));", - 'float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));', + " float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));", - 'float dk = 2.0 * PI / u_size;', - 'float h = sqrt(S / 2.0) * dk;', + " float dk = 2.0 * PI / u_size;", + " float h = sqrt(S / 2.0) * dk;", - 'if (K.x == 0.0 && K.y == 0.0) {', - 'h = 0.0;', //no DC term - '}', - 'gl_FragColor = vec4(h, 0.0, 0.0, 0.0);', - '}' - ].join( '\n' ) + " if (K.x == 0.0 && K.y == 0.0) {", + " h = 0.0;", //no DC term + " }", + " gl_FragColor = vec4(h, 0.0, 0.0, 0.0);", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_phase' ] = { +THREE.OceanShaders[ "ocean_phase" ] = { uniforms: { "u_phases": { value: null }, "u_deltaTime": { value: null }, @@ -174,39 +174,39 @@ THREE.OceanShaders[ 'ocean_phase' ] = { "u_size": { value: null } }, fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', + "const float G = 9.81;", + "const float KM = 370.0;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform sampler2D u_phases;', - 'uniform float u_deltaTime;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform sampler2D u_phases;", + "uniform float u_deltaTime;", + "uniform float u_resolution;", + "uniform float u_size;", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + k * k / KM * KM));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + k * k / KM * KM));", + "}", - 'void main (void) {', - 'float deltaTime = 1.0 / 60.0;', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', - 'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;', + "void main (void) {", + " float deltaTime = 1.0 / 60.0;", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", + " vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;", - 'float phase = texture2D(u_phases, vUV).r;', - 'float deltaPhase = omega(length(waveVector)) * u_deltaTime;', - 'phase = mod(phase + deltaPhase, 2.0 * PI);', + " float phase = texture2D(u_phases, vUV).r;", + " float deltaPhase = omega(length(waveVector)) * u_deltaTime;", + " phase = mod(phase + deltaPhase, 2.0 * PI);", - 'gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_spectrum' ] = { +THREE.OceanShaders[ "ocean_spectrum" ] = { uniforms: { "u_size": { value: null }, "u_resolution": { value: null }, @@ -215,96 +215,96 @@ THREE.OceanShaders[ 'ocean_spectrum' ] = { "u_initialSpectrum": { value: null } }, fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', + "const float G = 9.81;", + "const float KM = 370.0;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform float u_size;', - 'uniform float u_resolution;', - 'uniform float u_choppiness;', - 'uniform sampler2D u_phases;', - 'uniform sampler2D u_initialSpectrum;', + "uniform float u_size;", + "uniform float u_resolution;", + "uniform float u_choppiness;", + "uniform sampler2D u_phases;", + "uniform sampler2D u_initialSpectrum;", - 'vec2 multiplyComplex (vec2 a, vec2 b) {', - 'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);', - '}', + "vec2 multiplyComplex (vec2 a, vec2 b) {", + " return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);", + "}", - 'vec2 multiplyByI (vec2 z) {', - 'return vec2(-z[1], z[0]);', - '}', + "vec2 multiplyByI (vec2 z) {", + " return vec2(-z[1], z[0]);", + "}", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + k * k / KM * KM));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + k * k / KM * KM));", + "}", - 'void main (void) {', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', - 'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;', + "void main (void) {", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", + " vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;", - 'float phase = texture2D(u_phases, vUV).r;', - 'vec2 phaseVector = vec2(cos(phase), sin(phase));', + " float phase = texture2D(u_phases, vUV).r;", + " vec2 phaseVector = vec2(cos(phase), sin(phase));", - 'vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;', - 'vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;', - 'h0Star.y *= -1.0;', + " vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;", + " vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;", + " h0Star.y *= -1.0;", - 'vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));', + " vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));", - 'vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;', - 'vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;', + " vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;", + " vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;", - //no DC term - 'if (waveVector.x == 0.0 && waveVector.y == 0.0) {', - 'h = vec2(0.0);', - 'hX = vec2(0.0);', - 'hZ = vec2(0.0);', - '}', + //no DC term + " if (waveVector.x == 0.0 && waveVector.y == 0.0) {", + " h = vec2(0.0);", + " hX = vec2(0.0);", + " hZ = vec2(0.0);", + " }", - 'gl_FragColor = vec4(hX + multiplyByI(h), hZ);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(hX + multiplyByI(h), hZ);", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_normals' ] = { +THREE.OceanShaders[ "ocean_normals" ] = { uniforms: { "u_displacementMap": { value: null }, "u_resolution": { value: null }, "u_size": { value: null } }, fragmentShader: [ - 'precision highp float;', + "precision highp float;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform sampler2D u_displacementMap;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform sampler2D u_displacementMap;", + "uniform float u_resolution;", + "uniform float u_size;", - 'void main (void) {', - 'float texel = 1.0 / u_resolution;', - 'float texelSize = u_size / u_resolution;', + "void main (void) {", + " float texel = 1.0 / u_resolution;", + " float texelSize = u_size / u_resolution;", - 'vec3 center = texture2D(u_displacementMap, vUV).rgb;', - 'vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;', - 'vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;', - 'vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;', - 'vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;', + " vec3 center = texture2D(u_displacementMap, vUV).rgb;", + " vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;", + " vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;", + " vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;", + " vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;", - 'vec3 topRight = cross(right, top);', - 'vec3 topLeft = cross(top, left);', - 'vec3 bottomLeft = cross(left, bottom);', - 'vec3 bottomRight = cross(bottom, right);', + " vec3 topRight = cross(right, top);", + " vec3 topLeft = cross(top, left);", + " vec3 bottomLeft = cross(left, bottom);", + " vec3 bottomRight = cross(bottom, right);", - 'gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);", + "}" + ].join( "\n" ) }; -THREE.OceanShaders[ 'ocean_main' ] = { +THREE.OceanShaders[ "ocean_main" ] = { uniforms: { "u_displacementMap": { value: null }, "u_normalMap": { value: null }, @@ -319,55 +319,55 @@ THREE.OceanShaders[ 'ocean_main' ] = { "u_exposure": { value: null } }, vertexShader: [ - 'precision highp float;', - - 'varying vec3 vPos;', - 'varying vec2 vUV;', - - 'uniform mat4 u_projectionMatrix;', - 'uniform mat4 u_viewMatrix;', - 'uniform float u_size;', - 'uniform float u_geometrySize;', - 'uniform sampler2D u_displacementMap;', - - 'void main (void) {', - 'vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);', - 'vPos = newPos;', - 'vUV = uv;', - 'gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);', - '}' - ].join( '\n' ), + "precision highp float;", + + "varying vec3 vPos;", + "varying vec2 vUV;", + + "uniform mat4 u_projectionMatrix;", + "uniform mat4 u_viewMatrix;", + "uniform float u_size;", + "uniform float u_geometrySize;", + "uniform sampler2D u_displacementMap;", + + "void main (void) {", + " vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);", + " vPos = newPos;", + " vUV = uv;", + " gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);", + "}" + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', + "precision highp float;", - 'varying vec3 vPos;', - 'varying vec2 vUV;', + "varying vec3 vPos;", + "varying vec2 vUV;", - 'uniform sampler2D u_displacementMap;', - 'uniform sampler2D u_normalMap;', - 'uniform vec3 u_cameraPosition;', - 'uniform vec3 u_oceanColor;', - 'uniform vec3 u_skyColor;', - 'uniform vec3 u_sunDirection;', - 'uniform float u_exposure;', + "uniform sampler2D u_displacementMap;", + "uniform sampler2D u_normalMap;", + "uniform vec3 u_cameraPosition;", + "uniform vec3 u_oceanColor;", + "uniform vec3 u_skyColor;", + "uniform vec3 u_sunDirection;", + "uniform float u_exposure;", - 'vec3 hdr (vec3 color, float exposure) {', - 'return 1.0 - exp(-color * exposure);', - '}', + "vec3 hdr (vec3 color, float exposure) {", + " return 1.0 - exp(-color * exposure);", + "}", - 'void main (void) {', - 'vec3 normal = texture2D(u_normalMap, vUV).rgb;', + "void main (void) {", + " vec3 normal = texture2D(u_normalMap, vUV).rgb;", - 'vec3 view = normalize(u_cameraPosition - vPos);', - 'float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);', - 'vec3 sky = fresnel * u_skyColor;', + " vec3 view = normalize(u_cameraPosition - vPos);", + " float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);", + " vec3 sky = fresnel * u_skyColor;", - 'float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);', - 'vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;', + " float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);", + " vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;", - 'vec3 color = sky + water;', + " vec3 color = sky + water;", - 'gl_FragColor = vec4(hdr(color, u_exposure), 1.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(hdr(color, u_exposure), 1.0);", + "}" + ].join( "\n" ) }; diff --git a/examples/js/shaders/ParallaxShader.js b/examples/js/shaders/ParallaxShader.js index 76153f5045d6b26ae23fc417a9f7c9b899aada09..396bbc6727f84832485fc261f77d4fbf681c014e 100644 --- a/examples/js/shaders/ParallaxShader.js +++ b/examples/js/shaders/ParallaxShader.js @@ -6,11 +6,11 @@ THREE.ParallaxShader = { // Ordered from fastest to best quality. modes: { - none: 'NO_PARALLAX', - basic: 'USE_BASIC_PARALLAX', - steep: 'USE_STEEP_PARALLAX', - occlusion: 'USE_OCLUSION_PARALLAX', // a.k.a. POM - relief: 'USE_RELIEF_PARALLAX' + none: "NO_PARALLAX", + basic: "USE_BASIC_PARALLAX", + steep: "USE_STEEP_PARALLAX", + occlusion: "USE_OCLUSION_PARALLAX", // a.k.a. POM + relief: "USE_RELIEF_PARALLAX" }, uniforms: { @@ -36,7 +36,7 @@ THREE.ParallaxShader = { "}" - ].join( "\n" ), + ].join( "\n" ), fragmentShader: [ "uniform sampler2D bumpMap;", @@ -56,10 +56,10 @@ THREE.ParallaxShader = { " float initialHeight = texture2D( bumpMap, vUv ).r;", - // No Offset Limitting: messy, floating output at grazing angles. - //"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;", + // No Offset Limitting: messy, floating output at grazing angles. + //"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;", - // Offset Limiting + // Offset Limiting " vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;", " return vUv - texCoordOffset;", @@ -69,27 +69,27 @@ THREE.ParallaxShader = { " vec2 parallaxMap( in vec3 V ) {", - // Determine number of layers from angle between V and N + // Determine number of layers from angle between V and N " float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );", " float layerHeight = 1.0 / numLayers;", " float currentLayerHeight = 0.0;", - // Shift of texture coordinates for each iteration + // Shift of texture coordinates for each iteration " vec2 dtex = parallaxScale * V.xy / V.z / numLayers;", " vec2 currentTextureCoords = vUv;", " float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", - // while ( heightFromTexture > currentLayerHeight ) - // Infinite loops are not well supported. Do a "large" finite - // loop, but not too large, as it slows down some compilers. + // while ( heightFromTexture > currentLayerHeight ) + // Infinite loops are not well supported. Do a "large" finite + // loop, but not too large, as it slows down some compilers. " for ( int i = 0; i < 30; i += 1 ) {", " if ( heightFromTexture <= currentLayerHeight ) {", " break;", " }", " currentLayerHeight += layerHeight;", - // Shift texture coordinates along vector V + // Shift texture coordinates along vector V " currentTextureCoords -= dtex;", " heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", " }", @@ -103,18 +103,18 @@ THREE.ParallaxShader = { " vec2 deltaTexCoord = dtex / 2.0;", " float deltaHeight = layerHeight / 2.0;", - // Return to the mid point of previous layer + // Return to the mid point of previous layer " currentTextureCoords += deltaTexCoord;", " currentLayerHeight -= deltaHeight;", - // Binary search to increase precision of Steep Parallax Mapping + // Binary search to increase precision of Steep Parallax Mapping " const int numSearches = 5;", " for ( int i = 0; i < numSearches; i += 1 ) {", " deltaTexCoord /= 2.0;", " deltaHeight /= 2.0;", " heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", - // Shift along or against vector V + // Shift along or against vector V " if( heightFromTexture > currentLayerHeight ) {", // Below the surface " currentTextureCoords -= deltaTexCoord;", @@ -134,14 +134,14 @@ THREE.ParallaxShader = { " vec2 prevTCoords = currentTextureCoords + dtex;", - // Heights for linear interpolation + // Heights for linear interpolation " float nextH = heightFromTexture - currentLayerHeight;", " float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;", - // Proportions for linear interpolation + // Proportions for linear interpolation " float weight = nextH / ( nextH - prevH );", - // Interpolation of texture coordinates + // Interpolation of texture coordinates " return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );", " #else", // NO_PARALLAX @@ -179,6 +179,6 @@ THREE.ParallaxShader = { "}" - ].join( "\n" ) + ].join( "\n" ) }; diff --git a/examples/js/shaders/SAOShader.js b/examples/js/shaders/SAOShader.js index 2221558f69b0648f739fad00dff5e958215447e6..d344f7b0c73d8bcadf0aa539973be2833c454107 100644 --- a/examples/js/shaders/SAOShader.js +++ b/examples/js/shaders/SAOShader.js @@ -4,32 +4,32 @@ THREE.SAOShader = { defines: { - 'NUM_SAMPLES': 7, - 'NUM_RINGS': 4, - 'NORMAL_TEXTURE': 0, - 'DIFFUSE_TEXTURE': 0, - 'DEPTH_PACKING': 1, - 'PERSPECTIVE_CAMERA': 1 + "NUM_SAMPLES": 7, + "NUM_RINGS": 4, + "NORMAL_TEXTURE": 0, + "DIFFUSE_TEXTURE": 0, + "DEPTH_PACKING": 1, + "PERSPECTIVE_CAMERA": 1 }, uniforms: { - 'tDepth': { value: null }, - 'tDiffuse': { value: null }, - 'tNormal': { value: null }, - 'size': { value: new THREE.Vector2( 512, 512 ) }, + "tDepth": { value: null }, + "tDiffuse": { value: null }, + "tNormal": { value: null }, + "size": { value: new THREE.Vector2( 512, 512 ) }, - 'cameraNear': { value: 1 }, - 'cameraFar': { value: 100 }, - 'cameraProjectionMatrix': { value: new THREE.Matrix4() }, - 'cameraInverseProjectionMatrix': { value: new THREE.Matrix4() }, + "cameraNear": { value: 1 }, + "cameraFar": { value: 100 }, + "cameraProjectionMatrix": { value: new THREE.Matrix4() }, + "cameraInverseProjectionMatrix": { value: new THREE.Matrix4() }, - 'scale': { value: 1.0 }, - 'intensity': { value: 0.1 }, - 'bias': { value: 0.5 }, + "scale": { value: 1.0 }, + "intensity": { value: 0.1 }, + "bias": { value: 0.5 }, - 'minResolution': { value: 0.0 }, - 'kernelRadius': { value: 100.0 }, - 'randomSeed': { value: 0.0 } + "minResolution": { value: 0.0 }, + "kernelRadius": { value: 100.0 }, + "randomSeed": { value: 0.0 } }, vertexShader: [ "varying vec2 vUv;", diff --git a/examples/js/shaders/SMAAShader.js b/examples/js/shaders/SMAAShader.js index aecba4b6a329252313f4db70f6b88bf97b172663..c9e0a26da0c5eeb7e5e23df5e8cc1b9cad0182a2 100644 --- a/examples/js/shaders/SMAAShader.js +++ b/examples/js/shaders/SMAAShader.js @@ -29,18 +29,18 @@ THREE.SMAAEdgesShader = { "varying vec4 vOffset[ 3 ];", "void SMAAEdgeDetectionVS( vec2 texcoord ) {", - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );", // WebGL port note: Changed sign in W component "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAAEdgeDetectionVS( vUv );", + " SMAAEdgeDetectionVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -54,60 +54,60 @@ THREE.SMAAEdgesShader = { "varying vec4 vOffset[ 3 ];", "vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {", - "vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );", + " vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );", - // Calculate color deltas: - "vec4 delta;", - "vec3 C = texture2D( colorTex, texcoord ).rgb;", + // Calculate color deltas: + " vec4 delta;", + " vec3 C = texture2D( colorTex, texcoord ).rgb;", - "vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;", - "vec3 t = abs( C - Cleft );", - "delta.x = max( max( t.r, t.g ), t.b );", + " vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;", + " vec3 t = abs( C - Cleft );", + " delta.x = max( max( t.r, t.g ), t.b );", - "vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;", - "t = abs( C - Ctop );", - "delta.y = max( max( t.r, t.g ), t.b );", + " vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;", + " t = abs( C - Ctop );", + " delta.y = max( max( t.r, t.g ), t.b );", - // We do the usual threshold: - "vec2 edges = step( threshold, delta.xy );", + // We do the usual threshold: + " vec2 edges = step( threshold, delta.xy );", - // Then discard if there is no edge: - "if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )", - "discard;", + // Then discard if there is no edge: + " if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )", + " discard;", - // Calculate right and bottom deltas: - "vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;", - "t = abs( C - Cright );", - "delta.z = max( max( t.r, t.g ), t.b );", + // Calculate right and bottom deltas: + " vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;", + " t = abs( C - Cright );", + " delta.z = max( max( t.r, t.g ), t.b );", - "vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;", - "t = abs( C - Cbottom );", - "delta.w = max( max( t.r, t.g ), t.b );", + " vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;", + " t = abs( C - Cbottom );", + " delta.w = max( max( t.r, t.g ), t.b );", - // Calculate the maximum delta in the direct neighborhood: - "float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );", + // Calculate the maximum delta in the direct neighborhood: + " float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );", - // Calculate left-left and top-top deltas: - "vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;", - "t = abs( C - Cleftleft );", - "delta.z = max( max( t.r, t.g ), t.b );", + // Calculate left-left and top-top deltas: + " vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;", + " t = abs( C - Cleftleft );", + " delta.z = max( max( t.r, t.g ), t.b );", - "vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;", - "t = abs( C - Ctoptop );", - "delta.w = max( max( t.r, t.g ), t.b );", + " vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;", + " t = abs( C - Ctoptop );", + " delta.w = max( max( t.r, t.g ), t.b );", - // Calculate the final maximum delta: - "maxDelta = max( max( maxDelta, delta.z ), delta.w );", + // Calculate the final maximum delta: + " maxDelta = max( max( maxDelta, delta.z ), delta.w );", - // Local contrast adaptation in action: - "edges.xy *= step( 0.5 * maxDelta, delta.xy );", + // Local contrast adaptation in action: + " edges.xy *= step( 0.5 * maxDelta, delta.xy );", - "return vec4( edges, 0.0, 0.0 );", + " return vec4( edges, 0.0, 0.0 );", "}", "void main() {", - "gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );", + " gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );", "}" @@ -144,24 +144,24 @@ THREE.SMAAWeightsShader = { "varying vec2 vPixcoord;", "void SMAABlendingWeightCalculationVS( vec2 texcoord ) {", - "vPixcoord = texcoord / resolution;", + " vPixcoord = texcoord / resolution;", - // We will use these offsets for the searches later on (see @PSEUDO_GATHER4): - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components + // We will use these offsets for the searches later on (see @PSEUDO_GATHER4): + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components - // And these for the searches, they indicate the ends of the loops: - "vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );", + // And these for the searches, they indicate the ends of the loops: + " vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );", "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAABlendingWeightCalculationVS( vUv );", + " SMAABlendingWeightCalculationVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -182,190 +182,190 @@ THREE.SMAAWeightsShader = { "#if __VERSION__ == 100", "vec2 round( vec2 x ) {", - "return sign( x ) * floor( abs( x ) + 0.5 );", + " return sign( x ) * floor( abs( x ) + 0.5 );", "}", "#endif", "float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {", - // Not required if searchTex accesses are set to point: - // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0); - // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + - // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; - "e.r = bias + e.r * scale;", - "return 255.0 * texture2D( searchTex, e, 0.0 ).r;", + // Not required if searchTex accesses are set to point: + // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0); + // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + + // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; + " e.r = bias + e.r * scale;", + " return 255.0 * texture2D( searchTex, e, 0.0 ).r;", "}", "float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - /** + /** * @PSEUDO_GATHER4 * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to * sample between edge, thus fetching four edges in a row. * Sampling with different offsets in each direction allows to disambiguate * which edges are active from the four fetched ones. */ - "vec2 e = vec2( 0.0, 1.0 );", + " vec2 e = vec2( 0.0, 1.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord -= vec2( 2.0, 0.0 ) * resolution;", - "if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord -= vec2( 2.0, 0.0 ) * resolution;", + " if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;", + " }", - // We correct the previous (-0.25, -0.125) offset we applied: - "texcoord.x += 0.25 * resolution.x;", + // We correct the previous (-0.25, -0.125) offset we applied: + " texcoord.x += 0.25 * resolution.x;", - // The searches are bias by 1, so adjust the coords accordingly: - "texcoord.x += resolution.x;", + // The searches are bias by 1, so adjust the coords accordingly: + " texcoord.x += resolution.x;", - // Disambiguate the length added by the last step: - "texcoord.x += 2.0 * resolution.x;", // Undo last step - "texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);", + // Disambiguate the length added by the last step: + " texcoord.x += 2.0 * resolution.x;", // Undo last step + " texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);", - "return texcoord.x;", + " return texcoord.x;", "}", "float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 0.0, 1.0 );", + " vec2 e = vec2( 0.0, 1.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord += vec2( 2.0, 0.0 ) * resolution;", - "if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord += vec2( 2.0, 0.0 ) * resolution;", + " if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;", + " }", - "texcoord.x -= 0.25 * resolution.x;", - "texcoord.x -= resolution.x;", - "texcoord.x -= 2.0 * resolution.x;", - "texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );", + " texcoord.x -= 0.25 * resolution.x;", + " texcoord.x -= resolution.x;", + " texcoord.x -= 2.0 * resolution.x;", + " texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );", - "return texcoord.x;", + " return texcoord.x;", "}", "float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 1.0, 0.0 );", + " vec2 e = vec2( 1.0, 0.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign - "if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign + " if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;", + " }", - "texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign + " texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign - "return texcoord.y;", + " return texcoord.y;", "}", "float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 1.0, 0.0 );", + " vec2 e = vec2( 1.0, 0.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign - "if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign + " if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;", + " }", - "texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y += resolution.y;", // WebGL port note: Changed sign - "texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign + " texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y += resolution.y;", // WebGL port note: Changed sign + " texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign - "return texcoord.y;", + " return texcoord.y;", "}", "vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {", - // Rounding prevents precision errors of bilinear filtering: - "vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;", + // Rounding prevents precision errors of bilinear filtering: + " vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;", - // We do a scale and bias for mapping to texel space: - "texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );", + // We do a scale and bias for mapping to texel space: + " texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );", - // Move to proper place, according to the subpixel offset: - "texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;", + // Move to proper place, according to the subpixel offset: + " texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;", - "return texture2D( areaTex, texcoord, 0.0 ).rg;", + " return texture2D( areaTex, texcoord, 0.0 ).rg;", "}", "vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {", - "vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );", + " vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );", - "vec2 e = texture2D( edgesTex, texcoord ).rg;", + " vec2 e = texture2D( edgesTex, texcoord ).rg;", - "if ( e.g > 0.0 ) {", // Edge at north - "vec2 d;", + " if ( e.g > 0.0 ) {", // Edge at north + " vec2 d;", - // Find the distance to the left: - "vec2 coords;", - "coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );", - "coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET) - "d.x = coords.x;", + // Find the distance to the left: + " vec2 coords;", + " coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );", + " coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET) + " d.x = coords.x;", - // Now fetch the left crossing edges, two at a time using bilinear - // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to - // discern what value each edge has: - "float e1 = texture2D( edgesTex, coords, 0.0 ).r;", + // Now fetch the left crossing edges, two at a time using bilinear + // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to + // discern what value each edge has: + " float e1 = texture2D( edgesTex, coords, 0.0 ).r;", - // Find the distance to the right: - "coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );", - "d.y = coords.x;", + // Find the distance to the right: + " coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );", + " d.y = coords.x;", - // We want the distances to be in pixel units (doing this here allow to - // better interleave arithmetic and memory accesses): - "d = d / resolution.x - pixcoord.x;", + // We want the distances to be in pixel units (doing this here allow to + // better interleave arithmetic and memory accesses): + " d = d / resolution.x - pixcoord.x;", - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - "vec2 sqrt_d = sqrt( abs( d ) );", + // SMAAArea below needs a sqrt, as the areas texture is compressed + // quadratically: + " vec2 sqrt_d = sqrt( abs( d ) );", - // Fetch the right crossing edges: - "coords.y -= 1.0 * resolution.y;", // WebGL port note: Added - "float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;", + // Fetch the right crossing edges: + " coords.y -= 1.0 * resolution.y;", // WebGL port note: Added + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;", - // Ok, we know how this pattern looks like, now it is time for getting - // the actual area: - "weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );", - "}", + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + " weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );", + " }", - "if ( e.r > 0.0 ) {", // Edge at west - "vec2 d;", + " if ( e.r > 0.0 ) {", // Edge at west + " vec2 d;", - // Find the distance to the top: - "vec2 coords;", + // Find the distance to the top: + " vec2 coords;", - "coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );", - "coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x; - "d.x = coords.y;", + " coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );", + " coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x; + " d.x = coords.y;", - // Fetch the top crossing edges: - "float e1 = texture2D( edgesTex, coords, 0.0 ).g;", + // Fetch the top crossing edges: + " float e1 = texture2D( edgesTex, coords, 0.0 ).g;", - // Find the distance to the bottom: - "coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );", - "d.y = coords.y;", + // Find the distance to the bottom: + " coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );", + " d.y = coords.y;", - // We want the distances to be in pixel units: - "d = d / resolution.y - pixcoord.y;", + // We want the distances to be in pixel units: + " d = d / resolution.y - pixcoord.y;", - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - "vec2 sqrt_d = sqrt( abs( d ) );", + // SMAAArea below needs a sqrt, as the areas texture is compressed + // quadratically: + " vec2 sqrt_d = sqrt( abs( d ) );", - // Fetch the bottom crossing edges: - "coords.y -= 1.0 * resolution.y;", // WebGL port note: Added - "float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;", + // Fetch the bottom crossing edges: + " coords.y -= 1.0 * resolution.y;", // WebGL port note: Added + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;", - // Get the area for this direction: - "weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );", - "}", + // Get the area for this direction: + " weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );", + " }", - "return weights;", + " return weights;", "}", "void main() {", - "gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );", + " gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );", "}" @@ -391,17 +391,17 @@ THREE.SMAABlendShader = { "varying vec4 vOffset[ 2 ];", "void SMAANeighborhoodBlendingVS( vec2 texcoord ) {", - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAANeighborhoodBlendingVS( vUv );", + " SMAANeighborhoodBlendingVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -417,49 +417,49 @@ THREE.SMAABlendShader = { "varying vec4 vOffset[ 2 ];", "vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {", - // Fetch the blending weights for current pixel: - "vec4 a;", - "a.xz = texture2D( blendTex, texcoord ).xz;", - "a.y = texture2D( blendTex, offset[ 1 ].zw ).g;", - "a.w = texture2D( blendTex, offset[ 1 ].xy ).a;", - - // Is there any blending weight with a value greater than 0.0? - "if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {", - "return texture2D( colorTex, texcoord, 0.0 );", - "} else {", - // Up to 4 lines can be crossing a pixel (one through each edge). We - // favor blending by choosing the line with the maximum weight for each - // direction: - "vec2 offset;", - "offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right - "offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs - - // Then we go in the direction that has the maximum weight: - "if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical - "offset.y = 0.0;", - "} else {", - "offset.x = 0.0;", - "}", - - // Fetch the opposite color and lerp by hand: - "vec4 C = texture2D( colorTex, texcoord, 0.0 );", - "texcoord += sign( offset ) * resolution;", - "vec4 Cop = texture2D( colorTex, texcoord, 0.0 );", - "float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );", - - // WebGL port note: Added gamma correction - "C.xyz = pow(C.xyz, vec3(2.2));", - "Cop.xyz = pow(Cop.xyz, vec3(2.2));", - "vec4 mixed = mix(C, Cop, s);", - "mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));", - - "return mixed;", - "}", + // Fetch the blending weights for current pixel: + " vec4 a;", + " a.xz = texture2D( blendTex, texcoord ).xz;", + " a.y = texture2D( blendTex, offset[ 1 ].zw ).g;", + " a.w = texture2D( blendTex, offset[ 1 ].xy ).a;", + + // Is there any blending weight with a value greater than 0.0? + " if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {", + " return texture2D( colorTex, texcoord, 0.0 );", + " } else {", + // Up to 4 lines can be crossing a pixel (one through each edge). We + // favor blending by choosing the line with the maximum weight for each + // direction: + " vec2 offset;", + " offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right + " offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs + + // Then we go in the direction that has the maximum weight: + " if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical + " offset.y = 0.0;", + " } else {", + " offset.x = 0.0;", + " }", + + // Fetch the opposite color and lerp by hand: + " vec4 C = texture2D( colorTex, texcoord, 0.0 );", + " texcoord += sign( offset ) * resolution;", + " vec4 Cop = texture2D( colorTex, texcoord, 0.0 );", + " float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );", + + // WebGL port note: Added gamma correction + " C.xyz = pow(C.xyz, vec3(2.2));", + " Cop.xyz = pow(Cop.xyz, vec3(2.2));", + " vec4 mixed = mix(C, Cop, s);", + " mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));", + + " return mixed;", + " }", "}", "void main() {", - "gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );", + " gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );", "}" diff --git a/examples/js/shaders/SobelOperatorShader.js b/examples/js/shaders/SobelOperatorShader.js index f64238b918e32c637fd2153f3494b2e55408fdc4..f33b634be3c036623cd4fb1b6120587fe9d2c768 100644 --- a/examples/js/shaders/SobelOperatorShader.js +++ b/examples/js/shaders/SobelOperatorShader.js @@ -40,44 +40,44 @@ THREE.SobelOperatorShader = { " vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );", - // kernel definition (in glsl matrices are filled in column-major order) + // kernel definition (in glsl matrices are filled in column-major order) " const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel " const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel - // fetch the 3x3 neighbourhood of a fragment + // fetch the 3x3 neighbourhood of a fragment - // first column + // first column " float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;", " float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;", " float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;", - // second column + // second column " float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;", " float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;", " float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;", - // third column + // third column " float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;", " float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;", " float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;", - // gradient value in x direction + // gradient value in x direction " float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ", " Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ", " Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ", - // gradient value in y direction + // gradient value in y direction " float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ", " Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ", " Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ", - // magnitute of the total gradient + // magnitute of the total gradient " float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );", diff --git a/examples/js/shaders/TerrainShader.js b/examples/js/shaders/TerrainShader.js index d2064ddfaf28027614ebad47ad5e867c8fa23525..e3c4b0d22a2a403f3d39bb6ab8375af165c07116 100644 --- a/examples/js/shaders/TerrainShader.js +++ b/examples/js/shaders/TerrainShader.js @@ -142,7 +142,7 @@ THREE.TerrainShader = { " vec3 totalDiffuseLight = vec3( 0.0 );", " vec3 totalSpecularLight = vec3( 0.0 );", - // point lights + // point lights " #if NUM_POINT_LIGHTS > 0", @@ -168,7 +168,7 @@ THREE.TerrainShader = { " #endif", - // directional lights + // directional lights " #if NUM_DIR_LIGHTS > 0", @@ -192,7 +192,7 @@ THREE.TerrainShader = { " #endif", - // hemisphere lights + // hemisphere lights " #if NUM_HEMI_LIGHTS > 0", @@ -203,14 +203,14 @@ THREE.TerrainShader = { " vec3 lVector = hemisphereLightDirection[ i ];", - // diffuse + // diffuse " float dotProduct = dot( normal, lVector );", " float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;", " totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );", - // specular (sky light) + // specular (sky light) " float hemiSpecularWeight = 0.0;", @@ -218,7 +218,7 @@ THREE.TerrainShader = { " float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;", " hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );", - // specular (ground light) + // specular (ground light) " vec3 lVectorGround = -lVector;", @@ -236,7 +236,7 @@ THREE.TerrainShader = { " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - THREE.ShaderChunk[ "fog_fragment" ], + THREE.ShaderChunk[ "fog_fragment" ], "}" @@ -272,20 +272,20 @@ THREE.TerrainShader = { " vNormal = normalize( normalMatrix * normal );", - // tangent and binormal vectors + // tangent and binormal vectors " vTangent = normalize( normalMatrix * tangent.xyz );", " vBinormal = cross( vNormal, vTangent ) * tangent.w;", " vBinormal = normalize( vBinormal );", - // texture coordinates + // texture coordinates " vUv = uv;", " vec2 uvBase = uv * uRepeatBase;", - // displacement mapping + // displacement mapping " #ifdef VERTEX_TEXTURES", @@ -310,8 +310,8 @@ THREE.TerrainShader = { " vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;", " vNormal = normalMatrix * normalTex;", - THREE.ShaderChunk[ "shadowmap_vertex" ], - THREE.ShaderChunk[ "fog_vertex" ], + THREE.ShaderChunk[ "shadowmap_vertex" ], + THREE.ShaderChunk[ "fog_vertex" ], "}" diff --git a/examples/js/shaders/ToneMapShader.js b/examples/js/shaders/ToneMapShader.js index 12f2e3b4895c8609fabe61fff375ce9b8d2c1974..6094cb69815842e890de24e8e1d0e5253bcee717 100644 --- a/examples/js/shaders/ToneMapShader.js +++ b/examples/js/shaders/ToneMapShader.js @@ -48,16 +48,16 @@ THREE.ToneMapShader = { "vec3 ToneMap( vec3 vColor ) {", " #ifdef ADAPTED_LUMINANCE", - // Get the calculated average luminance + // Get the calculated average luminance " float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;", " #else", " float fLumAvg = averageLuminance;", " #endif", - // Calculate the luminance of the current pixel + // Calculate the luminance of the current pixel " float fLumPixel = linearToRelativeLuminance( vColor );", - // Apply the modified operator (Eq. 4) + // Apply the modified operator (Eq. 4) " float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );", " float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);", diff --git a/examples/js/shaders/TriangleBlurShader.js b/examples/js/shaders/TriangleBlurShader.js index b788eb89eaa0fced6564bfc19f0d123552235ddc..bd5341af6522b7bce56d2db67ae9e479e8c665bb 100644 --- a/examples/js/shaders/TriangleBlurShader.js +++ b/examples/js/shaders/TriangleBlurShader.js @@ -49,7 +49,7 @@ THREE.TriangleBlurShader = { " float total = 0.0;", - // randomize the lookup values to hide the fixed number of samples + // randomize the lookup values to hide the fixed number of samples " float offset = rand( vUv );", diff --git a/examples/js/shaders/VignetteShader.js b/examples/js/shaders/VignetteShader.js index e849ed8de234f5f54e7fc52cc67bffe90695a13f..739d86bdb7ccca873c9a949cb772e131af24c13b 100644 --- a/examples/js/shaders/VignetteShader.js +++ b/examples/js/shaders/VignetteShader.js @@ -40,7 +40,7 @@ THREE.VignetteShader = { "void main() {", - // Eskil's vignette + // Eskil's vignette " vec4 texel = texture2D( tDiffuse, vUv );", " vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", diff --git a/examples/js/shaders/VolumeShader.js b/examples/js/shaders/VolumeShader.js index f5b2a4582a94cf60ba29ad30de72b80b21e04e8f..13136160a669ceb9651dd8af00e7341b187be95b 100644 --- a/examples/js/shaders/VolumeShader.js +++ b/examples/js/shaders/VolumeShader.js @@ -8,317 +8,317 @@ THREE.VolumeRenderShader1 = { uniforms: { - "u_size": { value: new THREE.Vector3( 1, 1, 1 ) }, - "u_renderstyle": { value: 0 }, - "u_renderthreshold": { value: 0.5 }, - "u_clim": { value: new THREE.Vector2( 1, 1 ) }, - "u_data": { value: null }, - "u_cmdata": { value: null } - }, - vertexShader: [ - 'varying vec4 v_nearpos;', - 'varying vec4 v_farpos;', - 'varying vec3 v_position;', - - 'mat4 inversemat(mat4 m) {', - // Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl - // This function is licenced by the MIT license to Mikola Lysenko - 'float', - 'a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],', - 'a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],', - 'a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],', - 'a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],', - - 'b00 = a00 * a11 - a01 * a10,', - 'b01 = a00 * a12 - a02 * a10,', - 'b02 = a00 * a13 - a03 * a10,', - 'b03 = a01 * a12 - a02 * a11,', - 'b04 = a01 * a13 - a03 * a11,', - 'b05 = a02 * a13 - a03 * a12,', - 'b06 = a20 * a31 - a21 * a30,', - 'b07 = a20 * a32 - a22 * a30,', - 'b08 = a20 * a33 - a23 * a30,', - 'b09 = a21 * a32 - a22 * a31,', - 'b10 = a21 * a33 - a23 * a31,', - 'b11 = a22 * a33 - a23 * a32,', - - 'det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;', - - 'return mat4(', - 'a11 * b11 - a12 * b10 + a13 * b09,', - 'a02 * b10 - a01 * b11 - a03 * b09,', - 'a31 * b05 - a32 * b04 + a33 * b03,', - 'a22 * b04 - a21 * b05 - a23 * b03,', - 'a12 * b08 - a10 * b11 - a13 * b07,', - 'a00 * b11 - a02 * b08 + a03 * b07,', - 'a32 * b02 - a30 * b05 - a33 * b01,', - 'a20 * b05 - a22 * b02 + a23 * b01,', - 'a10 * b10 - a11 * b08 + a13 * b06,', - 'a01 * b08 - a00 * b10 - a03 * b06,', - 'a30 * b04 - a31 * b02 + a33 * b00,', - 'a21 * b02 - a20 * b04 - a23 * b00,', - 'a11 * b07 - a10 * b09 - a12 * b06,', - 'a00 * b09 - a01 * b07 + a02 * b06,', - 'a31 * b01 - a30 * b03 - a32 * b00,', - 'a20 * b03 - a21 * b01 + a22 * b00) / det;', - '}', - - - 'void main() {', - // Prepare transforms to map to "camera view". See also: - // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram - 'mat4 viewtransformf = viewMatrix;', - 'mat4 viewtransformi = inversemat(viewMatrix);', - - // Project local vertex coordinate to camera position. Then do a step - // backward (in cam coords) to the near clipping plane, and project back. Do - // the same for the far clipping plane. This gives us all the information we - // need to calculate the ray and truncate it to the viewing cone. - 'vec4 position4 = vec4(position, 1.0);', - 'vec4 pos_in_cam = viewtransformf * position4;', - - // Intersection of ray and near clipping plane (z = -1 in clip coords) - 'pos_in_cam.z = -pos_in_cam.w;', - 'v_nearpos = viewtransformi * pos_in_cam;', - - // Intersection of ray and far clipping plane (z = +1 in clip coords) - 'pos_in_cam.z = pos_in_cam.w;', - 'v_farpos = viewtransformi * pos_in_cam;', - - // Set varyings and output pos - 'v_position = position;', - 'gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;', - '}', - ].join( '\n' ), + "u_size": { value: new THREE.Vector3( 1, 1, 1 ) }, + "u_renderstyle": { value: 0 }, + "u_renderthreshold": { value: 0.5 }, + "u_clim": { value: new THREE.Vector2( 1, 1 ) }, + "u_data": { value: null }, + "u_cmdata": { value: null } + }, + vertexShader: [ + " varying vec4 v_nearpos;", + " varying vec4 v_farpos;", + " varying vec3 v_position;", + + " mat4 inversemat(mat4 m) {", + // Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl + // This function is licenced by the MIT license to Mikola Lysenko + " float", + " a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],", + " a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],", + " a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],", + " a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],", + + " b00 = a00 * a11 - a01 * a10,", + " b01 = a00 * a12 - a02 * a10,", + " b02 = a00 * a13 - a03 * a10,", + " b03 = a01 * a12 - a02 * a11,", + " b04 = a01 * a13 - a03 * a11,", + " b05 = a02 * a13 - a03 * a12,", + " b06 = a20 * a31 - a21 * a30,", + " b07 = a20 * a32 - a22 * a30,", + " b08 = a20 * a33 - a23 * a30,", + " b09 = a21 * a32 - a22 * a31,", + " b10 = a21 * a33 - a23 * a31,", + " b11 = a22 * a33 - a23 * a32,", + + " det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;", + + " return mat4(", + " a11 * b11 - a12 * b10 + a13 * b09,", + " a02 * b10 - a01 * b11 - a03 * b09,", + " a31 * b05 - a32 * b04 + a33 * b03,", + " a22 * b04 - a21 * b05 - a23 * b03,", + " a12 * b08 - a10 * b11 - a13 * b07,", + " a00 * b11 - a02 * b08 + a03 * b07,", + " a32 * b02 - a30 * b05 - a33 * b01,", + " a20 * b05 - a22 * b02 + a23 * b01,", + " a10 * b10 - a11 * b08 + a13 * b06,", + " a01 * b08 - a00 * b10 - a03 * b06,", + " a30 * b04 - a31 * b02 + a33 * b00,", + " a21 * b02 - a20 * b04 - a23 * b00,", + " a11 * b07 - a10 * b09 - a12 * b06,", + " a00 * b09 - a01 * b07 + a02 * b06,", + " a31 * b01 - a30 * b03 - a32 * b00,", + " a20 * b03 - a21 * b01 + a22 * b00) / det;", + " }", + + + " void main() {", + // Prepare transforms to map to "camera view". See also: + // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram + " mat4 viewtransformf = viewMatrix;", + " mat4 viewtransformi = inversemat(viewMatrix);", + + // Project local vertex coordinate to camera position. Then do a step + // backward (in cam coords) to the near clipping plane, and project back. Do + // the same for the far clipping plane. This gives us all the information we + // need to calculate the ray and truncate it to the viewing cone. + " vec4 position4 = vec4(position, 1.0);", + " vec4 pos_in_cam = viewtransformf * position4;", + + // Intersection of ray and near clipping plane (z = -1 in clip coords) + " pos_in_cam.z = -pos_in_cam.w;", + " v_nearpos = viewtransformi * pos_in_cam;", + + // Intersection of ray and far clipping plane (z = +1 in clip coords) + " pos_in_cam.z = pos_in_cam.w;", + " v_farpos = viewtransformi * pos_in_cam;", + + // Set varyings and output pos + " v_position = position;", + " gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;", + " }", + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', - 'precision mediump sampler3D;', - - 'uniform vec3 u_size;', - 'uniform int u_renderstyle;', - 'uniform float u_renderthreshold;', - 'uniform vec2 u_clim;', - - 'uniform sampler3D u_data;', - 'uniform sampler2D u_cmdata;', - - 'varying vec3 v_position;', - 'varying vec4 v_nearpos;', - 'varying vec4 v_farpos;', - - // The maximum distance through our rendering volume is sqrt(3). - 'const int MAX_STEPS = 887; // 887 for 512^3, 1774 for 1024^3', - 'const int REFINEMENT_STEPS = 4;', - 'const float relative_step_size = 1.0;', - 'const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);', - 'const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);', - 'const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);', - 'const float shininess = 40.0;', - - 'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);', - 'void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);', - - 'float sample1(vec3 texcoords);', - 'vec4 apply_colormap(float val);', - 'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);', - - - 'void main() {', - // Normalize clipping plane info - 'vec3 farpos = v_farpos.xyz / v_farpos.w;', - 'vec3 nearpos = v_nearpos.xyz / v_nearpos.w;', - - // Calculate unit vector pointing in the view direction through this fragment. - 'vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);', - - // Compute the (negative) distance to the front surface or near clipping plane. - // v_position is the back face of the cuboid, so the initial distance calculated in the dot - // product below is the distance from near clip plane to the back of the cuboid - 'float distance = dot(nearpos - v_position, view_ray);', - 'distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,', - '(u_size.x - 0.5 - v_position.x) / view_ray.x));', - 'distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,', - '(u_size.y - 0.5 - v_position.y) / view_ray.y));', - 'distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,', - '(u_size.z - 0.5 - v_position.z) / view_ray.z));', - - // Now we have the starting position on the front surface - 'vec3 front = v_position + view_ray * distance;', - - // Decide how many steps to take - 'int nsteps = int(-distance / relative_step_size + 0.5);', - 'if ( nsteps < 1 )', - 'discard;', - - // Get starting location and step vector in texture coordinates - 'vec3 step = ((v_position - front) / u_size) / float(nsteps);', - 'vec3 start_loc = front / u_size;', - - // For testing: show the number of steps. This helps to establish - // whether the rays are correctly oriented - //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);', - //'return;', - - 'if (u_renderstyle == 0)', - 'cast_mip(start_loc, step, nsteps, view_ray);', - 'else if (u_renderstyle == 1)', - 'cast_iso(start_loc, step, nsteps, view_ray);', - - 'if (gl_FragColor.a < 0.05)', - 'discard;', - '}', - - - 'float sample1(vec3 texcoords) {', - '/* Sample float value from a 3D texture. Assumes intensity data. */', - 'return texture(u_data, texcoords.xyz).r;', - '}', - - - 'vec4 apply_colormap(float val) {', - 'val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);', - 'return texture2D(u_cmdata, vec2(val, 0.5));', - '}', - - - 'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {', - - 'float max_val = -1e6;', - 'int max_i = 100;', - 'vec3 loc = start_loc;', - - // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with - // non-constant expression. So we use a hard-coded max, and an additional condition - // inside the loop. - 'for (int iter=0; iter= nsteps)', - 'break;', - // Sample from the 3D texture - 'float val = sample1(loc);', - // Apply MIP operation - 'if (val > max_val) {', - 'max_val = val;', - 'max_i = iter;', - '}', - // Advance location deeper into the volume - 'loc += step;', - '}', - - // Refine location, gives crispier images - 'vec3 iloc = start_loc + step * (float(max_i) - 0.5);', - 'vec3 istep = step / float(REFINEMENT_STEPS);', - 'for (int i=0; i= nsteps)', - 'break;', - - // Sample from the 3D texture - 'float val = sample1(loc);', - - 'if (val > low_threshold) {', - // Take the last interval in smaller steps - 'vec3 iloc = loc - 0.5 * step;', - 'vec3 istep = step / float(REFINEMENT_STEPS);', - 'for (int i=0; i u_renderthreshold) {', - 'gl_FragColor = add_lighting(val, iloc, dstep, view_ray);', - 'return;', - '}', - 'iloc += istep;', - '}', - '}', - - // Advance location deeper into the volume - 'loc += step;', - '}', - '}', - - - 'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)', - '{', - // Calculate color by incorporating lighting - - // View direction - 'vec3 V = normalize(view_ray);', - - // calculate normal vector from gradient - 'vec3 N;', - 'float val1, val2;', - 'val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));', - 'val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));', - 'N[0] = val1 - val2;', - 'val = max(max(val1, val2), val);', - 'val1 = sample1(loc + vec3(0.0, -step[1], 0.0));', - 'val2 = sample1(loc + vec3(0.0, +step[1], 0.0));', - 'N[1] = val1 - val2;', - 'val = max(max(val1, val2), val);', - 'val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));', - 'val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));', - 'N[2] = val1 - val2;', - 'val = max(max(val1, val2), val);', - - 'float gm = length(N); // gradient magnitude', - 'N = normalize(N);', - - // Flip normal so it points towards viewer - 'float Nselect = float(dot(N, V) > 0.0);', - 'N = (2.0 * Nselect - 1.0) * N; // == Nselect * N - (1.0-Nselect)*N;', - - // Init colors - 'vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);', - 'vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);', - 'vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);', - - // note: could allow multiple lights - 'for (int i=0; i<1; i++)', - '{', + " precision highp float;", + " precision mediump sampler3D;", + + " uniform vec3 u_size;", + " uniform int u_renderstyle;", + " uniform float u_renderthreshold;", + " uniform vec2 u_clim;", + + " uniform sampler3D u_data;", + " uniform sampler2D u_cmdata;", + + " varying vec3 v_position;", + " varying vec4 v_nearpos;", + " varying vec4 v_farpos;", + + // The maximum distance through our rendering volume is sqrt(3). + " const int MAX_STEPS = 887; // 887 for 512^3, 1774 for 1024^3", + " const int REFINEMENT_STEPS = 4;", + " const float relative_step_size = 1.0;", + " const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);", + " const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);", + " const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);", + " const float shininess = 40.0;", + + " void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);", + " void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);", + + " float sample1(vec3 texcoords);", + " vec4 apply_colormap(float val);", + " vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);", + + + " void main() {", + // Normalize clipping plane info + " vec3 farpos = v_farpos.xyz / v_farpos.w;", + " vec3 nearpos = v_nearpos.xyz / v_nearpos.w;", + + // Calculate unit vector pointing in the view direction through this fragment. + " vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);", + + // Compute the (negative) distance to the front surface or near clipping plane. + // v_position is the back face of the cuboid, so the initial distance calculated in the dot + // product below is the distance from near clip plane to the back of the cuboid + " float distance = dot(nearpos - v_position, view_ray);", + " distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,", + " (u_size.x - 0.5 - v_position.x) / view_ray.x));", + " distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,", + " (u_size.y - 0.5 - v_position.y) / view_ray.y));", + " distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,", + " (u_size.z - 0.5 - v_position.z) / view_ray.z));", + + // Now we have the starting position on the front surface + " vec3 front = v_position + view_ray * distance;", + + // Decide how many steps to take + " int nsteps = int(-distance / relative_step_size + 0.5);", + " if ( nsteps < 1 )", + " discard;", + + // Get starting location and step vector in texture coordinates + " vec3 step = ((v_position - front) / u_size) / float(nsteps);", + " vec3 start_loc = front / u_size;", + + // For testing: show the number of steps. This helps to establish + // whether the rays are correctly oriented + //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);', + //'return;', + + " if (u_renderstyle == 0)", + " cast_mip(start_loc, step, nsteps, view_ray);", + " else if (u_renderstyle == 1)", + " cast_iso(start_loc, step, nsteps, view_ray);", + + " if (gl_FragColor.a < 0.05)", + " discard;", + " }", + + + " float sample1(vec3 texcoords) {", + " /* Sample float value from a 3D texture. Assumes intensity data. */", + " return texture(u_data, texcoords.xyz).r;", + " }", + + + " vec4 apply_colormap(float val) {", + " val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);", + " return texture2D(u_cmdata, vec2(val, 0.5));", + " }", + + + " void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {", + + " float max_val = -1e6;", + " int max_i = 100;", + " vec3 loc = start_loc;", + + // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with + // non-constant expression. So we use a hard-coded max, and an additional condition + // inside the loop. + " for (int iter=0; iter= nsteps)", + " break;", + // Sample from the 3D texture + " float val = sample1(loc);", + // Apply MIP operation + " if (val > max_val) {", + " max_val = val;", + " max_i = iter;", + " }", + // Advance location deeper into the volume + " loc += step;", + " }", + + // Refine location, gives crispier images + " vec3 iloc = start_loc + step * (float(max_i) - 0.5);", + " vec3 istep = step / float(REFINEMENT_STEPS);", + " for (int i=0; i= nsteps)", + " break;", + + // Sample from the 3D texture + " float val = sample1(loc);", + + " if (val > low_threshold) {", + // Take the last interval in smaller steps + " vec3 iloc = loc - 0.5 * step;", + " vec3 istep = step / float(REFINEMENT_STEPS);", + " for (int i=0; i u_renderthreshold) {", + " gl_FragColor = add_lighting(val, iloc, dstep, view_ray);", + " return;", + " }", + " iloc += istep;", + " }", + " }", + + // Advance location deeper into the volume + " loc += step;", + " }", + " }", + + + " vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)", + " {", + // Calculate color by incorporating lighting + + // View direction + " vec3 V = normalize(view_ray);", + + // calculate normal vector from gradient + " vec3 N;", + " float val1, val2;", + " val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));", + " val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));", + " N[0] = val1 - val2;", + " val = max(max(val1, val2), val);", + " val1 = sample1(loc + vec3(0.0, -step[1], 0.0));", + " val2 = sample1(loc + vec3(0.0, +step[1], 0.0));", + " N[1] = val1 - val2;", + " val = max(max(val1, val2), val);", + " val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));", + " val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));", + " N[2] = val1 - val2;", + " val = max(max(val1, val2), val);", + + " float gm = length(N); // gradient magnitude", + " N = normalize(N);", + + // Flip normal so it points towards viewer + " float Nselect = float(dot(N, V) > 0.0);", + " N = (2.0 * Nselect - 1.0) * N; // == Nselect * N - (1.0-Nselect)*N;", + + // Init colors + " vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);", + " vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);", + " vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);", + + // note: could allow multiple lights + " for (int i=0; i<1; i++)", + " {", // Get light direction (make sure to prevent zero devision) - 'vec3 L = normalize(view_ray); //lightDirs[i];', - 'float lightEnabled = float( length(L) > 0.0 );', - 'L = normalize(L + (1.0 - lightEnabled));', - - // Calculate lighting properties - 'float lambertTerm = clamp(dot(N, L), 0.0, 1.0);', - 'vec3 H = normalize(L+V); // Halfway vector', - 'float specularTerm = pow(max(dot(H, N), 0.0), shininess);', - - // Calculate mask - 'float mask1 = lightEnabled;', - - // Calculate colors - 'ambient_color += mask1 * ambient_color; // * gl_LightSource[i].ambient;', - 'diffuse_color += mask1 * lambertTerm;', - 'specular_color += mask1 * specularTerm * specular_color;', - '}', - - // Calculate final color by componing different components - 'vec4 final_color;', - 'vec4 color = apply_colormap(val);', - 'final_color = color * (ambient_color + diffuse_color) + specular_color;', - 'final_color.a = color.a;', - 'return final_color;', - '}', - ].join( '\n' ) + " vec3 L = normalize(view_ray); //lightDirs[i];", + " float lightEnabled = float( length(L) > 0.0 );", + " L = normalize(L + (1.0 - lightEnabled));", + + // Calculate lighting properties + " float lambertTerm = clamp(dot(N, L), 0.0, 1.0);", + " vec3 H = normalize(L+V); // Halfway vector", + " float specularTerm = pow(max(dot(H, N), 0.0), shininess);", + + // Calculate mask + " float mask1 = lightEnabled;", + + // Calculate colors + " ambient_color += mask1 * ambient_color; // * gl_LightSource[i].ambient;", + " diffuse_color += mask1 * lambertTerm;", + " specular_color += mask1 * specularTerm * specular_color;", + " }", + + // Calculate final color by componing different components + " vec4 final_color;", + " vec4 color = apply_colormap(val);", + " final_color = color * (ambient_color + diffuse_color) + specular_color;", + " final_color.a = color.a;", + " return final_color;", + " }", + ].join( "\n" ) }; diff --git a/examples/js/shaders/WaterRefractionShader.js b/examples/js/shaders/WaterRefractionShader.js index 6796fd4b59b7c432fc0b303c55f1e884994f6e3e..9512fca6d4a8d9b49a7e34fc58c70290fbea7fbc 100644 --- a/examples/js/shaders/WaterRefractionShader.js +++ b/examples/js/shaders/WaterRefractionShader.js @@ -7,23 +7,23 @@ THREE.WaterRefractionShader = { uniforms: { - 'color': { + "color": { value: null }, - 'time': { + "time": { value: 0 }, - 'tDiffuse': { + "tDiffuse": { value: null }, - 'tDudv': { + "tDudv": { value: null }, - 'textureMatrix': { + "textureMatrix": { value: null } @@ -31,66 +31,66 @@ THREE.WaterRefractionShader = { vertexShader: [ - 'uniform mat4 textureMatrix;', + "uniform mat4 textureMatrix;", - 'varying vec2 vUv;', - 'varying vec4 vUvRefraction;', + "varying vec2 vUv;", + "varying vec4 vUvRefraction;", - 'void main() {', + "void main() {", - ' vUv = uv;', + " vUv = uv;", - ' vUvRefraction = textureMatrix * vec4( position, 1.0 );', + " vUvRefraction = textureMatrix * vec4( position, 1.0 );", - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - '}' + "}" - ].join( '\n' ), + ].join( "\n" ), fragmentShader: [ - 'uniform vec3 color;', - 'uniform float time;', - 'uniform sampler2D tDiffuse;', - 'uniform sampler2D tDudv;', + "uniform vec3 color;", + "uniform float time;", + "uniform sampler2D tDiffuse;", + "uniform sampler2D tDudv;", - 'varying vec2 vUv;', - 'varying vec4 vUvRefraction;', + "varying vec2 vUv;", + "varying vec4 vUvRefraction;", - 'float blendOverlay( float base, float blend ) {', + "float blendOverlay( float base, float blend ) {", - ' return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );', + " return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );", - '}', + "}", - 'vec3 blendOverlay( vec3 base, vec3 blend ) {', + "vec3 blendOverlay( vec3 base, vec3 blend ) {", - ' return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );', + " return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );", - '}', + "}", - 'void main() {', + "void main() {", - ' float waveStrength = 0.1;', - ' float waveSpeed = 0.03;', + " float waveStrength = 0.1;", + " float waveSpeed = 0.03;", // simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s) - ' vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;', - ' distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );', - ' vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;', + " vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;", + " distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );", + " vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;", // new uv coords - ' vec4 uv = vec4( vUvRefraction );', - ' uv.xy += distortion;', + " vec4 uv = vec4( vUvRefraction );", + " uv.xy += distortion;", - ' vec4 base = texture2DProj( tDiffuse, uv );', + " vec4 base = texture2DProj( tDiffuse, uv );", - ' gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );', + " gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );", - '}' + "}" - ].join( '\n' ) + ].join( "\n" ) }; diff --git a/examples/jsm/WebGL.d.ts b/examples/jsm/WebGL.d.ts index 2294fc442e60336a4b1a03f862704255b54b3dab..1cad0510c4372f5f913110d7a55daab30724d110 100644 --- a/examples/jsm/WebGL.d.ts +++ b/examples/jsm/WebGL.d.ts @@ -1,9 +1,9 @@ export namespace WEBGL { - export function isWebGLAvailable(): boolean; - export function isWebGL2Available(): boolean; - export function getWebGLErrorMessage(): HTMLElement; - export function getWebGL2ErrorMessage(): HTMLElement; - export function getErrorMessage(version: number): HTMLElement; + export function isWebGLAvailable(): boolean; + export function isWebGL2Available(): boolean; + export function getWebGLErrorMessage(): HTMLElement; + export function getWebGL2ErrorMessage(): HTMLElement; + export function getErrorMessage( version: number ): HTMLElement; } diff --git a/examples/jsm/animation/AnimationClipCreator.d.ts b/examples/jsm/animation/AnimationClipCreator.d.ts index 9ca2da148e568bef5ab4d68df538c69b2403c4fa..b0b9f9b89d27ee270c010c0fa452e5d2c32ee5e9 100644 --- a/examples/jsm/animation/AnimationClipCreator.d.ts +++ b/examples/jsm/animation/AnimationClipCreator.d.ts @@ -1,16 +1,17 @@ import { - AnimationClip, - Vector3 + AnimationClip, + Vector3 } from '../../../src/Three'; -export class AnimationClipCreator { - constructor(); +export class AnimationClipCreator { - static CreateRotationAnimation(period: number, axis: string): AnimationClip; - static CreateScaleAxisAnimation(period: number, axis: string): AnimationClip; - static CreateShakeAnimation(duration: number, shakeScale: Vector3): AnimationClip; - static CreatePulsationAnimation(duration: number, pulseScale: number): AnimationClip; - static CreateVisibilityAnimation(duration: number): AnimationClip; - static CreateMaterialColorAnimation(duration: number, colors: number[]): AnimationClip; + constructor(); + + static CreateRotationAnimation( period: number, axis: string ): AnimationClip; + static CreateScaleAxisAnimation( period: number, axis: string ): AnimationClip; + static CreateShakeAnimation( duration: number, shakeScale: Vector3 ): AnimationClip; + static CreatePulsationAnimation( duration: number, pulseScale: number ): AnimationClip; + static CreateVisibilityAnimation( duration: number ): AnimationClip; + static CreateMaterialColorAnimation( duration: number, colors: number[] ): AnimationClip; } diff --git a/examples/jsm/animation/CCDIKSolver.d.ts b/examples/jsm/animation/CCDIKSolver.d.ts index e57fe0b769c3f8ebc284fbf617bd61ac38e50f9e..26971a87901b14d170fef3344fb692f7c4e9e657 100644 --- a/examples/jsm/animation/CCDIKSolver.d.ts +++ b/examples/jsm/animation/CCDIKSolver.d.ts @@ -1,25 +1,29 @@ import { - SkinnedMesh, + SkinnedMesh, } from '../../../src/Three'; export interface IKS { - effector: number; - iteration: number; - links: { - enabled: boolean; - index: number; - } - maxAngle: number; - target: number; + effector: number; + iteration: number; + links: { + enabled: boolean; + index: number; + } + maxAngle: number; + target: number; } export class CCDIKSolver { - constructor(mesh: SkinnedMesh, iks: IKS[]); - update(): this; - createHelper(): CCDIKHelper; + constructor( mesh: SkinnedMesh, iks: IKS[] ); + + update(): this; + createHelper(): CCDIKHelper; + } export class CCDIKHelper { - constructor(mesh: SkinnedMesh, iks: IKS[]); + + constructor( mesh: SkinnedMesh, iks: IKS[] ); + } diff --git a/examples/jsm/animation/MMDAnimationHelper.d.ts b/examples/jsm/animation/MMDAnimationHelper.d.ts index d12627acd05619705e6561b5c8dff54acec85024..f47fb245e285121dd7717d37f75b215f841b81b1 100644 --- a/examples/jsm/animation/MMDAnimationHelper.d.ts +++ b/examples/jsm/animation/MMDAnimationHelper.d.ts @@ -1,85 +1,91 @@ import { - AnimationClip, - Audio, - Camera, - Mesh, - Object3D, - SkinnedMesh + AnimationClip, + Audio, + Camera, + Mesh, + Object3D, + SkinnedMesh } from '../../../src/Three'; export interface MMDAnimationHelperParameter { - sync?: boolean; - afterglow?: number; - resetPhysicsOnLoop?: boolean; + sync?: boolean; + afterglow?: number; + resetPhysicsOnLoop?: boolean; } export interface MMDAnimationHelperAddParameter { - animation?: AnimationClip | AnimationClip[]; - physics?: boolean; - warmup?: number; - unitStep?: number; - maxStepNum?: number; - gravity?: number; - delayTime?: number; + animation?: AnimationClip | AnimationClip[]; + physics?: boolean; + warmup?: number; + unitStep?: number; + maxStepNum?: number; + gravity?: number; + delayTime?: number; } export interface MMDAnimationHelperPoseParameter { - resetPose?: boolean; - ik?: boolean; - grant?: boolean; + resetPose?: boolean; + ik?: boolean; + grant?: boolean; } export class MMDAnimationHelper { - constructor(params?: MMDAnimationHelperParameter); - meshes: Mesh[]; - camera: Camera | null; - cameraTarget: Object3D; - audio: Audio; - audioManager: AudioManager; - configuration: { - sync: boolean; - afterglow: number; - resetPhysicsOnLoop: boolean; - }; - enabled: { - animation: boolean; - ik: boolean; - grant: boolean; - physics: boolean; - cameraAnimation: boolean; - }; - onBeforePhysics: (mesh: SkinnedMesh) => void; - sharedPhysics: boolean; - masterPhysics: null; - - add(object: SkinnedMesh | Camera | Audio, params?: MMDAnimationHelperAddParameter): this; - remove(object: SkinnedMesh | Camera | Audio): this; - update(delta: number): this; - pose(mesh: SkinnedMesh, vpd: object, params?: MMDAnimationHelperPoseParameter): this; - enable(key: string, enabled: boolean): this; - createGrantSolver(mesh: SkinnedMesh): GrantSolver; + + constructor( params?: MMDAnimationHelperParameter ); + meshes: Mesh[]; + camera: Camera | null; + cameraTarget: Object3D; + audio: Audio; + audioManager: AudioManager; + configuration: { + sync: boolean; + afterglow: number; + resetPhysicsOnLoop: boolean; + }; + enabled: { + animation: boolean; + ik: boolean; + grant: boolean; + physics: boolean; + cameraAnimation: boolean; + }; + onBeforePhysics: ( mesh: SkinnedMesh ) => void; + sharedPhysics: boolean; + masterPhysics: null; + + add( object: SkinnedMesh | Camera | Audio, params?: MMDAnimationHelperAddParameter ): this; + remove( object: SkinnedMesh | Camera | Audio ): this; + update( delta: number ): this; + pose( mesh: SkinnedMesh, vpd: object, params?: MMDAnimationHelperPoseParameter ): this; + enable( key: string, enabled: boolean ): this; + createGrantSolver( mesh: SkinnedMesh ): GrantSolver; + } export interface AudioManagerParameter { - delayTime?: number; + delayTime?: number; } export class AudioManager { - constructor(audio: Audio, params?: AudioManagerParameter); - audio: Audio; - elapsedTime: number; - currentTime: number; - delayTime: number; - audioDuration: number; - duration: number; - - control(delta: number): this; + + constructor( audio: Audio, params?: AudioManagerParameter ); + audio: Audio; + elapsedTime: number; + currentTime: number; + delayTime: number; + audioDuration: number; + duration: number; + + control( delta: number ): this; + } export class GrantSolver { - constructor(mesh: SkinnedMesh, grants: object[]); - mesh: SkinnedMesh; - grants: object[]; - update(): this; + constructor( mesh: SkinnedMesh, grants: object[] ); + mesh: SkinnedMesh; + grants: object[]; + + update(): this; + } diff --git a/examples/jsm/animation/MMDPhysics.d.ts b/examples/jsm/animation/MMDPhysics.d.ts index 18fb2b5a356c9956acf2ef4cf6430086884a88fd..1a6f3ff5cfec3c4ddc3d3d1efc2de9aa8159788f 100644 --- a/examples/jsm/animation/MMDPhysics.d.ts +++ b/examples/jsm/animation/MMDPhysics.d.ts @@ -1,109 +1,118 @@ import { - Bone, - Euler, - Matrix4, - Object3D, - Quaternion, - SkinnedMesh, - Vector3 + Bone, + Euler, + Matrix4, + Object3D, + Quaternion, + SkinnedMesh, + Vector3 } from '../../../src/Three'; export interface MMDPhysicsParameter { - unitStep?: number; - maxStepNum?: number; - gravity?: Vector3; + unitStep?: number; + maxStepNum?: number; + gravity?: Vector3; } export class MMDPhysics { - constructor(mesh: SkinnedMesh, rigidBodyParams: object[], constraintParams?: object[], params?: MMDPhysicsParameter); - manager: ResourceManager; - mesh: SkinnedMesh; - unitStep: number; - maxStepNum: number; - gravity: Vector3; - world: null; - bodies: RigidBody[]; - constraints: Constraint[]; - - update(delta: number): this; - reset(): this; - warmup(cycles: number): this; - setGravity(gravity: Vector3): this; - createHelper(): MMDPhysicsHelper; + + constructor( mesh: SkinnedMesh, rigidBodyParams: object[], constraintParams?: object[], params?: MMDPhysicsParameter ); + manager: ResourceManager; + mesh: SkinnedMesh; + unitStep: number; + maxStepNum: number; + gravity: Vector3; + world: null; + bodies: RigidBody[]; + constraints: Constraint[]; + + update( delta: number ): this; + reset(): this; + warmup( cycles: number ): this; + setGravity( gravity: Vector3 ): this; + createHelper(): MMDPhysicsHelper; + } -export class ResourceManager{ - constructor(); - threeVector3s: Vector3[]; - threeMatrix4s: Matrix4[]; - threeQuaternions: Quaternion[]; - threeEulers: Euler[]; - transforms: object[]; - quaternions: object[]; - vector3s: object[]; - - allocThreeVector3(): void; - freeThreeVector3(v: Vector3): void; - allocThreeMatrix4(): void; - freeThreeMatrix4(m: Matrix4): void; - allocThreeQuaternion(): void; - freeThreeQuaternion(q: Quaternion): void; - allocThreeEuler(): void; - freeThreeEuler(e: Euler): void; - allocTransform(): void; - freeTransform(t: object): void; - allocQuaternion(): void; - freeQuaternion(q: object): void; - allocVector3(): void; - freeVector3(v: object): void; - setIdentity(): void; - getBasis(t: object): object; - getBasisAsMatrix3(t: object): object; - getOrigin(t: object): object; - setOrigin(t: object, v: object): void; - copyOrigin(t1: object, t2: object): void; - setBasis(t: object, q: object): void; - setBasisFromMatrix3(t: object, m: object): void; - setOriginFromArray3(t: object, a: number[]): void; - setOriginFromThreeVector3(t: object, v: Vector3): void; - setBasisFromArray3(t: object, a: number[]): void; - setBasisFromThreeQuaternion(t: object, a: Quaternion): void; - multiplyTransforms(t1: object, t2: object): object; - inverseTransform(t: object): object; - multiplyMatrices3(m1: object, m2: object): object; - addVector3(v1: object, v2: object): object; - dotVectors3(v1: object, v2: object): number; - rowOfMatrix3(m: object, i: number): object; - columnOfMatrix3(m: object, i: number): object; - negativeVector3(v: object): object; - multiplyMatrix3ByVector3(m: object, v: object): object; - transposeMatrix3(m: object): object; - quaternionToMatrix3(q: object): object; - matrix3ToQuaternion(m: object): object; +export class ResourceManager { + + constructor(); + threeVector3s: Vector3[]; + threeMatrix4s: Matrix4[]; + threeQuaternions: Quaternion[]; + threeEulers: Euler[]; + transforms: object[]; + quaternions: object[]; + vector3s: object[]; + + allocThreeVector3(): void; + freeThreeVector3( v: Vector3 ): void; + allocThreeMatrix4(): void; + freeThreeMatrix4( m: Matrix4 ): void; + allocThreeQuaternion(): void; + freeThreeQuaternion( q: Quaternion ): void; + allocThreeEuler(): void; + freeThreeEuler( e: Euler ): void; + allocTransform(): void; + freeTransform( t: object ): void; + allocQuaternion(): void; + freeQuaternion( q: object ): void; + allocVector3(): void; + freeVector3( v: object ): void; + setIdentity(): void; + getBasis( t: object ): object; + getBasisAsMatrix3( t: object ): object; + getOrigin( t: object ): object; + setOrigin( t: object, v: object ): void; + copyOrigin( t1: object, t2: object ): void; + setBasis( t: object, q: object ): void; + setBasisFromMatrix3( t: object, m: object ): void; + setOriginFromArray3( t: object, a: number[] ): void; + setOriginFromThreeVector3( t: object, v: Vector3 ): void; + setBasisFromArray3( t: object, a: number[] ): void; + setBasisFromThreeQuaternion( t: object, a: Quaternion ): void; + multiplyTransforms( t1: object, t2: object ): object; + inverseTransform( t: object ): object; + multiplyMatrices3( m1: object, m2: object ): object; + addVector3( v1: object, v2: object ): object; + dotVectors3( v1: object, v2: object ): number; + rowOfMatrix3( m: object, i: number ): object; + columnOfMatrix3( m: object, i: number ): object; + negativeVector3( v: object ): object; + multiplyMatrix3ByVector3( m: object, v: object ): object; + transposeMatrix3( m: object ): object; + quaternionToMatrix3( q: object ): object; + matrix3ToQuaternion( m: object ): object; + } -export class RigidBody{ - constructor(mesh: SkinnedMesh, world: object, params: object, manager: ResourceManager); - mesh: SkinnedMesh; - world: object; - params: object; - manager: ResourceManager; - - body: object; - bone: Bone; - boneOffsetForm: object; - boneOffsetFormInverse: object; - - reset(): this; - updateFromBone(): this; - updateBone(): this; +export class RigidBody { + + constructor( mesh: SkinnedMesh, world: object, params: object, manager: ResourceManager ); + mesh: SkinnedMesh; + world: object; + params: object; + manager: ResourceManager; + + body: object; + bone: Bone; + boneOffsetForm: object; + boneOffsetFormInverse: object; + + reset(): this; + updateFromBone(): this; + updateBone(): this; + } -export class Constraint{ - constructor(mesh: SkinnedMesh, world: object, bodyA: RigidBody, bodyB: RigidBody, params: object, manager: ResourceManager); +export class Constraint { + + constructor( mesh: SkinnedMesh, world: object, bodyA: RigidBody, bodyB: RigidBody, params: object, manager: ResourceManager ); } export class MMDPhysicsHelper extends Object3D { - constructor(); + + constructor(); + } diff --git a/examples/jsm/animation/TimelinerController.d.ts b/examples/jsm/animation/TimelinerController.d.ts index 8507f2fd2192c5e76cc0fa5a92ed66bc60588e70..09bc098ee27a9b0f11f76c4e15a46123db713ccf 100644 --- a/examples/jsm/animation/TimelinerController.d.ts +++ b/examples/jsm/animation/TimelinerController.d.ts @@ -1,20 +1,22 @@ import { - AnimationClip, - Scene, - Vector3 + AnimationClip, + Scene, + Vector3 } from '../../../src/Three'; -export class TimelinerController { - constructor(scene: Scene, trackInfo: object[], onUpdate: () => void); +export class TimelinerController { + + constructor( scene: Scene, trackInfo: object[], onUpdate: () => void ); + + delKeyframe( channelName: string, time: number ): void; + deserialize( structs: object ): void; + getChannelKeyTimes(): number[]; + getChannelNames(): string[]; + init(): void; + moveKeyframe( channelName: string, time: number, delta: number, moveRemaining: boolean ): void; + serialize(): object; + setDisplayTime( time: number ): void; + setDuration( duration: number ): void; + setKeyframe( channelName: string, time: number ): void; - delKeyframe(channelName: string, time: number): void; - deserialize(structs: object): void; - getChannelKeyTimes(): number[]; - getChannelNames(): string[]; - init(): void; - moveKeyframe(channelName: string, time: number, delta: number, moveRemaining: boolean): void; - serialize(): object; - setDisplayTime(time: number): void; - setDuration(duration: number): void; - setKeyframe(channelName: string, time: number): void; } diff --git a/examples/jsm/cameras/CinematicCamera.d.ts b/examples/jsm/cameras/CinematicCamera.d.ts index 305aa963f72099149c4f811e02b668c1464fd486..708b6b69beb86e542b2db4ca90aed1396b984e22 100644 --- a/examples/jsm/cameras/CinematicCamera.d.ts +++ b/examples/jsm/cameras/CinematicCamera.d.ts @@ -1,32 +1,33 @@ import { - PerspectiveCamera, - ShaderMaterial, - Scene, - WebGLRenderer + PerspectiveCamera, + ShaderMaterial, + Scene, + WebGLRenderer } from '../../../src/Three'; export class CinematicCamera extends PerspectiveCamera { - constructor(fov: number, aspect: number, near: number, far: number); - postprocessing: { - enabled: boolean; - }; - shaderSettings: { - rings: number; - samples: number; - }; - materialDepth: ShaderMaterial; - coc: number; - aperture: number; - fNumber: number; - hyperFocal: number; - filmGauge: number; + constructor( fov: number, aspect: number, near: number, far: number ); - linearize(depth: number): number; - smoothstep(near: number, far: number, depth: number): number; - saturate(x: number): number; - focusAt(focusDistance: number): void; - initPostProcessing(): void; - renderCinematic(scene: Scene, renderer: WebGLRenderer): void; + postprocessing: { + enabled: boolean; + }; + shaderSettings: { + rings: number; + samples: number; + }; + materialDepth: ShaderMaterial; + coc: number; + aperture: number; + fNumber: number; + hyperFocal: number; + filmGauge: number; + + linearize( depth: number ): number; + smoothstep( near: number, far: number, depth: number ): number; + saturate( x: number ): number; + focusAt( focusDistance: number ): void; + initPostProcessing(): void; + renderCinematic( scene: Scene, renderer: WebGLRenderer ): void; } diff --git a/examples/jsm/controls/DeviceOrientationControls.d.ts b/examples/jsm/controls/DeviceOrientationControls.d.ts index 56a855bff19f630edd89d40f130022b93e950a4a..451d61a196229d91fc0b8465a1206c93690054d4 100644 --- a/examples/jsm/controls/DeviceOrientationControls.d.ts +++ b/examples/jsm/controls/DeviceOrientationControls.d.ts @@ -1,22 +1,23 @@ import { - Camera + Camera } from '../../../src/Three'; export class DeviceOrientationControls { - constructor(object: Camera); - object: Camera; + constructor( object: Camera ); - // API + object: Camera; - alphaOffset: number; - deviceOrientation: any; - enabled: boolean; - screenOrientation: number; + // API - connect(): void; - disconnect(): void; - dispose(): void; - update(): void; + alphaOffset: number; + deviceOrientation: any; + enabled: boolean; + screenOrientation: number; + + connect(): void; + disconnect(): void; + dispose(): void; + update(): void; } diff --git a/examples/jsm/controls/DragControls.d.ts b/examples/jsm/controls/DragControls.d.ts index 69422374192e3580efa0264bb779c05f6b402209..f25b7a87762b918ac55e5e2bed19c3abc3352128 100644 --- a/examples/jsm/controls/DragControls.d.ts +++ b/examples/jsm/controls/DragControls.d.ts @@ -1,20 +1,21 @@ import { - Camera, - EventDispatcher, - Object3D + Camera, + EventDispatcher, + Object3D } from '../../../src/Three'; export class DragControls extends EventDispatcher { - constructor(objects: Object3D[], camera: Camera, domElement?: HTMLElement); - object: Camera; + constructor( objects: Object3D[], camera: Camera, domElement?: HTMLElement ); - // API + object: Camera; - enabled: boolean; + // API - activate(): void; - deactivate(): void; - dispose(): void; + enabled: boolean; + + activate(): void; + deactivate(): void; + dispose(): void; } diff --git a/examples/jsm/controls/FirstPersonControls.d.ts b/examples/jsm/controls/FirstPersonControls.d.ts index 7ad6791711ef807582f594e952af699c1f7e7970..6d64eb4a1e13a6481717ec56a21fb7491a7b8ce5 100644 --- a/examples/jsm/controls/FirstPersonControls.d.ts +++ b/examples/jsm/controls/FirstPersonControls.d.ts @@ -1,32 +1,33 @@ import { - Camera, - Vector3 + Camera, + Vector3 } from '../../../src/Three'; export class FirstPersonControls { - constructor(object: Camera, domElement?: HTMLElement); - object: Camera; - domElement: HTMLElement | HTMLDocument; + constructor( object: Camera, domElement?: HTMLElement ); - enabled: boolean; - movementSpeed: number; - lookSpeed: number; - lookVertical: boolean; - autoForward: boolean; - activeLook: boolean; - heightSpeed: boolean; - heightCoef: number; - heightMin: number; - heightMax: number; - constrainVertical: boolean; - verticalMin: number; - verticalMax: number; + object: Camera; + domElement: HTMLElement | HTMLDocument; + + enabled: boolean; + movementSpeed: number; + lookSpeed: number; + lookVertical: boolean; + autoForward: boolean; + activeLook: boolean; + heightSpeed: boolean; + heightCoef: number; + heightMin: number; + heightMax: number; + constrainVertical: boolean; + verticalMin: number; + verticalMax: number; mouseDragOn: boolean; - handleResize(): void; - lookAt(x: number | Vector3, y: number, z: number): this; - update(delta: number): this; - dispose(): void; + handleResize(): void; + lookAt( x: number | Vector3, y: number, z: number ): this; + update( delta: number ): this; + dispose(): void; } diff --git a/examples/jsm/controls/FlyControls.d.ts b/examples/jsm/controls/FlyControls.d.ts index d5ae400e9ba52778014a1508c69994c31476f1c6..f3101d243ed82da56c4cf595e2d647c37afec15e 100644 --- a/examples/jsm/controls/FlyControls.d.ts +++ b/examples/jsm/controls/FlyControls.d.ts @@ -1,19 +1,20 @@ import { - Camera + Camera } from '../../../src/Three'; export class FlyControls { - constructor(object: Camera, domElement?: HTMLElement); - object: Camera; - domElement: HTMLElement | HTMLDocument; + constructor( object: Camera, domElement?: HTMLElement ); - movementSpeed: number; - rollSpeed: number; - dragToLook: boolean; - autoForward: boolean; + object: Camera; + domElement: HTMLElement | HTMLDocument; - update(delta: number): void; - dispose(): void; + movementSpeed: number; + rollSpeed: number; + dragToLook: boolean; + autoForward: boolean; + + update( delta: number ): void; + dispose(): void; } diff --git a/examples/jsm/controls/OrbitControls.d.ts b/examples/jsm/controls/OrbitControls.d.ts index 31c5a1464009f6efb125ff99c61cea1d4fe04732..79b3f20fa39115ff0c225b25220140603629d338 100644 --- a/examples/jsm/controls/OrbitControls.d.ts +++ b/examples/jsm/controls/OrbitControls.d.ts @@ -1,7 +1,8 @@ import { Camera, MOUSE, Object3D, TOUCH, Vector3 } from '../../../src/Three'; export class OrbitControls { - constructor(object: Camera, domElement?: HTMLElement); + + constructor( object: Camera, domElement?: HTMLElement ); object: Camera; domElement: HTMLElement | HTMLDocument; @@ -44,23 +45,9 @@ export class OrbitControls { enableKeys: boolean; keys: { LEFT: number; UP: number; RIGHT: number; BOTTOM: number; }; - mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE; }; + mouseButtons: { LEFT: MOUSE; MIDDLE: MOUSE; RIGHT: MOUSE; }; touches: { ONE: TOUCH; TWO: TOUCH }; - rotateLeft(angle?: number): void; - - rotateUp(angle?: number): void; - - panLeft(distance?: number): void; - - panUp(distance?: number): void; - - pan(deltaX: number, deltaY: number): void; - - dollyIn(dollyScale: number): void; - - dollyOut(dollyScale: number): void; - update(): boolean; saveState(): void; @@ -74,15 +61,18 @@ export class OrbitControls { getAzimuthalAngle(): number; // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void): void; + addEventListener( type: string, listener: ( event: any ) => void ): void; + + hasEventListener( type: string, listener: ( event: any ) => void ): boolean; - hasEventListener(type: string, listener: (event: any) => void): boolean; + removeEventListener( type: string, listener: ( event: any ) => void ): void; - removeEventListener(type: string, listener: (event: any) => void): void; + dispatchEvent( event: { type: string; target: any; } ): void; - dispatchEvent(event: { type: string; target: any; }): void; } export class MapControls extends OrbitControls { - constructor(object: Camera, domElement?: HTMLElement); + + constructor( object: Camera, domElement?: HTMLElement ); + } diff --git a/examples/jsm/controls/PointerLockControls.d.ts b/examples/jsm/controls/PointerLockControls.d.ts index bf57c1840c518c72c714f32f41947c6b875cc440..2cb85d8fff415a76ad6a3b502c4cf7aa279b752d 100644 --- a/examples/jsm/controls/PointerLockControls.d.ts +++ b/examples/jsm/controls/PointerLockControls.d.ts @@ -1,26 +1,27 @@ import { - Camera, - EventDispatcher, - Vector3 + Camera, + EventDispatcher, + Vector3 } from '../../../src/Three'; export class PointerLockControls extends EventDispatcher { - constructor(camera: Camera, domElement?: HTMLElement); - domElement: HTMLElement; + constructor( camera: Camera, domElement?: HTMLElement ); - // API + domElement: HTMLElement; - isLocked: boolean; + // API - connect(): void; - disconnect(): void; - dispose(): void; - getObject(): Camera; - getDirection(v: Vector3): Vector3; - moveForward(distance: number): void; - moveRight(distance: number): void; - lock(): void; - unlock(): void; + isLocked: boolean; + + connect(): void; + disconnect(): void; + dispose(): void; + getObject(): Camera; + getDirection( v: Vector3 ): Vector3; + moveForward( distance: number ): void; + moveRight( distance: number ): void; + lock(): void; + unlock(): void; } diff --git a/examples/jsm/controls/TrackballControls.d.ts b/examples/jsm/controls/TrackballControls.d.ts index 01b33d424d6708a65336f60753ef54e9b34257b7..a3b597c028c4b5f2d18072f7fc956281c026cdce 100644 --- a/examples/jsm/controls/TrackballControls.d.ts +++ b/examples/jsm/controls/TrackballControls.d.ts @@ -1,45 +1,47 @@ import { Camera, EventDispatcher, Vector3 } from '../../../src/Three'; export class TrackballControls extends EventDispatcher { - constructor(object: Camera, domElement?: HTMLElement); - object: Camera; - domElement: HTMLElement; + constructor( object: Camera, domElement?: HTMLElement ); - // API - enabled: boolean; - screen: {left: number; top: number; width: number; height: number}; - rotateSpeed: number; - zoomSpeed: number; - panSpeed: number; - noRotate: boolean; - noZoom: boolean; - noPan: boolean; - noRoll: boolean; - staticMoving: boolean; - dynamicDampingFactor: number; - minDistance: number; - maxDistance: number; - keys: number[]; + object: Camera; + domElement: HTMLElement; - target: Vector3; - position0: Vector3; - target0: Vector3; - up0: Vector3; + // API + enabled: boolean; + screen: {left: number; top: number; width: number; height: number}; + rotateSpeed: number; + zoomSpeed: number; + panSpeed: number; + noRotate: boolean; + noZoom: boolean; + noPan: boolean; + noRoll: boolean; + staticMoving: boolean; + dynamicDampingFactor: number; + minDistance: number; + maxDistance: number; + keys: number[]; - update(): void; + target: Vector3; + position0: Vector3; + target0: Vector3; + up0: Vector3; - reset(): void; + update(): void; - dispose(): void; + reset(): void; - checkDistances(): void; + dispose(): void; - zoomCamera(): void; + checkDistances(): void; - panCamera(): void; + zoomCamera(): void; - rotateCamera(): void; + panCamera(): void; + + rotateCamera(): void; + + handleResize(): void; - handleResize(): void; } diff --git a/examples/jsm/controls/TransformControls.d.ts b/examples/jsm/controls/TransformControls.d.ts index 2aa9d237a450760c71914b9aa3d8b7e8e64b0291..c7cda291c4955b6ca82beb3711d851193d5afe44 100644 --- a/examples/jsm/controls/TransformControls.d.ts +++ b/examples/jsm/controls/TransformControls.d.ts @@ -1,46 +1,47 @@ import { - Object3D, - Camera, - Vector3, - Euler, - MOUSE + Object3D, + Camera, + Vector3, + Euler, + MOUSE } from '../../../src/Three'; export class TransformControls extends Object3D { - constructor(object: Camera, domElement?: HTMLElement); - domElement: HTMLElement; + constructor( object: Camera, domElement?: HTMLElement ); - // API + domElement: HTMLElement; - camera: Camera; - object: Object3D | undefined; - enabled: boolean; - axis: string | null; - mode: string; - translationSnap: number | null; - rotationSnap: number | null; - space: string; - size: number; - dragging: boolean; - showX: boolean; - showY: boolean; - showZ: boolean; - isTransformControls: boolean; - mouseButtons: { - LEFT: MOUSE; - MIDDLE: MOUSE; - RIGHT: MOUSE; - }; + // API - attach(object: Object3D): this; - detach(): this; - getMode(): string; - setMode(mode: string): void; - setTranslationSnap(translationSnap: Number | null): void; - setRotationSnap(rotationSnap: Number | null): void; - setSize(size: number): void; - setSpace(space: string): void; - dispose(): void; + camera: Camera; + object: Object3D | undefined; + enabled: boolean; + axis: string | null; + mode: string; + translationSnap: number | null; + rotationSnap: number | null; + space: string; + size: number; + dragging: boolean; + showX: boolean; + showY: boolean; + showZ: boolean; + isTransformControls: boolean; + mouseButtons: { + LEFT: MOUSE; + MIDDLE: MOUSE; + RIGHT: MOUSE; + }; + + attach( object: Object3D ): this; + detach(): this; + getMode(): string; + setMode( mode: string ): void; + setTranslationSnap( translationSnap: Number | null ): void; + setRotationSnap( rotationSnap: Number | null ): void; + setSize( size: number ): void; + setSpace( space: string ): void; + dispose(): void; } diff --git a/examples/jsm/curves/CurveExtras.d.ts b/examples/jsm/curves/CurveExtras.d.ts index 81067f4803216cffec13a0f566c979ec6230fd5f..344b3d837d80ae31394e405d8f05684f596f657e 100644 --- a/examples/jsm/curves/CurveExtras.d.ts +++ b/examples/jsm/curves/CurveExtras.d.ts @@ -1,76 +1,104 @@ import { - Curve, - Vector3 + Curve, + Vector3 } from '../../../src/Three'; export namespace Curves { - export class GrannyKnot extends Curve { - constructor(); - } - - export class HeartCurve extends Curve { - constructor(scale?: number); - scale: number; - } - - export class VivianiCurve extends Curve { - constructor(scale?: number); - scale: number; - } - - export class KnotCurve extends Curve { - constructor(); - } - - export class HelixCurve extends Curve { - constructor(); - } - - export class TrefoilKnot extends Curve { - constructor(scale?: number); - scale: number; - } - - export class TorusKnot extends Curve { - constructor(scale?: number); - scale: number; - } - - export class CinquefoilKnot extends Curve { - constructor(scale?: number); - scale: number; - } - - export class TrefoilPolynomialKnot extends Curve { - constructor(scale?: number); - scale: number; - } - - export class FigureEightPolynomialKnot extends Curve { - constructor(scale?: number); - scale: number; - } - - export class DecoratedTorusKnot4a extends Curve { - constructor(scale?: number); - scale: number; - } - - export class DecoratedTorusKnot4b extends Curve { - constructor(scale?: number); - scale: number; - } - - export class DecoratedTorusKnot5a extends Curve { - constructor(scale?: number); - scale: number; - } - - export class DecoratedTorusKnot5c extends Curve { - constructor(scale?: number); - scale: number; - } + export class GrannyKnot extends Curve { + + constructor(); + + } + + export class HeartCurve extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class VivianiCurve extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class KnotCurve extends Curve { + + constructor(); + + } + + export class HelixCurve extends Curve { + + constructor(); + + } + + export class TrefoilKnot extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class TorusKnot extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class CinquefoilKnot extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class TrefoilPolynomialKnot extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class FigureEightPolynomialKnot extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class DecoratedTorusKnot4a extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class DecoratedTorusKnot4b extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class DecoratedTorusKnot5a extends Curve { + + constructor( scale?: number ); + scale: number; + + } + + export class DecoratedTorusKnot5c extends Curve { + + constructor( scale?: number ); + scale: number; + + } } diff --git a/examples/jsm/curves/NURBSCurve.d.ts b/examples/jsm/curves/NURBSCurve.d.ts index 44ddefe5ebb4865c1107620d5a63d1e2393abc6c..64aa9c6285714dac685fcaa9a31284e010c0c1f5 100644 --- a/examples/jsm/curves/NURBSCurve.d.ts +++ b/examples/jsm/curves/NURBSCurve.d.ts @@ -1,10 +1,12 @@ import { - Curve, - Vector2, - Vector3, - Vector4 + Curve, + Vector2, + Vector3, + Vector4 } from '../../../src/Three'; export class NURBSCurve extends Curve { - constructor(degree: number, knots: number[], controlPoints: Vector2[] | Vector3[] | Vector4[], startKnot: number, endKnot: number); + + constructor( degree: number, knots: number[], controlPoints: Vector2[] | Vector3[] | Vector4[], startKnot: number, endKnot: number ); + } diff --git a/examples/jsm/curves/NURBSSurface.d.ts b/examples/jsm/curves/NURBSSurface.d.ts index b1edb7f283eba655bb1290b0854693d3f6fe1447..fbccdd4e54f48dec61676b73769471bd8e5aa0c3 100644 --- a/examples/jsm/curves/NURBSSurface.d.ts +++ b/examples/jsm/curves/NURBSSurface.d.ts @@ -1,11 +1,13 @@ import { - Vector2, - Vector3, - Vector4 + Vector2, + Vector3, + Vector4 } from '../../../src/Three'; export class NURBSSurface { - constructor(degree1: number, degree2: number, knots1: number[], knots2: number[], controlPoints: Vector2[][] | Vector3[][] | Vector4[][]); - getPoint(t1: number, t2: number, target: Vector3): void; + constructor( degree1: number, degree2: number, knots1: number[], knots2: number[], controlPoints: Vector2[][] | Vector3[][] | Vector4[][] ); + + getPoint( t1: number, t2: number, target: Vector3 ): void; + } diff --git a/examples/jsm/curves/NURBSUtils.d.ts b/examples/jsm/curves/NURBSUtils.d.ts index a1f47426c2d92bf5c7769ec0dee1eb81d3e7291a..80af0a236c2e263cbed042c559cb68b594093839 100644 --- a/examples/jsm/curves/NURBSUtils.d.ts +++ b/examples/jsm/curves/NURBSUtils.d.ts @@ -1,18 +1,18 @@ import { - Vector3, - Vector4 + Vector3, + Vector4 } from '../../../src/Three'; export namespace NURBSUtils { - export function findSpan(p: number, u: number, U: number[]): number; - export function calcBasisFunctions(span: number, u: number, p: number, U: number[]): number[]; - export function calcBSplinePoint(p: number, U: number[], P: Vector4[], u: number): Vector4; - export function calcBasisFunctionDerivatives(span: number,u: number, p: number, n: number, U: number[]): number[][]; - export function calcBSplineDerivatives(p: number, U: number[], P: Vector4[], u: number, nd: number): Vector4[]; - export function calcKoverI(k: number, i: number): number; - export function calcRationalCurveDerivatives(Pders: Vector4[]): Vector3[]; - export function calcNURBSDerivatives(p: number, U: number[], P: Vector4[], u: number, nd: number): Vector3[]; - export function calcSurfacePoint(p: number, q: number, U: number[], V: number[], P: Vector4[], u: number, v: number, target: Vector3): Vector3; + export function findSpan( p: number, u: number, U: number[] ): number; + export function calcBasisFunctions( span: number, u: number, p: number, U: number[] ): number[]; + export function calcBSplinePoint( p: number, U: number[], P: Vector4[], u: number ): Vector4; + export function calcBasisFunctionDerivatives( span: number, u: number, p: number, n: number, U: number[] ): number[][]; + export function calcBSplineDerivatives( p: number, U: number[], P: Vector4[], u: number, nd: number ): Vector4[]; + export function calcKoverI( k: number, i: number ): number; + export function calcRationalCurveDerivatives( Pders: Vector4[] ): Vector3[]; + export function calcNURBSDerivatives( p: number, U: number[], P: Vector4[], u: number, nd: number ): Vector3[]; + export function calcSurfacePoint( p: number, q: number, U: number[], V: number[], P: Vector4[], u: number, v: number, target: Vector3 ): Vector3; } diff --git a/examples/jsm/effects/AnaglyphEffect.d.ts b/examples/jsm/effects/AnaglyphEffect.d.ts index f9700d7b5c90e8240852e9fc77561f6ca168aac3..6c778def670b7838086e4f05ffd1796c5c4e261a 100644 --- a/examples/jsm/effects/AnaglyphEffect.d.ts +++ b/examples/jsm/effects/AnaglyphEffect.d.ts @@ -1,16 +1,18 @@ import { - Camera, - Matrix3, - Scene, - WebGLRenderer + Camera, + Matrix3, + Scene, + WebGLRenderer } from '../../../src/Three'; export class AnaglyphEffect { - constructor(renderer: WebGLRenderer, width?: number, height?: number); - colorMatrixLeft: Matrix3; - colorMatrixRight: Matrix3; - dispose(): void; - render(scene: Scene, camera: Camera): void; - setSize(width: number, height: number): void; + constructor( renderer: WebGLRenderer, width?: number, height?: number ); + colorMatrixLeft: Matrix3; + colorMatrixRight: Matrix3; + + dispose(): void; + render( scene: Scene, camera: Camera ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/effects/AsciiEffect.d.ts b/examples/jsm/effects/AsciiEffect.d.ts index a7a7cf176c69319189df5625fe98907a8161dab5..0c9bd0711eb328682819d23ceffc19119aa02bfe 100644 --- a/examples/jsm/effects/AsciiEffect.d.ts +++ b/examples/jsm/effects/AsciiEffect.d.ts @@ -1,22 +1,24 @@ import { - Camera, - Scene, - WebGLRenderer + Camera, + Scene, + WebGLRenderer } from '../../../src/Three'; export interface AsciiEffectOptions { - resolution?: number; - scale?: number; - color?: boolean; - alpha?: boolean; - block?: boolean; - invert?: boolean; + resolution?: number; + scale?: number; + color?: boolean; + alpha?: boolean; + block?: boolean; + invert?: boolean; } export class AsciiEffect { - constructor(renderer: WebGLRenderer, charSet?: string, options?: AsciiEffectOptions); - domElement: HTMLElement; - render(scene: Scene, camera: Camera): void; - setSize(width: number, height: number): void; + constructor( renderer: WebGLRenderer, charSet?: string, options?: AsciiEffectOptions ); + domElement: HTMLElement; + + render( scene: Scene, camera: Camera ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/effects/OutlineEffect.d.ts b/examples/jsm/effects/OutlineEffect.d.ts index d71c7627a59fbaaa1a6672e28f7cc0e9f23dd146..92d67a3a74d6fff676063ddb45c85943e6cc828c 100644 --- a/examples/jsm/effects/OutlineEffect.d.ts +++ b/examples/jsm/effects/OutlineEffect.d.ts @@ -1,36 +1,38 @@ import { - Camera, - Scene, - Vector2, - Vector4, - WebGLRenderer, - WebGLRenderTarget, - WebGLShadowMap + Camera, + Scene, + Vector2, + Vector4, + WebGLRenderer, + WebGLRenderTarget, + WebGLShadowMap } from '../../../src/Three'; export interface OutlineEffectParameters { - defaultThickness?: number; - defaultColor?: number[]; - defaultAlpha?: number; - defaultKeepAlive?: boolean; + defaultThickness?: number; + defaultColor?: number[]; + defaultAlpha?: number; + defaultKeepAlive?: boolean; } export class OutlineEffect { - constructor(renderer: WebGLRenderer, parameters: OutlineEffectParameters); - enabled: boolean; - autoClear: boolean; - domElement: HTMLElement; - shadowMap: WebGLShadowMap; - clear(color?: boolean, depth?: boolean, stencil?: boolean): void; - getPixelRatio(): number; - getSize(target: Vector2): Vector2; - render(scene: Scene, camera: Camera): void; - renderOutline(scene: Scene, camera: Camera): void; - setRenderTarget(renderTarget: WebGLRenderTarget | null): void; - setPixelRatio(value: number): void; - setScissor(x: Vector4 | number, y?: number, width?: number, height?: number): void; - setScissorTest(enable: boolean): void; - setSize(width: number, height: number, updateStyle?: boolean): void; - setViewport(x: Vector4 | number, y?: number, width?: number, height?: number): void; + constructor( renderer: WebGLRenderer, parameters: OutlineEffectParameters ); + enabled: boolean; + autoClear: boolean; + domElement: HTMLElement; + shadowMap: WebGLShadowMap; + + clear( color?: boolean, depth?: boolean, stencil?: boolean ): void; + getPixelRatio(): number; + getSize( target: Vector2 ): Vector2; + render( scene: Scene, camera: Camera ): void; + renderOutline( scene: Scene, camera: Camera ): void; + setRenderTarget( renderTarget: WebGLRenderTarget | null ): void; + setPixelRatio( value: number ): void; + setScissor( x: Vector4 | number, y?: number, width?: number, height?: number ): void; + setScissorTest( enable: boolean ): void; + setSize( width: number, height: number, updateStyle?: boolean ): void; + setViewport( x: Vector4 | number, y?: number, width?: number, height?: number ): void; + } diff --git a/examples/jsm/effects/ParallaxBarrierEffect.d.ts b/examples/jsm/effects/ParallaxBarrierEffect.d.ts index 547689e1aff6c5924193ef6d5d808167c907a4af..99f67eef8696064dbc9d787aa30b3d46b46c13d6 100644 --- a/examples/jsm/effects/ParallaxBarrierEffect.d.ts +++ b/examples/jsm/effects/ParallaxBarrierEffect.d.ts @@ -1,12 +1,14 @@ import { - Camera, - Scene, - WebGLRenderer + Camera, + Scene, + WebGLRenderer } from '../../../src/Three'; export class ParallaxBarrierEffect { - constructor(renderer: WebGLRenderer); - render(scene: Scene, camera: Camera): void; - setSize(width: number, height: number): void; + constructor( renderer: WebGLRenderer ); + + render( scene: Scene, camera: Camera ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/effects/PeppersGhostEffect.d.ts b/examples/jsm/effects/PeppersGhostEffect.d.ts index 608310d70efffc338a164a57e06e008e75991618..be37dab18d854bc06172e5f884170c4592ab8a14 100644 --- a/examples/jsm/effects/PeppersGhostEffect.d.ts +++ b/examples/jsm/effects/PeppersGhostEffect.d.ts @@ -1,14 +1,16 @@ import { - Camera, - Scene, - WebGLRenderer + Camera, + Scene, + WebGLRenderer } from '../../../src/Three'; export class PeppersGhostEffect { - constructor(renderer: WebGLRenderer); - cameraDistance: number; - reflectFromAbove: boolean; - render(scene: Scene, camera: Camera): void; - setSize(width: number, height: number): void; + constructor( renderer: WebGLRenderer ); + cameraDistance: number; + reflectFromAbove: boolean; + + render( scene: Scene, camera: Camera ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/effects/StereoEffect.d.ts b/examples/jsm/effects/StereoEffect.d.ts index 46aa39157e2d3f6aafd1b9b3e38c2ccb93335f57..cf6654f94a291b29c910e20fd4173130690ba96d 100644 --- a/examples/jsm/effects/StereoEffect.d.ts +++ b/examples/jsm/effects/StereoEffect.d.ts @@ -1,13 +1,15 @@ import { - Camera, - Scene, - WebGLRenderer + Camera, + Scene, + WebGLRenderer } from '../../../src/Three'; export class StereoEffect { - constructor(renderer: WebGLRenderer); - setEyeSeparation(eyeSep: number): void; - render(scene: Scene, camera: Camera): void; - setSize(width: number, height: number): void; + constructor( renderer: WebGLRenderer ); + + setEyeSeparation( eyeSep: number ): void; + render( scene: Scene, camera: Camera ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/exporters/ColladaExporter.d.ts b/examples/jsm/exporters/ColladaExporter.d.ts index 699e58815854677f24f6d5318d724a8a344df279..6c17f94e9313b6053e5170b3a45d5a9f063ae4a1 100644 --- a/examples/jsm/exporters/ColladaExporter.d.ts +++ b/examples/jsm/exporters/ColladaExporter.d.ts @@ -1,18 +1,20 @@ import { Object3D } from '../../../src/Three'; export interface ColladaExporterOptions { - author?: string; - textureDirectory?: string; - version?: string; + author?: string; + textureDirectory?: string; + version?: string; } export interface ColladaExporterResult { - data: string; - textures: object[]; + data: string; + textures: object[]; } export class ColladaExporter { - constructor(); - - parse(object: Object3D, onDone: (res: ColladaExporterResult) => void, options: ColladaExporterOptions): ColladaExporterResult | null; + + constructor(); + + parse( object: Object3D, onDone: ( res: ColladaExporterResult ) => void, options: ColladaExporterOptions ): ColladaExporterResult | null; + } diff --git a/examples/jsm/exporters/DRACOExporter.d.ts b/examples/jsm/exporters/DRACOExporter.d.ts index 57ac2f044b4f2331454ec204b7baba72a3038fd3..8cb4eaaccb416c22a674080c7b56db2a849bceac 100644 --- a/examples/jsm/exporters/DRACOExporter.d.ts +++ b/examples/jsm/exporters/DRACOExporter.d.ts @@ -1,20 +1,22 @@ import { - BufferGeometry, - Geometry + BufferGeometry, + Geometry } from '../../../src/Three'; export interface DRACOExporterOptions { - decodeSpeed?: number; - encodeSpeed?: number; - encoderMethod?: number; - quantization?: number[]; - exportUvs?: boolean; - exportNormals?: boolean; - exportColor?: boolean; + decodeSpeed?: number; + encodeSpeed?: number; + encoderMethod?: number; + quantization?: number[]; + exportUvs?: boolean; + exportNormals?: boolean; + exportColor?: boolean; } export class DRACOExporter { - constructor(); - parse(geometry: BufferGeometry | Geometry, options: DRACOExporterOptions): Int8Array; + constructor(); + + parse( geometry: BufferGeometry | Geometry, options: DRACOExporterOptions ): Int8Array; + } diff --git a/examples/jsm/exporters/GLTFExporter.d.ts b/examples/jsm/exporters/GLTFExporter.d.ts index 1b33cda35a2f1e0498b512fbef3bc604209a67ef..8229511b403d9a7f7da72480c90ee057d9f2be4a 100644 --- a/examples/jsm/exporters/GLTFExporter.d.ts +++ b/examples/jsm/exporters/GLTFExporter.d.ts @@ -1,22 +1,24 @@ import { - Object3D, - AnimationClip + Object3D, + AnimationClip } from '../../../src/Three'; export interface GLTFExporterOptions { - binary?: boolean; - trs?: boolean; - onlyVisible?: boolean; - truncateDrawRange?: boolean; - embedImages?: boolean; - animations?: AnimationClip[]; - forceIndices?: boolean; - forcePowerOfTwoTextures?: boolean; - includeCustomExtensions?: boolean; + binary?: boolean; + trs?: boolean; + onlyVisible?: boolean; + truncateDrawRange?: boolean; + embedImages?: boolean; + animations?: AnimationClip[]; + forceIndices?: boolean; + forcePowerOfTwoTextures?: boolean; + includeCustomExtensions?: boolean; } export class GLTFExporter { - constructor(); - parse(input: Object3D, onCompleted: (gltf: object) => void, options: GLTFExporterOptions): void; + constructor(); + + parse( input: Object3D, onCompleted: ( gltf: object ) => void, options: GLTFExporterOptions ): void; + } diff --git a/examples/jsm/exporters/GLTFExporter.js b/examples/jsm/exporters/GLTFExporter.js index bf7e265e780847ec873cb329cb91fc1f833f4ec5..f0273f40974e0225a3948c7b85a0d50c62af0b66 100644 --- a/examples/jsm/exporters/GLTFExporter.js +++ b/examples/jsm/exporters/GLTFExporter.js @@ -102,6 +102,7 @@ GLTFExporter.prototype = { onlyVisible: true, truncateDrawRange: true, embedImages: true, + maxTextureSize: Infinity, animations: [], forceIndices: false, forcePowerOfTwoTextures: false, @@ -775,10 +776,10 @@ GLTFExporter.prototype = { var canvas = cachedCanvas = cachedCanvas || document.createElement( 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; + canvas.width = Math.min( image.width, options.maxTextureSize ); + canvas.height = Math.min( image.height, options.maxTextureSize ); - if ( options.forcePowerOfTwoTextures && ! isPowerOfTwo( image ) ) { + if ( options.forcePowerOfTwoTextures && ! isPowerOfTwo( canvas ) ) { console.warn( 'GLTFExporter: Resized non-power-of-two image.', image ); diff --git a/examples/jsm/exporters/MMDExporter.d.ts b/examples/jsm/exporters/MMDExporter.d.ts index 5db40cffc0c3c84c37ec2684a53e328b39c72a94..9c0ad870f5cb6d57ebcedefeb9d7b4501a9fb07c 100644 --- a/examples/jsm/exporters/MMDExporter.d.ts +++ b/examples/jsm/exporters/MMDExporter.d.ts @@ -1,7 +1,9 @@ import { Object3D } from '../../../src/Three'; export class MMDExporter { + constructor(); - parseVpd(skin: Object3D, outputShiftJis: boolean, useOriginalBones: boolean): [] | Uint8Array + parseVpd( skin: Object3D, outputShiftJis: boolean, useOriginalBones: boolean ): [] | Uint8Array + } diff --git a/examples/jsm/exporters/OBJExporter.d.ts b/examples/jsm/exporters/OBJExporter.d.ts index 1f5efa6529d2c918351ae3bbb0aa41e8fbf469f6..7cf476ebee2ec1ee4cbcdf335b76d0630cfb1ff7 100644 --- a/examples/jsm/exporters/OBJExporter.d.ts +++ b/examples/jsm/exporters/OBJExporter.d.ts @@ -1,7 +1,9 @@ import { Object3D } from '../../../src/Three'; export class OBJExporter { + constructor(); - parse(object: Object3D): string; + parse( object: Object3D ): string; + } diff --git a/examples/jsm/exporters/PLYExporter.d.ts b/examples/jsm/exporters/PLYExporter.d.ts index 709e2e79164fbf225de859e740e5484beffa6b21..a81d917edb3c52785fe2f3017bc426829c5694f9 100644 --- a/examples/jsm/exporters/PLYExporter.d.ts +++ b/examples/jsm/exporters/PLYExporter.d.ts @@ -1,12 +1,14 @@ import { Object3D } from '../../../src/Three'; export interface PLYExporterOptions { - binary?: boolean; - excludeAttributes?: string[]; + binary?: boolean; + excludeAttributes?: string[]; } export class PLYExporter { - constructor(); - parse(object: Object3D, onDone: (res: string) => void, options: PLYExporterOptions): string | null; + constructor(); + + parse( object: Object3D, onDone: ( res: string ) => void, options: PLYExporterOptions ): string | null; + } diff --git a/examples/jsm/exporters/STLExporter.d.ts b/examples/jsm/exporters/STLExporter.d.ts index 5bf202358cd34ccf2c59f723076d76f787fecbd9..c57563662c7b87dcfb9080ca48bd48cd3008a237 100644 --- a/examples/jsm/exporters/STLExporter.d.ts +++ b/examples/jsm/exporters/STLExporter.d.ts @@ -1,11 +1,13 @@ import { Object3D } from '../../../src/Three'; export interface STLExporterOptions { - binary?: boolean; + binary?: boolean; } export class STLExporter { - constructor(); - parse(scene: Object3D, options?: STLExporterOptions): string; + constructor(); + + parse( scene: Object3D, options?: STLExporterOptions ): string; + } diff --git a/examples/jsm/exporters/TypedGeometryExporter.d.ts b/examples/jsm/exporters/TypedGeometryExporter.d.ts index 688d4d1bf4d853ec6f52e7e0676379488f072036..03f036541dd837b12791cb5d6bb85c81d6d84d2f 100644 --- a/examples/jsm/exporters/TypedGeometryExporter.d.ts +++ b/examples/jsm/exporters/TypedGeometryExporter.d.ts @@ -1,7 +1,9 @@ import { Object3D } from '../../../src/Three'; export class TypedGeometryExporterD { + constructor(); - parse(scene: Object3D, options: {}): DataView | string; + parse( scene: Object3D, options: {} ): DataView | string; + } diff --git a/examples/jsm/geometries/BoxLineGeometry.d.ts b/examples/jsm/geometries/BoxLineGeometry.d.ts index b5c3a0f8544d664e04b94945251caebbf06894d3..b99fde36ba921cced7b3cbb65bab5e6da0acc49a 100644 --- a/examples/jsm/geometries/BoxLineGeometry.d.ts +++ b/examples/jsm/geometries/BoxLineGeometry.d.ts @@ -1,7 +1,9 @@ import { - BufferGeometry + BufferGeometry } from '../../../src/Three'; export class BoxLineGeometry extends BufferGeometry { - constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); + + constructor( width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number ); + } diff --git a/examples/jsm/geometries/ConvexGeometry.d.ts b/examples/jsm/geometries/ConvexGeometry.d.ts index fe9f4e647a7360ea183100d71087a07931943f32..45da3bef431c5160ee159db2792e5525ea8e16fd 100644 --- a/examples/jsm/geometries/ConvexGeometry.d.ts +++ b/examples/jsm/geometries/ConvexGeometry.d.ts @@ -1,13 +1,17 @@ import { - BufferGeometry, - Geometry, - Vector3 + BufferGeometry, + Geometry, + Vector3 } from '../../../src/Three'; export class ConvexGeometry extends Geometry { - constructor(points: Vector3[]); + + constructor( points: Vector3[] ); + } export class ConvexBufferGeometry extends BufferGeometry { - constructor(points: Vector3[]); + + constructor( points: Vector3[] ); + } diff --git a/examples/jsm/geometries/DecalGeometry.d.ts b/examples/jsm/geometries/DecalGeometry.d.ts index eb9197abbe8081812baeab16cd9f8fe57b820453..9259f9fdcddb258e672c766c994d4eb099d9adcd 100644 --- a/examples/jsm/geometries/DecalGeometry.d.ts +++ b/examples/jsm/geometries/DecalGeometry.d.ts @@ -1,15 +1,19 @@ import { - BufferGeometry, - Euler, - Mesh, - Vector3 + BufferGeometry, + Euler, + Mesh, + Vector3 } from '../../../src/Three'; export class DecalGeometry extends BufferGeometry { - constructor(mesh: Mesh, position: Vector3, orientation: Euler, size: Vector3); + + constructor( mesh: Mesh, position: Vector3, orientation: Euler, size: Vector3 ); + } export class DecalVertex { - constructor(position: Vector3, normal: Vector3); - clone(): DecalVertex; + + constructor( position: Vector3, normal: Vector3 ); + clone(): DecalVertex; + } diff --git a/examples/jsm/geometries/LightningStrike.d.ts b/examples/jsm/geometries/LightningStrike.d.ts index dd4bd3cfaab07bf9c11bda520901918960fbb9f0..dd57efc4ef949b7adaff9867f2cdb58750c73d01 100644 --- a/examples/jsm/geometries/LightningStrike.d.ts +++ b/examples/jsm/geometries/LightningStrike.d.ts @@ -1,105 +1,107 @@ import { - Vector3 + Vector3 } from '../../../src/Three'; export interface RandomGenerator { - random(): number; - getSeed(): number; - setSeed(seed: number): void; + random(): number; + getSeed(): number; + setSeed( seed: number ): void; } export interface LightningSegment { - iteration: number; - pos0: Vector3; - pos1: Vector3; - linPos0: Vector3; - linPos1: Vector3; - up0: Vector3; - up1: Vector3; - radius0: number; - radius1: number; - fraction0: number; - fraction1: number; - positionVariationFactor: number; + iteration: number; + pos0: Vector3; + pos1: Vector3; + linPos0: Vector3; + linPos1: Vector3; + up0: Vector3; + up1: Vector3; + radius0: number; + radius1: number; + fraction0: number; + fraction1: number; + positionVariationFactor: number; } export interface LightningSubray { - seed: number; - maxIterations: number; - recursion: number; - pos0: Vector3; - pos1: Vector3; - linPos0: Vector3; - linPos1: Vector3; - up0: Vector3; - up1: Vector3; - radius0: number; - radius1: number; - birthTime: number; - deathTime: number; - timeScale: number; - roughness: number; - straightness: number; - propagationTimeFactor: number; - vanishingTimeFactor: number; - endPropagationTime: number; - beginVanishingTime: number; + seed: number; + maxIterations: number; + recursion: number; + pos0: Vector3; + pos1: Vector3; + linPos0: Vector3; + linPos1: Vector3; + up0: Vector3; + up1: Vector3; + radius0: number; + radius1: number; + birthTime: number; + deathTime: number; + timeScale: number; + roughness: number; + straightness: number; + propagationTimeFactor: number; + vanishingTimeFactor: number; + endPropagationTime: number; + beginVanishingTime: number; } export interface RayParameters { - sourceOffset?: Vector3; - destOffset?: Vector3; - - timeScale?: number; - roughness?: number; - straightness?: number; - - up0?: Vector3; - up1?: Vector3; - radius0?: number; - radius1?: number; - radius0Factor? : number; - radius1Factor? : number; - minRadius? : number; - - isEternal?: boolean; - birthTime?: number; - deathTime?: number; - propagationTimeFactor?: number; - vanishingTimeFactor?: number; - subrayPeriod?: number; - subrayDutyCycle?: number; - - maxIterations?: number; - isStatic?: boolean; - ramification?: number; - maxSubrayRecursion?: number; - recursionProbability?: number; - generateUVs?: boolean; - - randomGenerator?: RandomGenerator; - noiseSeed?: number; - - onDecideSubrayCreation?: (segment: LightningSegment, lightningStrike: LightningStrike) => void; - onSubrayCreation?: (segment: LightningSegment, parentSubray: LightningSubray, childSubray: LightningSubray, lightningStrike: LightningStrike) => void; + sourceOffset?: Vector3; + destOffset?: Vector3; + + timeScale?: number; + roughness?: number; + straightness?: number; + + up0?: Vector3; + up1?: Vector3; + radius0?: number; + radius1?: number; + radius0Factor? : number; + radius1Factor? : number; + minRadius? : number; + + isEternal?: boolean; + birthTime?: number; + deathTime?: number; + propagationTimeFactor?: number; + vanishingTimeFactor?: number; + subrayPeriod?: number; + subrayDutyCycle?: number; + + maxIterations?: number; + isStatic?: boolean; + ramification?: number; + maxSubrayRecursion?: number; + recursionProbability?: number; + generateUVs?: boolean; + + randomGenerator?: RandomGenerator; + noiseSeed?: number; + + onDecideSubrayCreation?: ( segment: LightningSegment, lightningStrike: LightningStrike ) => void; + onSubrayCreation?: ( segment: LightningSegment, parentSubray: LightningSubray, childSubray: LightningSubray, lightningStrike: LightningStrike ) => void; } export class LightningStrike { - constructor(rayParameters?: RayParameters); - copyParameters( dest?: RayParameters, source?: RayParameters): RayParameters; - // Ray states - static readonly RAY_INITIALIZED: number; - static readonly RAY_UNBORN: number; - static readonly RAY_PROPAGATING: number; - static readonly RAY_STEADY: number; - static readonly RAY_VANISHING: number; - static readonly RAY_EXTINGUISHED: number; + constructor( rayParameters?: RayParameters ); + copyParameters( dest?: RayParameters, source?: RayParameters ): RayParameters; + + // Ray states + static readonly RAY_INITIALIZED: number; + static readonly RAY_UNBORN: number; + static readonly RAY_PROPAGATING: number; + static readonly RAY_STEADY: number; + static readonly RAY_VANISHING: number; + static readonly RAY_EXTINGUISHED: number; + + state: number; - state: number; + update( time: number ): void; - update(time: number): void; + copy( source: LightningStrike ): LightningStrike; + clone(): LightningStrike; - copy(source: LightningStrike): LightningStrike; - clone(): LightningStrike; } diff --git a/examples/jsm/geometries/ParametricGeometries.d.ts b/examples/jsm/geometries/ParametricGeometries.d.ts index beef733cf569ce434749b2d4db29cddc6bd835f6..c9368775a82e2d144128b21a806370a3e37d3d04 100644 --- a/examples/jsm/geometries/ParametricGeometries.d.ts +++ b/examples/jsm/geometries/ParametricGeometries.d.ts @@ -1,27 +1,35 @@ import { - Curve, - Vector3 + Curve, + Vector3 } from '../../../src/Three'; -export namespace ParametricGeometries { - export function klein(v: number, u: number, target: Vector3): Vector3; - export function plane(width: number, height: number, target: Vector3): Vector3; - export function mobius(u: number, t: number, target: Vector3): Vector3; - export function mobius3d(u: number, t: number, target: Vector3): Vector3; +export namespace ParametricGeometries { + export function klein( v: number, u: number, target: Vector3 ): Vector3; + export function plane( width: number, height: number, target: Vector3 ): Vector3; + export function mobius( u: number, t: number, target: Vector3 ): Vector3; + export function mobius3d( u: number, t: number, target: Vector3 ): Vector3; - export class TubeGeometry { - constructor(path: Curve, segments?: number, radius?: number, segmentsRadius?: number, closed?: boolean, debug?: boolean); - } + export class TubeGeometry { - export class TorusKnotGeometry { - constructor(radius?: number, tube?: number, segmentsT?: number, segmentsR?: number, p?: number, q?: number); - } + constructor( path: Curve, segments?: number, radius?: number, segmentsRadius?: number, closed?: boolean, debug?: boolean ); - export class SphereGeometry { - constructor(size: number, u: number, v); - } + } - export class PlaneGeometry { - constructor(width: number, depth: number, segmentsWidth: number, segmentsDepth: number); - } + export class TorusKnotGeometry { + + constructor( radius?: number, tube?: number, segmentsT?: number, segmentsR?: number, p?: number, q?: number ); + + } + + export class SphereGeometry { + + constructor( size: number, u: number, v ); + + } + + export class PlaneGeometry { + + constructor( width: number, depth: number, segmentsWidth: number, segmentsDepth: number ); + + } } diff --git a/examples/jsm/geometries/TeapotBufferGeometry.d.ts b/examples/jsm/geometries/TeapotBufferGeometry.d.ts index 3f07a624daf26b4970755c0650d03831951dab62..09d3faad3c97a2af3f8d1a6509c1511e30d8a170 100644 --- a/examples/jsm/geometries/TeapotBufferGeometry.d.ts +++ b/examples/jsm/geometries/TeapotBufferGeometry.d.ts @@ -1,7 +1,9 @@ import { - BufferGeometry + BufferGeometry } from '../../../src/Three'; export class TeapotBufferGeometry extends BufferGeometry { - constructor(size?: number, segments?: number, bottom?: boolean, lid?: boolean, body?: boolean, fitLid?: boolean, blinn?: number); + + constructor( size?: number, segments?: number, bottom?: boolean, lid?: boolean, body?: boolean, fitLid?: boolean, blinn?: number ); + } diff --git a/examples/jsm/interactive/SelectionBox.d.ts b/examples/jsm/interactive/SelectionBox.d.ts index 8ae57d60664fcf111ed4819bb8b5cac05dbb1847..8169a55f770e9cd0f90e584b081bf39435682cdf 100644 --- a/examples/jsm/interactive/SelectionBox.d.ts +++ b/examples/jsm/interactive/SelectionBox.d.ts @@ -1,22 +1,24 @@ import { - Camera, - Frustum, - Mesh, - Object3D, - Scene, - Vector3 + Camera, + Frustum, + Mesh, + Object3D, + Scene, + Vector3 } from '../../../src/Three'; -export class SelectionBox { - constructor(camera: Camera, scene: Scene, deep?: number); - camera: Camera; - collection: Mesh[]; - deep: number; - endPoint: Vector3; - scene: Scene; - startPoint: Vector3; +export class SelectionBox { + + constructor( camera: Camera, scene: Scene, deep?: number ); + camera: Camera; + collection: Mesh[]; + deep: number; + endPoint: Vector3; + scene: Scene; + startPoint: Vector3; + + select( startPoint: Vector3, endPoint: Vector3 ): Mesh[]; + updateFrustum( startPoint: Vector3, endPoint: Vector3 ): void; + searchChildInFrustum( frustum: Frustum, object: Object3D ): void; - select(startPoint: Vector3, endPoint: Vector3): Mesh[]; - updateFrustum(startPoint: Vector3, endPoint: Vector3): void; - searchChildInFrustum(frustum: Frustum, object: Object3D): void; } diff --git a/examples/jsm/interactive/SelectionHelper.d.ts b/examples/jsm/interactive/SelectionHelper.d.ts index e0e9d5df6bc674fc8b4eb1ba2cd5842367bf7c1d..338e4112990edc7207687d2230711f5757a7b30c 100644 --- a/examples/jsm/interactive/SelectionHelper.d.ts +++ b/examples/jsm/interactive/SelectionHelper.d.ts @@ -1,20 +1,22 @@ import { - WebGLRenderer, - Vector2 + WebGLRenderer, + Vector2 } from '../../../src/Three'; import { SelectionBox } from './SelectionBox'; export class SelectionHelper { - constructor(selectionBox: SelectionBox, renderer: WebGLRenderer, cssClassName: string); - element: HTMLElement; - isDown: boolean; - pointBottomRight: Vector2; - pointTopLeft: Vector2; - renderer: WebGLRenderer; - startPoint: Vector2; - onSelectStart(event: Event): void; - onSelectMove(event: Event): void; - onSelectOver(event: Event): void; + constructor( selectionBox: SelectionBox, renderer: WebGLRenderer, cssClassName: string ); + element: HTMLElement; + isDown: boolean; + pointBottomRight: Vector2; + pointTopLeft: Vector2; + renderer: WebGLRenderer; + startPoint: Vector2; + + onSelectStart( event: Event ): void; + onSelectMove( event: Event ): void; + onSelectOver( event: Event ): void; + } diff --git a/examples/jsm/lights/LightProbeGenerator.d.ts b/examples/jsm/lights/LightProbeGenerator.d.ts index ec4aad96e080c411b4f1e8c74c38c846cced15bc..802fd44d8c2b905e0a253a0c6d3debcaeba4682e 100644 --- a/examples/jsm/lights/LightProbeGenerator.d.ts +++ b/examples/jsm/lights/LightProbeGenerator.d.ts @@ -1,10 +1,10 @@ import { - CubeTexture, - LightProbe + CubeTexture, + LightProbe } from '../../../src/Three'; export namespace LightProbeGenerator { - export function fromCubeTexture(cubeTexture: CubeTexture): LightProbe; + export function fromCubeTexture( cubeTexture: CubeTexture ): LightProbe; } diff --git a/examples/jsm/lights/RectAreaLightUniformsLib.d.ts b/examples/jsm/lights/RectAreaLightUniformsLib.d.ts index 1638320c6fa0bf8a144b5a51e2f7ad3cda762c76..e188d403604a627d1d01789e5c2a4a87dd81ee30 100644 --- a/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +++ b/examples/jsm/lights/RectAreaLightUniformsLib.d.ts @@ -1,5 +1,5 @@ export namespace RectAreaLightUniformsLib { - export function init(): void; + export function init(): void; } diff --git a/examples/jsm/lines/Line2.d.ts b/examples/jsm/lines/Line2.d.ts index 5b3316c8fdb49a320a676b094ba6d87c2b5710dd..6ae38e818659ccd33b14665b0b94debe6fe77ab9 100644 --- a/examples/jsm/lines/Line2.d.ts +++ b/examples/jsm/lines/Line2.d.ts @@ -3,6 +3,8 @@ import { LineSegments2 } from './LineSegments2'; import { LineMaterial } from './LineMaterial'; export class Line2 extends LineSegments2 { - constructor(geometry?: LineGeometry, material?: LineMaterial); - isLine2: boolean; + + constructor( geometry?: LineGeometry, material?: LineMaterial ); + isLine2: boolean; + } diff --git a/examples/jsm/lines/LineGeometry.d.ts b/examples/jsm/lines/LineGeometry.d.ts index 27cce47092d4025742fe589f83d63deec6ac5fd7..2c9a99e5a9ae94d746aa7653ce1c371f9eb3fdaf 100644 --- a/examples/jsm/lines/LineGeometry.d.ts +++ b/examples/jsm/lines/LineGeometry.d.ts @@ -1,12 +1,14 @@ import { - Line + Line } from '../../../src/Three'; import { LineSegmentsGeometry } from './LineSegmentsGeometry'; export class LineGeometry extends LineSegmentsGeometry { - constructor(); - isLineGeometry: boolean; - fromLine(line: Line): this; + constructor(); + isLineGeometry: boolean; + + fromLine( line: Line ): this; + } diff --git a/examples/jsm/lines/LineMaterial.d.ts b/examples/jsm/lines/LineMaterial.d.ts index 73cfa158733aa75d1836ebf03c4231edfa633355..4ee2d4339fb681a9e0b95448f50ddd136b243177 100644 --- a/examples/jsm/lines/LineMaterial.d.ts +++ b/examples/jsm/lines/LineMaterial.d.ts @@ -1,28 +1,30 @@ import { - Color, - MaterialParameters, - ShaderMaterial, - Vector2 + Color, + MaterialParameters, + ShaderMaterial, + Vector2 } from '../../../src/Three'; export interface LineMaterialParameters extends MaterialParameters { - color?: number; - dashed?: boolean; - dashScale?: number; - dashSize?: number; - gapSize?: number; - linewidth?: number; - resolution?: Vector2; + color?: number; + dashed?: boolean; + dashScale?: number; + dashSize?: number; + gapSize?: number; + linewidth?: number; + resolution?: Vector2; } export class LineMaterial extends ShaderMaterial { - constructor(parameters?: LineMaterialParameters); - color: Color; - dashed: boolean; - dashScale: number; - dashSize: number; - gapSize: number; - isLineMaterial: boolean; - linewidth: number; - resolution: Vector2; + + constructor( parameters?: LineMaterialParameters ); + color: Color; + dashed: boolean; + dashScale: number; + dashSize: number; + gapSize: number; + isLineMaterial: boolean; + linewidth: number; + resolution: Vector2; + } diff --git a/examples/jsm/lines/LineSegments2.d.ts b/examples/jsm/lines/LineSegments2.d.ts index f6b8b9166318da024c4064afd4348641169f4f71..433ef3518821eb9a5f0389c4c4a41a2b677ed229 100644 --- a/examples/jsm/lines/LineSegments2.d.ts +++ b/examples/jsm/lines/LineSegments2.d.ts @@ -1,13 +1,15 @@ import { - Mesh, + Mesh, } from '../../../src/Three'; import { LineMaterial } from './LineMaterial'; import { LineSegmentsGeometry } from './LineSegmentsGeometry'; export class LineSegments2 extends Mesh { - constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); - isLineSegments2: boolean; - computeLineDistances(): this; + constructor( geometry?: LineSegmentsGeometry, material?: LineMaterial ); + isLineSegments2: boolean; + + computeLineDistances(): this; + } diff --git a/examples/jsm/lines/LineSegmentsGeometry.d.ts b/examples/jsm/lines/LineSegmentsGeometry.d.ts index 4c90fa4ea16185321eecdcadae453c3721e8045a..ce00245b6665f5faf751d9a7d08a2f590897e63b 100644 --- a/examples/jsm/lines/LineSegmentsGeometry.d.ts +++ b/examples/jsm/lines/LineSegmentsGeometry.d.ts @@ -1,23 +1,25 @@ import { - EdgesGeometry, - InstancedBufferGeometry, - LineSegments, - Matrix4, - Mesh, - WireframeGeometry + EdgesGeometry, + InstancedBufferGeometry, + LineSegments, + Matrix4, + Mesh, + WireframeGeometry } from '../../../src/Three'; export class LineSegmentsGeometry extends InstancedBufferGeometry { - constructor(); - isLineSegmentsGeometry: boolean; - applyMatrix(matrix: Matrix4): this; - computeBoundingBox(): void; - computeBoundingSphere(): void; - fromEdgesGeometry(geometry: WireframeGeometry): this; - fromLineSegements(lineSegments: LineSegments): this; - fromMesh(mesh: Mesh): this; - fromWireframeGeometry(geometry: EdgesGeometry): this; - setColors(array: number[] | Float32Array): this; - setPositions(array: number[] | Float32Array): this; + constructor(); + isLineSegmentsGeometry: boolean; + + applyMatrix( matrix: Matrix4 ): this; + computeBoundingBox(): void; + computeBoundingSphere(): void; + fromEdgesGeometry( geometry: WireframeGeometry ): this; + fromLineSegements( lineSegments: LineSegments ): this; + fromMesh( mesh: Mesh ): this; + fromWireframeGeometry( geometry: EdgesGeometry ): this; + setColors( array: number[] | Float32Array ): this; + setPositions( array: number[] | Float32Array ): this; + } diff --git a/examples/jsm/lines/Wireframe.d.ts b/examples/jsm/lines/Wireframe.d.ts index a1644fb67cf7c10195fc7ae9169e57da55ee7c68..6edc52f3c347bad90f661878c86816acb52b465a 100644 --- a/examples/jsm/lines/Wireframe.d.ts +++ b/examples/jsm/lines/Wireframe.d.ts @@ -1,13 +1,15 @@ import { - Mesh, + Mesh, } from '../../../src/Three'; import { LineMaterial } from './LineMaterial'; import { LineSegmentsGeometry } from './LineSegmentsGeometry'; export class Wireframe extends Mesh { - constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); - isWireframe: boolean; - computeLineDistances(): this; + constructor( geometry?: LineSegmentsGeometry, material?: LineMaterial ); + isWireframe: boolean; + + computeLineDistances(): this; + } diff --git a/examples/jsm/lines/WireframeGeometry2.d.ts b/examples/jsm/lines/WireframeGeometry2.d.ts index 90e6b768e381964a796e9aa28ae8c01e4e64ed29..960914152b66cfc2d603e14ab92a3938d4731bd3 100644 --- a/examples/jsm/lines/WireframeGeometry2.d.ts +++ b/examples/jsm/lines/WireframeGeometry2.d.ts @@ -1,11 +1,13 @@ import { - BufferGeometry, - Geometry + BufferGeometry, + Geometry } from '../../../src/Three'; import { LineSegmentsGeometry } from './LineSegmentsGeometry'; export class WireframeGeometry2 extends LineSegmentsGeometry { - constructor(geometry: Geometry | BufferGeometry); - isWireframeGeometry2: boolean; + + constructor( geometry: Geometry | BufferGeometry ); + isWireframeGeometry2: boolean; + } diff --git a/examples/jsm/loaders/3MFLoader.d.ts b/examples/jsm/loaders/3MFLoader.d.ts index 84176c695fe7934ec27283c3a53baa09932ac109..c0d2cd2a355e3d06f6cdf043d8d3f65d391c8374 100644 --- a/examples/jsm/loaders/3MFLoader.d.ts +++ b/examples/jsm/loaders/3MFLoader.d.ts @@ -1,14 +1,16 @@ import { - Loader, - LoadingManager, - Group + Loader, + LoadingManager, + Group } from '../../../src/Three'; export class ThreeMFLoader extends Loader { - constructor(manager?: LoadingManager); - availableExtensions: object[]; - load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer): Group; - addExtension(extension: object):void + constructor( manager?: LoadingManager ); + availableExtensions: object[]; + + load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer ): Group; + addExtension( extension: object ):void + } diff --git a/examples/jsm/loaders/AMFLoader.d.ts b/examples/jsm/loaders/AMFLoader.d.ts index a9eff2635c2e013a5af168b28060f1d73568ed26..78edd8d279863bbf164bac8c490ca2723143ee45 100644 --- a/examples/jsm/loaders/AMFLoader.d.ts +++ b/examples/jsm/loaders/AMFLoader.d.ts @@ -1,12 +1,14 @@ import { - Loader, - LoadingManager, - Group + Loader, + LoadingManager, + Group } from '../../../src/Three'; export class AMFLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer): Group; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer ): Group; + } diff --git a/examples/jsm/loaders/AWDLoader.d.ts b/examples/jsm/loaders/AWDLoader.d.ts index 1e35396cd31d8fc1e0330231be4550fad4ced901..049693badfbf35f55e7c53cb20ca9bb0d16203c2 100644 --- a/examples/jsm/loaders/AWDLoader.d.ts +++ b/examples/jsm/loaders/AWDLoader.d.ts @@ -1,49 +1,51 @@ import { - Bone, - BufferGeometry, - Loader, - LoadingManager, - Material, - Matrix4, - Mesh, - Object3D, - Texture + Bone, + BufferGeometry, + Loader, + LoadingManager, + Material, + Matrix4, + Mesh, + Object3D, + Texture } from '../../../src/Three'; export class AWDLoader extends Loader { - constructor(manager?: LoadingManager); - materialFactory: any; - path: string; - trunk: Object3D; - getBlock(id: number): any; - load(url: string, onLoad: (result: Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadTexture(url: string): Texture; - parse(data: ArrayBuffer): Object3D; - parseAnimatorSet(): object; - parseAttrValue(type: number, value: number): any; - parseContainer(): Object3D; - parseMaterial(): Material; - parseMatrix4(): Matrix4; - parseMeshData(): BufferGeometry[]; - parseMeshInstance(): Mesh; - parseMeshPoseAnimation(poseOnly: boolean): null; - parseNextBlock(): void; - parseProperties(expected: object): object; - parseSkeleton(): Bone[]; - parseSkeletonAnimation(): object[]; - parseSkeletonPose(): Matrix4[]; - parseTexture(): Texture; - parseUserAttributes(): null; - parseVertexAnimationSet(): object[]; - readU8(): number; - readI8(): number; - readU16(): number; - readI16(): number; - readU32(): number; - readI32(): number; - readF32(): number; - readF64(): number; - readUTF(): string; - readUTFBytes(len: number): string; + constructor( manager?: LoadingManager ); + materialFactory: any; + path: string; + trunk: Object3D; + + getBlock( id: number ): any; + load( url: string, onLoad: ( result: Object3D ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadTexture( url: string ): Texture; + parse( data: ArrayBuffer ): Object3D; + parseAnimatorSet(): object; + parseAttrValue( type: number, value: number ): any; + parseContainer(): Object3D; + parseMaterial(): Material; + parseMatrix4(): Matrix4; + parseMeshData(): BufferGeometry[]; + parseMeshInstance(): Mesh; + parseMeshPoseAnimation( poseOnly: boolean ): null; + parseNextBlock(): void; + parseProperties( expected: object ): object; + parseSkeleton(): Bone[]; + parseSkeletonAnimation(): object[]; + parseSkeletonPose(): Matrix4[]; + parseTexture(): Texture; + parseUserAttributes(): null; + parseVertexAnimationSet(): object[]; + readU8(): number; + readI8(): number; + readU16(): number; + readI16(): number; + readU32(): number; + readI32(): number; + readF32(): number; + readF64(): number; + readUTF(): string; + readUTFBytes( len: number ): string; + } diff --git a/examples/jsm/loaders/AssimpJSONLoader.d.ts b/examples/jsm/loaders/AssimpJSONLoader.d.ts index 17c461218dd2042fe9b1d075b433603eb67bb36e..8a8f45981d41f59fa0a1b4cb112331b816645190 100644 --- a/examples/jsm/loaders/AssimpJSONLoader.d.ts +++ b/examples/jsm/loaders/AssimpJSONLoader.d.ts @@ -1,12 +1,14 @@ import { - Object3D, - Loader, - LoadingManager + Object3D, + Loader, + LoadingManager } from '../../../src/Three'; export class AssimpJSONLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (object: Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(json: object, path: string) : Object3D; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( object: Object3D ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( json: object, path: string ) : Object3D; + } diff --git a/examples/jsm/loaders/AssimpLoader.d.ts b/examples/jsm/loaders/AssimpLoader.d.ts index b2f3952c9bdb282188dc51fcb1e0f63727ad5df2..d6a23b0ca89330d07cf2238a1a3cdf931865e65e 100644 --- a/examples/jsm/loaders/AssimpLoader.d.ts +++ b/examples/jsm/loaders/AssimpLoader.d.ts @@ -1,18 +1,20 @@ import { - Object3D, - Loader, - LoadingManager + Object3D, + Loader, + LoadingManager } from '../../../src/Three'; export interface Assimp { - animation: any; - object: Object3D; + animation: any; + object: Object3D; } export class AssimpLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (result: Assimp) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(buffer: ArrayBuffer, path: string) : Assimp; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( result: Assimp ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( buffer: ArrayBuffer, path: string ) : Assimp; + } diff --git a/examples/jsm/loaders/BVHLoader.d.ts b/examples/jsm/loaders/BVHLoader.d.ts index 9758525cb8c50b0230fc37bdba097993e48b28c6..5265bc7a124136c7d5760bf84edd2724827342c9 100644 --- a/examples/jsm/loaders/BVHLoader.d.ts +++ b/examples/jsm/loaders/BVHLoader.d.ts @@ -1,21 +1,23 @@ import { - AnimationClip, - Skeleton, - Loader, - LoadingManager + AnimationClip, + Skeleton, + Loader, + LoadingManager } from '../../../src/Three'; export interface BVH { - clip: AnimationClip; - skeleton: Skeleton; + clip: AnimationClip; + skeleton: Skeleton; } export class BVHLoader extends Loader { - constructor(manager?: LoadingManager); - animateBonePositions: boolean; - animateBoneRotations: boolean; - load(url: string, onLoad: (bvh: BVH) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(text: string) : BVH; + constructor( manager?: LoadingManager ); + animateBonePositions: boolean; + animateBoneRotations: boolean; + + load( url: string, onLoad: ( bvh: BVH ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( text: string ) : BVH; + } diff --git a/examples/jsm/loaders/BasisTextureLoader.d.ts b/examples/jsm/loaders/BasisTextureLoader.d.ts index 44dc345e2d23fd7c28b561c0df6ea20bcdc83c22..b61dc1a856c2a57b75fa89d873c59c6a807bbe16 100644 --- a/examples/jsm/loaders/BasisTextureLoader.d.ts +++ b/examples/jsm/loaders/BasisTextureLoader.d.ts @@ -1,30 +1,33 @@ import { - CompressedTexture, - Loader, - LoadingManager, - WebGLRenderer + CompressedTexture, + Loader, + LoadingManager, + WebGLRenderer } from '../../../src/Three'; export class BasisTextureLoader extends Loader { - constructor(manager?: LoadingManager); - transcoderBinary: ArrayBuffer | null; - transcoderPath: string; - transcoderPending: Promise | null; - workerConfig: { - format: number; - etcSupported: boolean; - dxtSupported: boolean; - pvrtcSupported: boolean; - } - workerLimit: number; - workerNextTaskID: number; - workerPool: object[]; - workerSourceURL: string; + constructor( manager?: LoadingManager ); + transcoderBinary: ArrayBuffer | null; + transcoderPath: string; + transcoderPending: Promise | null; + + workerConfig: { + format: number; + astcSupported: boolean; + etcSupported: boolean; + dxtSupported: boolean; + pvrtcSupported: boolean; + } + workerLimit: number; + workerNextTaskID: number; + workerPool: object[]; + workerSourceURL: string; + + detectSupport( renderer: WebGLRenderer ): this; + dispose(): void; + load( url: string, onLoad: ( texture: CompressedTexture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + setTranscoderPath( path: string ): this; + setWorkerLimit( workerLimit: number ): this; - detectSupport(renderer: WebGLRenderer): this; - dispose(): void; - load(url: string, onLoad: (texture: CompressedTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setTranscoderPath(path: string): this; - setWorkerLimit(workerLimit: number): this; } diff --git a/examples/jsm/loaders/BasisTextureLoader.js b/examples/jsm/loaders/BasisTextureLoader.js index 578e3a4a96623449bc97f771e83682bf81ed4ea6..1fd2e9028d9d159a4b1698daefce05b299a4eb42 100644 --- a/examples/jsm/loaders/BasisTextureLoader.js +++ b/examples/jsm/loaders/BasisTextureLoader.js @@ -10,13 +10,13 @@ import { LinearFilter, LinearMipmapLinearFilter, Loader, + RGBA_ASTC_4x4_Format, + RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_PVRTC_4BPPV1_Format, UnsignedByteType } from "../../../build/three.module.js"; -/* global Module, createBasisModule */ - /** * Loader for Basis Universal GPU Texture Codec. * @@ -43,6 +43,7 @@ var BasisTextureLoader = function ( manager ) { this.workerSourceURL = ''; this.workerConfig = { format: null, + astcSupported: false, etcSupported: false, dxtSupported: false, pvrtcSupported: false, @@ -74,22 +75,27 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), var config = this.workerConfig; + config.astcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_astc' ); config.etcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_etc1' ); config.dxtSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_s3tc' ); config.pvrtcSupported = !! renderer.extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || !! renderer.extensions.get( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ); - if ( config.etcSupported ) { + if ( config.astcSupported ) { - config.format = BasisTextureLoader.BASIS_FORMAT.cTFETC1; + config.format = BasisTextureLoader.BASIS_FORMAT.cTFASTC_4x4; } else if ( config.dxtSupported ) { - config.format = BasisTextureLoader.BASIS_FORMAT.cTFBC1; + config.format = BasisTextureLoader.BASIS_FORMAT.cTFBC3; } else if ( config.pvrtcSupported ) { - config.format = BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY; + config.format = BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA; + + } else if ( config.etcSupported ) { + + config.format = BasisTextureLoader.BASIS_FORMAT.cTFETC1; } else { @@ -147,25 +153,30 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), var config = this.workerConfig; - var { width, height, mipmaps } = message; + var { width, height, hasAlpha, mipmaps, format } = message; var texture; - if ( config.etcSupported ) { - - texture = new CompressedTexture( mipmaps, width, height, RGB_ETC1_Format ); - - } else if ( config.dxtSupported ) { - - texture = new CompressedTexture( mipmaps, width, height, BasisTextureLoader.DXT_FORMAT_MAP[ config.format ], UnsignedByteType ); - - } else if ( config.pvrtcSupported ) { - - texture = new CompressedTexture( mipmaps, width, height, RGB_PVRTC_4BPPV1_Format ); - - } else { - - throw new Error( 'THREE.BasisTextureLoader: No supported format available.' ); + switch ( format ) { + + case BasisTextureLoader.BASIS_FORMAT.cTFASTC_4x4: + texture = new CompressedTexture( mipmaps, width, height, RGBA_ASTC_4x4_Format ); + break; + case BasisTextureLoader.BASIS_FORMAT.cTFBC1: + case BasisTextureLoader.BASIS_FORMAT.cTFBC3: + texture = new CompressedTexture( mipmaps, width, height, BasisTextureLoader.DXT_FORMAT_MAP[ config.format ], UnsignedByteType ); + break; + case BasisTextureLoader.BASIS_FORMAT.cTFETC1: + texture = new CompressedTexture( mipmaps, width, height, RGB_ETC1_Format ); + break; + case BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB: + texture = new CompressedTexture( mipmaps, width, height, RGB_PVRTC_4BPPV1_Format ); + break; + case BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA: + texture = new CompressedTexture( mipmaps, width, height, RGBA_PVRTC_4BPPV1_Format ); + break; + default: + throw new Error( 'THREE.BasisTextureLoader: No supported format available.' ); } @@ -225,12 +236,7 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), var body = [ '/* basis_transcoder.js */', - 'var Module;', - 'function createBasisModule () {', - ' ' + jsContent, - ' return Module;', - '}', - '', + jsContent, '/* worker */', fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) ) ].join( '\n' ); @@ -323,13 +329,22 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), BasisTextureLoader.BASIS_FORMAT = { cTFETC1: 0, - cTFBC1: 1, - cTFBC4: 2, - cTFPVRTC1_4_OPAQUE_ONLY: 3, - cTFBC7_M6_OPAQUE_ONLY: 4, - cTFETC2: 5, - cTFBC3: 6, - cTFBC5: 7, + cTFETC2: 1, + cTFBC1: 2, + cTFBC3: 3, + cTFBC4: 4, + cTFBC5: 5, + cTFBC7_M6_OPAQUE_ONLY: 6, + cTFBC7_M5: 7, + cTFPVRTC1_4_RGB: 8, + cTFPVRTC1_4_RGBA: 9, + cTFASTC_4x4: 10, + cTFATC_RGB: 11, + cTFATC_RGBA_INTERPOLATED_ALPHA: 12, + cTFRGBA32: 13, + cTFRGB565: 14, + cTFBGR565: 15, + cTFRGBA4444: 16, }; // DXT formats, from: @@ -370,7 +385,7 @@ BasisTextureLoader.BasisWorker = function () { try { - var { width, height, mipmaps } = transcode( message.buffer ); + var { width, height, hasAlpha, mipmaps, format } = transcode( message.buffer ); var buffers = []; @@ -380,7 +395,7 @@ BasisTextureLoader.BasisWorker = function () { } - self.postMessage( { type: 'transcode', id: message.id, width, height, mipmaps }, buffers ); + self.postMessage( { type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format }, buffers ); } catch ( error ) { @@ -399,19 +414,15 @@ BasisTextureLoader.BasisWorker = function () { function init( wasmBinary ) { + var BasisModule; transcoderPending = new Promise( ( resolve ) => { - // The 'Module' global is used by the Basis wrapper, which will check for - // the 'wasmBinary' property before trying to load the file itself. - - // TODO(donmccurdy): This only works with a modified version of the - // emscripten-generated wrapper. The default seems to have a bug making it - // impossible to override the WASM binary. - Module = { wasmBinary, onRuntimeInitialized: resolve }; + BasisModule = { wasmBinary, onRuntimeInitialized: resolve }; + BASIS( BasisModule ); } ).then( () => { - var { BasisFile, initializeBasis } = Module; + var { BasisFile, initializeBasis } = BasisModule; _BasisFile = BasisFile; @@ -419,8 +430,6 @@ BasisTextureLoader.BasisWorker = function () { } ); - createBasisModule(); - } function transcode( buffer ) { @@ -430,6 +439,7 @@ BasisTextureLoader.BasisWorker = function () { var width = basisFile.getImageWidth( 0, 0 ); var height = basisFile.getImageHeight( 0, 0 ); var levels = basisFile.getNumLevels( 0 ); + var hasAlpha = basisFile.getHasAlpha(); function cleanup() { @@ -438,6 +448,20 @@ BasisTextureLoader.BasisWorker = function () { } + if ( ! hasAlpha ) { + + switch ( config.format ) { + + case 9: // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGBA + config.format = 8; // Hardcoded: BasisTextureLoader.BASIS_FORMAT.cTFPVRTC1_4_RGB; + break; + default: + break; + + } + + } + if ( ! width || ! height || ! levels ) { cleanup(); @@ -452,12 +476,6 @@ BasisTextureLoader.BasisWorker = function () { } - if ( basisFile.getHasAlpha() ) { - - console.warn( 'THREE.BasisTextureLoader: Alpha not yet implemented.' ); - - } - var mipmaps = []; for ( var mip = 0; mip < levels; mip ++ ) { @@ -471,7 +489,7 @@ BasisTextureLoader.BasisWorker = function () { 0, mip, config.format, - config.etcSupported ? 0 : ( config.dxtSupported ? 1 : 0 ), + hasAlpha, 0 ); @@ -488,7 +506,7 @@ BasisTextureLoader.BasisWorker = function () { cleanup(); - return { width, height, mipmaps }; + return { width, height, hasAlpha, mipmaps, format: config.format }; } diff --git a/examples/jsm/loaders/ColladaLoader.d.ts b/examples/jsm/loaders/ColladaLoader.d.ts index e35ecf407b8a96b10a2b421431411a9a29885c09..75cf3fab6d2fc5af6b081a49cdf99bd0993800af 100644 --- a/examples/jsm/loaders/ColladaLoader.d.ts +++ b/examples/jsm/loaders/ColladaLoader.d.ts @@ -1,21 +1,23 @@ import { - AnimationClip, - Loader, - LoadingManager, - Scene + AnimationClip, + Loader, + LoadingManager, + Scene } from '../../../src/Three'; export interface Collada { - animations: AnimationClip[]; - kinematics: object; - library: object; - scene: Scene; + animations: AnimationClip[]; + kinematics: object; + library: object; + scene: Scene; } export class ColladaLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (collada: Collada) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(text: string, path: string) : Collada; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( collada: Collada ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( text: string, path: string ) : Collada; + } diff --git a/examples/jsm/loaders/DDSLoader.d.ts b/examples/jsm/loaders/DDSLoader.d.ts index aacb602f00ea387364a37d6b4e7d35902ca59e45..b9d2e041c340233080f8ecadc0a781fdde306315 100644 --- a/examples/jsm/loaders/DDSLoader.d.ts +++ b/examples/jsm/loaders/DDSLoader.d.ts @@ -1,21 +1,23 @@ import { - LoadingManager, - CompressedTextureLoader, - PixelFormat, - CompressedPixelFormat + LoadingManager, + CompressedTextureLoader, + PixelFormat, + CompressedPixelFormat } from '../../../src/Three'; export interface DDS { - mipmaps: object[]; - width: number; - height: number; - format: PixelFormat | CompressedPixelFormat; - mipmapCount: number; - isCubemap: boolean; + mipmaps: object[]; + width: number; + height: number; + format: PixelFormat | CompressedPixelFormat; + mipmapCount: number; + isCubemap: boolean; } export class DDSLoader extends CompressedTextureLoader { - constructor(manager?: LoadingManager); - parse(buffer: ArrayBuffer, loadMipmaps: boolean) : DDS; + constructor( manager?: LoadingManager ); + + parse( buffer: ArrayBuffer, loadMipmaps: boolean ) : DDS; + } diff --git a/examples/jsm/loaders/DRACOLoader.d.ts b/examples/jsm/loaders/DRACOLoader.d.ts index 553ca91ccdff5b777e15f20f1fe5aa0e954375c4..c9d8c38aa57bf838ea512c997a84a151d89fcc1b 100644 --- a/examples/jsm/loaders/DRACOLoader.d.ts +++ b/examples/jsm/loaders/DRACOLoader.d.ts @@ -1,15 +1,17 @@ import { - Loader, - LoadingManager, - BufferGeometry + Loader, + LoadingManager, + BufferGeometry } from '../../../src/Three'; export class DRACOLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setDecoderPath(path: string): DRACOLoader; - setDecoderConfig(config: object): DRACOLoader; - setWorkerLimit(workerLimit: number): DRACOLoader; - dispose(): DRACOLoader; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + setDecoderPath( path: string ): DRACOLoader; + setDecoderConfig( config: object ): DRACOLoader; + setWorkerLimit( workerLimit: number ): DRACOLoader; + dispose(): DRACOLoader; + } diff --git a/examples/jsm/loaders/EXRLoader.d.ts b/examples/jsm/loaders/EXRLoader.d.ts index f510c05e10038094b27a7202a31d2b699c45b426..68b4231a52fa8c56375c056525988769f814a560 100644 --- a/examples/jsm/loaders/EXRLoader.d.ts +++ b/examples/jsm/loaders/EXRLoader.d.ts @@ -1,23 +1,25 @@ import { - LoadingManager, - DataTextureLoader, - TextureDataType, - PixelFormat + LoadingManager, + DataTextureLoader, + TextureDataType, + PixelFormat } from '../../../src/Three'; export interface EXR { - header: object; - width: number; - height: number; - data: Float32Array; - format: PixelFormat; - type: TextureDataType; + header: object; + width: number; + height: number; + data: Float32Array; + format: PixelFormat; + type: TextureDataType; } export class EXRLoader extends DataTextureLoader { - constructor(manager?: LoadingManager); - type: TextureDataType; - parse(buffer: ArrayBuffer) : EXR; - setDataType(type: TextureDataType): this; + constructor( manager?: LoadingManager ); + type: TextureDataType; + + parse( buffer: ArrayBuffer ) : EXR; + setDataType( type: TextureDataType ): this; + } diff --git a/examples/jsm/loaders/EquirectangularToCubeGenerator.d.ts b/examples/jsm/loaders/EquirectangularToCubeGenerator.d.ts index a63db340f22b57f62c1ed74e7156bcd90432b6f9..450347811c955d276326e0809f0eaca9b5da4fe1 100644 --- a/examples/jsm/loaders/EquirectangularToCubeGenerator.d.ts +++ b/examples/jsm/loaders/EquirectangularToCubeGenerator.d.ts @@ -1,34 +1,38 @@ import { - PixelFormat, - Texture, - TextureDataType, - TextureFilter, - WebGLRenderer, - WebGLRenderTargetCube + PixelFormat, + Texture, + TextureDataType, + TextureFilter, + WebGLRenderer, + WebGLRenderTargetCube } from '../../../src/Three'; export interface CubemapGeneratorOptions { - resolution?: number; - generateMipmaps?: boolean; - magFilter?: TextureFilter; - minFilter?: TextureFilter; + resolution?: number; + generateMipmaps?: boolean; + magFilter?: TextureFilter; + minFilter?: TextureFilter; } export interface EquirectangularToCubeGeneratorOptions { - resolution?: number; - format?: PixelFormat; - type?: TextureDataType; + resolution?: number; + format?: PixelFormat; + type?: TextureDataType; } export class CubemapGenerator { - constructor(renderer: WebGLRenderer); - fromEquirectangular(texture: Texture, options?: CubemapGeneratorOptions): WebGLRenderTargetCube; + constructor( renderer: WebGLRenderer ); + + fromEquirectangular( texture: Texture, options?: CubemapGeneratorOptions ): WebGLRenderTargetCube; + } export class EquirectangularToCubeGenerator { - constructor(sourceTexture: Texture, options?: EquirectangularToCubeGeneratorOptions); - dispose(): void; - update(renderer: WebGLRenderer): Texture; + constructor( sourceTexture: Texture, options?: EquirectangularToCubeGeneratorOptions ); + + dispose(): void; + update( renderer: WebGLRenderer ): Texture; + } diff --git a/examples/jsm/loaders/FBXLoader.d.ts b/examples/jsm/loaders/FBXLoader.d.ts index 48be64a72a21c6194a6d96a45e4be7452623fe48..1a3e6bb1bfd1603a688a39172436d1f3382fba3c 100644 --- a/examples/jsm/loaders/FBXLoader.d.ts +++ b/examples/jsm/loaders/FBXLoader.d.ts @@ -1,12 +1,14 @@ import { - Group, - Loader, - LoadingManager + Group, + Loader, + LoadingManager } from '../../../src/Three'; export class FBXLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(FBXBuffer: ArrayBuffer | string, path: string) : Group; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( FBXBuffer: ArrayBuffer | string, path: string ) : Group; + } diff --git a/examples/jsm/loaders/GCodeLoader.d.ts b/examples/jsm/loaders/GCodeLoader.d.ts index edadc4200b35c205c68135ca9cbcaf15e4067407..47ee340b2f0266eab8f707c60a0beaa05f851e84 100644 --- a/examples/jsm/loaders/GCodeLoader.d.ts +++ b/examples/jsm/loaders/GCodeLoader.d.ts @@ -1,13 +1,15 @@ import { - Group, - Loader, - LoadingManager + Group, + Loader, + LoadingManager } from '../../../src/Three'; export class GCodeLoader extends Loader { - constructor(manager?: LoadingManager); - splitLayer: boolean; - load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: string) : Group; + constructor( manager?: LoadingManager ); + splitLayer: boolean; + + load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: string ) : Group; + } diff --git a/examples/jsm/loaders/GLTFLoader.d.ts b/examples/jsm/loaders/GLTFLoader.d.ts index e7c89ae8ec00ddd7455d58a41f2002c4f0357b1b..5fdf09a0d235a6c40e6fa0d77da336b11a31aa80 100644 --- a/examples/jsm/loaders/GLTFLoader.d.ts +++ b/examples/jsm/loaders/GLTFLoader.d.ts @@ -1,29 +1,31 @@ import { - AnimationClip, - Camera, - Loader, - LoadingManager, - Scene + AnimationClip, + Camera, + Loader, + LoadingManager, + Scene } from '../../../src/Three'; import { DRACOLoader } from './DRACOLoader'; import { DDSLoader } from './DDSLoader'; export interface GLTF { - animations: AnimationClip[]; - scene: Scene; - scenes: Scene[]; - cameras: Camera[]; - asset: object; + animations: AnimationClip[]; + scene: Scene; + scenes: Scene[]; + cameras: Camera[]; + asset: object; } export class GLTFLoader extends Loader { - constructor(manager?: LoadingManager); - dracoLoader: DRACOLoader | null; - ddsLoader: DDSLoader | null; - load(url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader; - setDDSLoader(ddsLoader: DDSLoader): GLTFLoader; - parse(data: ArrayBuffer | string, path: string, onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void) : void; + constructor( manager?: LoadingManager ); + dracoLoader: DRACOLoader | null; + ddsLoader: DDSLoader | null; + + load( url: string, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + setDRACOLoader( dracoLoader: DRACOLoader ): GLTFLoader; + setDDSLoader( ddsLoader: DDSLoader ): GLTFLoader; + parse( data: ArrayBuffer | string, path: string, onLoad: ( gltf: GLTF ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + } diff --git a/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/examples/jsm/loaders/HDRCubeTextureLoader.d.ts index 1b8426854f63c812b0ee72037dd91b7fa83f8452..5ca025c4f2d468289023859efec0c6691635c8b6 100644 --- a/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +++ b/examples/jsm/loaders/HDRCubeTextureLoader.d.ts @@ -1,17 +1,19 @@ import { - CubeTexture, - Loader, - LoadingManager, - TextureDataType + CubeTexture, + Loader, + LoadingManager, + TextureDataType } from '../../../src/Three'; import { RGBELoader } from './RGBELoader'; export class HDRCubeTextureLoader extends Loader { - constructor(manager?: LoadingManager); - hdrLoader: RGBELoader; - type: TextureDataType; - load(urls: string[], onLoad: (texture: CubeTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setDataType(type: TextureDataType): this; + constructor( manager?: LoadingManager ); + hdrLoader: RGBELoader; + type: TextureDataType; + + load( urls: string[], onLoad: ( texture: CubeTexture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + setDataType( type: TextureDataType ): this; + } diff --git a/examples/jsm/loaders/KMZLoader.d.ts b/examples/jsm/loaders/KMZLoader.d.ts index c65845f457487e98548cd28449d55c1dfe32584e..8254a7720277a97d3e69c8ec2be629a6e07a4caf 100644 --- a/examples/jsm/loaders/KMZLoader.d.ts +++ b/examples/jsm/loaders/KMZLoader.d.ts @@ -1,13 +1,15 @@ import { - Loader, - LoadingManager + Loader, + LoadingManager } from '../../../src/Three'; import { Collada } from './ColladaLoader'; export class KMZLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (kmz: Collada) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer): Collada; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( kmz: Collada ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer ): Collada; + } diff --git a/examples/jsm/loaders/KTXLoader.d.ts b/examples/jsm/loaders/KTXLoader.d.ts index 2358bb97005cf7f4c45ce211cdd483514fb40ade..3d08ab35feb863bb4031d1589fdf60bcf39faabc 100644 --- a/examples/jsm/loaders/KTXLoader.d.ts +++ b/examples/jsm/loaders/KTXLoader.d.ts @@ -1,21 +1,23 @@ import { - LoadingManager, - CompressedTextureLoader, - PixelFormat, - CompressedPixelFormat + LoadingManager, + CompressedTextureLoader, + PixelFormat, + CompressedPixelFormat } from '../../../src/Three'; export interface KTX { - mipmaps: object[]; - width: number; - height: number; - format: PixelFormat | CompressedPixelFormat; - mipmapCount: number; - isCubemap: boolean; + mipmaps: object[]; + width: number; + height: number; + format: PixelFormat | CompressedPixelFormat; + mipmapCount: number; + isCubemap: boolean; } export class KTXLoader extends CompressedTextureLoader { - constructor(manager?: LoadingManager); - parse(buffer: ArrayBuffer, loadMipmaps: boolean) : KTX; + constructor( manager?: LoadingManager ); + + parse( buffer: ArrayBuffer, loadMipmaps: boolean ) : KTX; + } diff --git a/examples/jsm/loaders/LDrawLoader.d.ts b/examples/jsm/loaders/LDrawLoader.d.ts index c7538d9652b352e8a994d38038016ca3e3ce6351..beb9d743dc8c6d180c43a44ab1cd26d3fead2c5a 100644 --- a/examples/jsm/loaders/LDrawLoader.d.ts +++ b/examples/jsm/loaders/LDrawLoader.d.ts @@ -6,14 +6,16 @@ import { } from '../../../src/Three'; export class LDrawLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (data: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setFileMap(fileMap: Record): void; - setMaterials(materials: Material[]): void; + constructor( manager?: LoadingManager ); - parse(text: string, path: string, onLoad: (data: Group) => void): void; + load( url: string, onLoad: ( data: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + setFileMap( fileMap: Record ): void; + setMaterials( materials: Material[] ): void; + + parse( text: string, path: string, onLoad: ( data: Group ) => void ): void; + + addMaterial( material: Material ): void; + getMaterial( colourCode: string ): Material | null; - addMaterial(material: Material ): void; - getMaterial(colourCode: string): Material | null; } diff --git a/examples/jsm/loaders/LWOLoader.d.ts b/examples/jsm/loaders/LWOLoader.d.ts index a1fd32ad1444f96965f2d4706eed85fd100077d4..d6f17587a718309318afdf73778139f60b94a1d0 100644 --- a/examples/jsm/loaders/LWOLoader.d.ts +++ b/examples/jsm/loaders/LWOLoader.d.ts @@ -20,8 +20,10 @@ export interface LWOLoaderParameters { } export class LWOLoader extends Loader { - constructor(manager?: LoadingManager, parameters?: LWOLoaderParameters); - load(url: string, onLoad: (lwo: LWO) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: ArrayBuffer, path: string, modelName: string): LWO; + constructor( manager?: LoadingManager, parameters?: LWOLoaderParameters ); + + load( url: string, onLoad: ( lwo: LWO ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer, path: string, modelName: string ): LWO; + } diff --git a/examples/jsm/loaders/MD2Loader.d.ts b/examples/jsm/loaders/MD2Loader.d.ts index ab3a70211289827a7d19eea1cbd7dc38af527150..38d7d4a84f649b316d33dcaa3a0c6691b836d64e 100644 --- a/examples/jsm/loaders/MD2Loader.d.ts +++ b/examples/jsm/loaders/MD2Loader.d.ts @@ -1,12 +1,14 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class MD2Loader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer): BufferGeometry; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer ): BufferGeometry; + } diff --git a/examples/jsm/loaders/MMDLoader.d.ts b/examples/jsm/loaders/MMDLoader.d.ts index c77056dbec0c38149e65a83cda1449f2a19a12a9..e54be3b883d7b648654c56a15e5d3c2ee276b79c 100644 --- a/examples/jsm/loaders/MMDLoader.d.ts +++ b/examples/jsm/loaders/MMDLoader.d.ts @@ -1,30 +1,32 @@ import { - AnimationClip, - FileLoader, - Loader, - LoadingManager, - SkinnedMesh + AnimationClip, + FileLoader, + Loader, + LoadingManager, + SkinnedMesh } from '../../../src/Three'; export interface MMDLoaderAnimationObject { - animation: AnimationClip; - mesh: SkinnedMesh; + animation: AnimationClip; + mesh: SkinnedMesh; } export class MMDLoader extends Loader { - constructor(manager?: LoadingManager); - animationBuilder: object; - animationPath: string; - loader: FileLoader; - meshBuilder: object; - parser: object | null; - load(url: string, onLoad: (mesh: SkinnedMesh) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadAnimation(url: string, object: SkinnedMesh | THREE.Camera, onLoad: (object: SkinnedMesh | AnimationClip) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadPMD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadPMX(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadVMD(url: string, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadVPD(url: string, isUnicode: boolean, onLoad: (object: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - loadWithAnimation(url: string, vmdUrl: string | string[], onLoad: (object: MMDLoaderAnimationObject) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - setAnimationPath(animationPath: string): this; + constructor( manager?: LoadingManager ); + animationBuilder: object; + animationPath: string; + loader: FileLoader; + meshBuilder: object; + parser: object | null; + + load( url: string, onLoad: ( mesh: SkinnedMesh ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadAnimation( url: string, object: SkinnedMesh | THREE.Camera, onLoad: ( object: SkinnedMesh | AnimationClip ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadPMD( url: string, onLoad: ( object: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadPMX( url: string, onLoad: ( object: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadVMD( url: string, onLoad: ( object: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadVPD( url: string, isUnicode: boolean, onLoad: ( object: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + loadWithAnimation( url: string, vmdUrl: string | string[], onLoad: ( object: MMDLoaderAnimationObject ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + setAnimationPath( animationPath: string ): this; + } diff --git a/examples/jsm/loaders/MTLLoader.d.ts b/examples/jsm/loaders/MTLLoader.d.ts index da8af326ff11da545597f8262a811cca7764c6ec..4aa2894e063132778c1604f51ec5d22decd7a624 100644 --- a/examples/jsm/loaders/MTLLoader.d.ts +++ b/examples/jsm/loaders/MTLLoader.d.ts @@ -1,96 +1,100 @@ import { - Material, - LoadingManager, - Mapping, - Loader, - BufferGeometry, - Side, - Texture, - Vector2, - Wrapping + Material, + LoadingManager, + Mapping, + Loader, + BufferGeometry, + Side, + Texture, + Vector2, + Wrapping } from '../../../src/Three'; export interface MaterialCreatorOptions { - /** + /** * side: Which side to apply the material * THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide */ - side?: Side; - /* + side?: Side; + /* * wrap: What type of wrapping to apply for textures * THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping */ - wrap?: Wrapping; - /* + wrap?: Wrapping; + /* * normalizeRGB: RGBs need to be normalized to 0-1 from 0-255 * Default: false, assumed to be already normalized */ - normalizeRGB?: boolean; - /* + normalizeRGB?: boolean; + /* * ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's * Default: false */ - ignoreZeroRGBs?: boolean; - /* + ignoreZeroRGBs?: boolean; + /* * invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj * exported from 3ds MAX, vcglib or meshlab. * Default: false */ - invertTrProperty?: boolean; + invertTrProperty?: boolean; } export class MTLLoader extends Loader { - constructor(manager?: LoadingManager); - materialOptions: MaterialCreatorOptions; - load(url: string, onLoad: (materialCreator: MaterialCreator) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(text: string) : MaterialCreator; - setMaterialOptions(value: MaterialCreatorOptions) : void; + constructor( manager?: LoadingManager ); + materialOptions: MaterialCreatorOptions; + + load( url: string, onLoad: ( materialCreator: MaterialCreator ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( text: string ) : MaterialCreator; + setMaterialOptions( value: MaterialCreatorOptions ) : void; + } export interface MaterialInfo { - ks?: number[]; - kd?: number[]; - ke?: number[]; - map_kd?: string; - map_ks?: string; - map_ke?: string; - norm?: string; - map_bump?: string; - bump?: string; - map_d?: string; - ns?: number; - d?: number; - tr?: number; + ks?: number[]; + kd?: number[]; + ke?: number[]; + map_kd?: string; + map_ks?: string; + map_ke?: string; + norm?: string; + map_bump?: string; + bump?: string; + map_d?: string; + ns?: number; + d?: number; + tr?: number; } export interface TexParams { - scale: Vector2; - offset: Vector2; - url: string; + scale: Vector2; + offset: Vector2; + url: string; } export class MaterialCreator { - constructor(baseUrl?: string, options?: MaterialCreatorOptions); - baseUrl : string; - options : MaterialCreatorOptions; - materialsInfo : {[key: string]: MaterialInfo}; - materials : {[key: string]: Material}; - private materialsArray : Material[]; - nameLookup : {[key: string]: number}; - side : Side; - wrap : Wrapping; + constructor( baseUrl?: string, options?: MaterialCreatorOptions ); + + baseUrl : string; + options : MaterialCreatorOptions; + materialsInfo : {[key: string]: MaterialInfo}; + materials : {[key: string]: Material}; + private materialsArray : Material[]; + nameLookup : {[key: string]: number}; + side : Side; + wrap : Wrapping; + + setCrossOrigin( value: boolean ) : void; + setManager( value: LoadingManager ) : void; + setMaterials( materialsInfo: {[key: string]: MaterialInfo} ) : void; + convert( materialsInfo: {[key: string]: MaterialInfo} ) : {[key: string]: MaterialInfo}; + preload() : void; + getIndex( materialName: string ) : Material; + getAsArray() : Material[]; + create( materialName: string ) : Material; + createMaterial_( materialName: string ) : Material; + getTextureParams( value: string, matParams: any ) : TexParams; + loadTexture( url: string, mapping?: Mapping, onLoad?: ( bufferGeometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): Texture; - setCrossOrigin( value: boolean ) : void; - setManager( value: LoadingManager ) : void; - setMaterials( materialsInfo: {[key: string]: MaterialInfo} ) : void; - convert( materialsInfo: {[key: string]: MaterialInfo} ) : {[key: string]: MaterialInfo}; - preload() : void; - getIndex( materialName: string ) : Material; - getAsArray() : Material[]; - create( materialName: string ) : Material; - createMaterial_( materialName: string ) : Material; - getTextureParams( value: string, matParams: any ) : TexParams; - loadTexture(url: string, mapping?: Mapping, onLoad?: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): Texture; } diff --git a/examples/jsm/loaders/NRRDLoader.d.ts b/examples/jsm/loaders/NRRDLoader.d.ts index cf9120f083408f3bd8a294d9d6c953d96e53d72d..2891ab4348f67d1a557427cb6a64d7fca5c96f16 100644 --- a/examples/jsm/loaders/NRRDLoader.d.ts +++ b/examples/jsm/loaders/NRRDLoader.d.ts @@ -1,23 +1,24 @@ import { - Material, - LoadingManager, - Group + Material, + LoadingManager, + Group } from '../../../src/Three'; import { - Volume + Volume } from '../misc/Volume'; export class NRRDLoader { - constructor(manager?: LoadingManager); - manager: LoadingManager; - path: string; - fieldFunctions: object; + constructor( manager?: LoadingManager ); + manager: LoadingManager; + path: string; - load(url: string, onLoad: (group: Volume) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: string) : Volume; - parseChars(array: number[], start?: number, end?: number) : string; - setPath(value: string) : this; + fieldFunctions: object; + + load( url: string, onLoad: ( group: Volume ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: string ) : Volume; + parseChars( array: number[], start?: number, end?: number ) : string; + setPath( value: string ) : this; } diff --git a/examples/jsm/loaders/OBJLoader.d.ts b/examples/jsm/loaders/OBJLoader.d.ts index e5d715292c17ec2e0eacbc7fb9a8aaa2f3cbf6b4..87eb46bba1823550f88ac5414c4a0ee4f285d795 100644 --- a/examples/jsm/loaders/OBJLoader.d.ts +++ b/examples/jsm/loaders/OBJLoader.d.ts @@ -1,18 +1,20 @@ import { - Material, - Loader, - LoadingManager, - Group + Material, + Loader, + LoadingManager, + Group } from '../../../src/Three'; import { - MaterialCreator + MaterialCreator } from './MTLLoader'; export class OBJLoader extends Loader { - constructor(manager?: LoadingManager); - materials: MaterialCreator; - load(url: string, onLoad: (group: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: string) : Group; - setMaterials(materials: MaterialCreator) : this; + constructor( manager?: LoadingManager ); + materials: MaterialCreator; + + load( url: string, onLoad: ( group: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: string ) : Group; + setMaterials( materials: MaterialCreator ) : this; + } diff --git a/examples/jsm/loaders/OBJLoader.js b/examples/jsm/loaders/OBJLoader.js index e849f73d6711b2f80b244acaca5b03238050b883..1ab85bb141bd28ddc08702e5989ad6be3637be5f 100644 --- a/examples/jsm/loaders/OBJLoader.js +++ b/examples/jsm/loaders/OBJLoader.js @@ -303,6 +303,12 @@ var OBJLoader = ( function () { this.addVertex( ia, ib, ic ); + if ( this.colors.length > 0 ) { + + this.addColor( ia, ib, ic ); + + } + if ( ua !== undefined && ua !== '' ) { var uvLen = this.uvs.length; @@ -326,12 +332,6 @@ var OBJLoader = ( function () { } - if ( this.colors.length > 0 ) { - - this.addColor( ia, ib, ic ); - - } - }, addPointGeometry: function ( vertices ) { diff --git a/examples/jsm/loaders/OBJLoader2.d.ts b/examples/jsm/loaders/OBJLoader2.d.ts index 443ddde464103d368aeeb3abff0b0ef8172f9d89..8860fbfde74e13af55b17098c24a29d079efaf5f 100644 --- a/examples/jsm/loaders/OBJLoader2.d.ts +++ b/examples/jsm/loaders/OBJLoader2.d.ts @@ -6,38 +6,40 @@ import { import { OBJLoader2Parser } from './obj2/worker/parallel/OBJLoader2Parser'; import { MaterialHandler } from './obj2/shared/MaterialHandler'; -import { MeshReceiver} from './obj2/shared/MeshReceiver'; +import { MeshReceiver } from './obj2/shared/MeshReceiver'; export class OBJLoader2 extends Loader { - constructor(manager?: LoadingManager); - parser: OBJLoader2Parser; - modelName: string; - instanceNo: number; - path: string; - resourcePath: string; - baseObject3d: Object3D; - materialHandler: MaterialHandler; - meshReceiver: MeshReceiver; - - setLogging(enabled: boolean, debug: boolean): this; - setMaterialPerSmoothingGroup(materialPerSmoothingGroup: boolean): this; - setUseOAsMesh(useOAsMesh: boolean): this; - setUseIndices(useIndices: boolean): this; - setDisregardNormals(disregardNormals: boolean): this; - - setModelName(modelName: string): this; - setPath(path: string): this; - setResourcePath(path: string): this; - setBaseObject3d(baseObject3d: Object3D): this; - addMaterials(materials: object): this; - - setCallbackOnAssetAvailable(onAssetAvailable: Function): this; - setCallbackOnProgress(onProgress: Function): this; - setCallbackOnError(onError: Function): this; - setCallbackOnLoad(onLoad: Function): this; - setCallbackOnMeshAlter(onMeshAlter: Function): this; - setCallbackOnLoadMaterials(onLoadMaterials: Function): this; - - load(url: string, onLoad: (object3d: Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void, onMeshAlter?: (meshData: object) => void): void; - parse(content: ArrayBuffer | string): Object3D; + + constructor( manager?: LoadingManager ); + parser: OBJLoader2Parser; + modelName: string; + instanceNo: number; + path: string; + resourcePath: string; + baseObject3d: Object3D; + materialHandler: MaterialHandler; + meshReceiver: MeshReceiver; + + setLogging( enabled: boolean, debug: boolean ): this; + setMaterialPerSmoothingGroup( materialPerSmoothingGroup: boolean ): this; + setUseOAsMesh( useOAsMesh: boolean ): this; + setUseIndices( useIndices: boolean ): this; + setDisregardNormals( disregardNormals: boolean ): this; + + setModelName( modelName: string ): this; + setPath( path: string ): this; + setResourcePath( path: string ): this; + setBaseObject3d( baseObject3d: Object3D ): this; + addMaterials( materials: object ): this; + + setCallbackOnAssetAvailable( onAssetAvailable: Function ): this; + setCallbackOnProgress( onProgress: Function ): this; + setCallbackOnError( onError: Function ): this; + setCallbackOnLoad( onLoad: Function ): this; + setCallbackOnMeshAlter( onMeshAlter: Function ): this; + setCallbackOnLoadMaterials( onLoadMaterials: Function ): this; + + load( url: string, onLoad: ( object3d: Object3D ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void, onMeshAlter?: ( meshData: object ) => void ): void; + parse( content: ArrayBuffer | string ): Object3D; + } diff --git a/examples/jsm/loaders/OBJLoader2.js b/examples/jsm/loaders/OBJLoader2.js index 0a1d6e68b4afc26cc35af558f2ee27734bccd1fe..5e5dabb4b0c934568ab8e820a8f482bc754d4235 100644 --- a/examples/jsm/loaders/OBJLoader2.js +++ b/examples/jsm/loaders/OBJLoader2.js @@ -21,6 +21,7 @@ import { MaterialHandler } from "./obj2/shared/MaterialHandler.js"; * @constructor */ const OBJLoader2 = function ( manager ) { + Loader.call( this, manager ); this.parser = new OBJLoader2Parser(); @@ -35,9 +36,12 @@ const OBJLoader2 = function ( manager ) { // as OBJLoader2 is no longer derived from OBJLoader2Parser, we need to override the default onAssetAvailable callback let scope = this; let defaultOnAssetAvailable = function ( payload ) { - scope._onAssetAvailable( payload ) + + scope._onAssetAvailable( payload ); + }; this.parser.setCallbackOnAssetAvailable( defaultOnAssetAvailable ); + }; OBJLoader2.OBJLOADER2_VERSION = '3.1.0'; @@ -124,7 +128,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { */ setBaseObject3d: function ( baseObject3d ) { - this.baseObject3d = (baseObject3d === undefined || baseObject3d === null) ? this.baseObject3d : baseObject3d; + this.baseObject3d = ( baseObject3d === undefined || baseObject3d === null ) ? this.baseObject3d : baseObject3d; return this; }, @@ -224,19 +228,18 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { load: function ( url, onLoad, onFileLoadProgress, onError, onMeshAlter ) { let scope = this; - if ( onLoad === null || onLoad === undefined || !(onLoad instanceof Function) ) { + if ( onLoad === null || onLoad === undefined || ! ( onLoad instanceof Function ) ) { let errorMessage = 'onLoad is not a function! Aborting...'; scope.parser.callbacks.onError( errorMessage ); - throw errorMessage + throw errorMessage; - } - else { + } else { this.parser.setCallbackOnLoad( onLoad ); } - if ( onError === null || onError === undefined || !(onError instanceof Function) ) { + if ( onError === null || onError === undefined || ! ( onError instanceof Function ) ) { onError = function ( event ) { @@ -251,7 +254,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { }; } - if ( !url ) { + if ( ! url ) { onError( 'An invalid url was provided. Unable to continue!' ); @@ -266,19 +269,19 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { if ( urlPartsPath !== undefined && urlPartsPath !== null ) this.path = urlPartsPath; } - if ( onFileLoadProgress === null || onFileLoadProgress === undefined || !(onFileLoadProgress instanceof Function) ) { + if ( onFileLoadProgress === null || onFileLoadProgress === undefined || ! ( onFileLoadProgress instanceof Function ) ) { let numericalValueRef = 0; let numericalValue = 0; onFileLoadProgress = function ( event ) { - if ( !event.lengthComputable ) return; + if ( ! event.lengthComputable ) return; numericalValue = event.loaded / event.total; if ( numericalValue > numericalValueRef ) { numericalValueRef = numericalValue; - let output = 'Download of "' + url + '": ' + (numericalValue * 100).toFixed( 2 ) + '%'; + let output = 'Download of "' + url + '": ' + ( numericalValue * 100 ).toFixed( 2 ) + '%'; scope.parser.callbacks.onProgress( 'progressLoad', output, numericalValue ); } @@ -331,7 +334,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), { if ( this.parser.logging.enabled ) console.info( 'Parsing arrayBuffer...' ); this.parser.execute( content ); - } else if ( typeof (content) === 'string' || content instanceof String ) { + } else if ( typeof ( content ) === 'string' || content instanceof String ) { if ( this.parser.logging.enabled ) console.info( 'Parsing text...' ); this.parser.executeLegacy( content ); diff --git a/examples/jsm/loaders/OBJLoader2Parallel.d.ts b/examples/jsm/loaders/OBJLoader2Parallel.d.ts index 6bae5ed55979da0c69c648b5d71b4ab6af1a738f..fed7eda84766424273a0e006ca36e45f6d6c63e2 100644 --- a/examples/jsm/loaders/OBJLoader2Parallel.d.ts +++ b/examples/jsm/loaders/OBJLoader2Parallel.d.ts @@ -1,21 +1,23 @@ import { - LoadingManager + LoadingManager } from '../../../src/Three'; import { OBJLoader2 } from './OBJLoader2'; -import { WorkerExecutionSupport} from './obj2/worker/main/WorkerExecutionSupport'; +import { WorkerExecutionSupport } from './obj2/worker/main/WorkerExecutionSupport'; export class OBJLoader2Parallel extends OBJLoader2 { - constructor(manager?: LoadingManager); - preferJsmWorker: boolean; - executeParallel: boolean; - workerExecutionSupport: WorkerExecutionSupport; - setPreferJsmWorker(preferJsmWorker: boolean): this; - setExecuteParallel(executeParallel: boolean): this; - getWorkerExecutionSupport(): object; - buildWorkerCode(): object; + constructor( manager?: LoadingManager ); + preferJsmWorker: boolean; + executeParallel: boolean; + workerExecutionSupport: WorkerExecutionSupport; + + setPreferJsmWorker( preferJsmWorker: boolean ): this; + setExecuteParallel( executeParallel: boolean ): this; + getWorkerExecutionSupport(): object; + buildWorkerCode(): object; + + // @ts-ignore + parse( content: ArrayBuffer ): void; - // @ts-ignore - parse(content: ArrayBuffer): void; } diff --git a/examples/jsm/loaders/OBJLoader2Parallel.js b/examples/jsm/loaders/OBJLoader2Parallel.js index e44702ac82d3d7f50c7205dd996c85be897830e4..1cef55349b9cf0571f75e229a42b9d3f837887c7 100644 --- a/examples/jsm/loaders/OBJLoader2Parallel.js +++ b/examples/jsm/loaders/OBJLoader2Parallel.js @@ -120,7 +120,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp load: function ( content, onLoad, onFileLoadProgress, onError, onMeshAlter ) { let scope = this; - function interceptOnLoad ( object3d, message ) { + function interceptOnLoad( object3d, message ) { if ( object3d.name === 'OBJLoader2ParallelDummy' ) { @@ -130,8 +130,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp } - } - else { + } else { onLoad( object3d, message ); @@ -169,7 +168,9 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp }; function scopedOnLoad( message ) { + scope.parser.callbacks.onLoad( scope.baseObject3d, message ); + } this.workerExecutionSupport.updateCallbacks( scopedOnAssetAvailable, scopedOnLoad ); @@ -180,31 +181,31 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp this.materialHandler.createDefaultMaterials( false ); this.workerExecutionSupport.executeParallel( - { - params: { - modelName: this.modelName, - instanceNo: this.instanceNo, - useIndices: this.parser.useIndices, - disregardNormals: this.parser.disregardNormals, - materialPerSmoothingGroup: this.parser.materialPerSmoothingGroup, - useOAsMesh: this.parser.useOAsMesh, - }, - materials: this.materialHandler.getMaterialsJSON(), - data: { - input: content, - options: null - }, - logging: { - enabled: this.parser.logging.enabled, - debug: this.parser.logging.debug - } - } ); + { + params: { + modelName: this.modelName, + instanceNo: this.instanceNo, + useIndices: this.parser.useIndices, + disregardNormals: this.parser.disregardNormals, + materialPerSmoothingGroup: this.parser.materialPerSmoothingGroup, + useOAsMesh: this.parser.useOAsMesh, + }, + materials: this.materialHandler.getMaterialsJSON(), + data: { + input: content, + options: null + }, + logging: { + enabled: this.parser.logging.enabled, + debug: this.parser.logging.debug + } + } ); let dummy = new Object3D(); dummy.name = 'OBJLoader2ParallelDummy'; return dummy; - } - else { + + } else { return OBJLoader2.prototype.parse.call( this, content ); diff --git a/examples/jsm/loaders/PCDLoader.d.ts b/examples/jsm/loaders/PCDLoader.d.ts index ece544a15bef730d874b4208f9574c539e5f4208..c183d28a4dd7021a30a110d4503a58acbfbece42 100644 --- a/examples/jsm/loaders/PCDLoader.d.ts +++ b/examples/jsm/loaders/PCDLoader.d.ts @@ -1,14 +1,16 @@ import { - Points, - Loader, - LoadingManager + Points, + Loader, + LoadingManager } from '../../../src/Three'; export class PCDLoader extends Loader { - constructor(manager?: LoadingManager); - littleEndian: boolean; - load(url: string, onLoad: (points: Points) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: ArrayBuffer | string, url: string) : Points; + constructor( manager?: LoadingManager ); + littleEndian: boolean; + + load( url: string, onLoad: ( points: Points ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer | string, url: string ) : Points; + } diff --git a/examples/jsm/loaders/PDBLoader.d.ts b/examples/jsm/loaders/PDBLoader.d.ts index 86e037670a34c1e6ee667018d80d66722f22f953..fbd08da4cf6efb68fbcf0a480d483c20fe5e82ab 100644 --- a/examples/jsm/loaders/PDBLoader.d.ts +++ b/examples/jsm/loaders/PDBLoader.d.ts @@ -1,22 +1,24 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export interface PDB { - geometryAtoms: BufferGeometry; - geometryBonds: BufferGeometry; - json: { - atoms: any[][], - bonds: number[][] - } + geometryAtoms: BufferGeometry; + geometryBonds: BufferGeometry; + json: { + atoms: any[][], + bonds: number[][] + } } export class PDBLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (pdb: PDB) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(text: string) : PDB; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( pdb: PDB ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( text: string ) : PDB; + } diff --git a/examples/jsm/loaders/PLYLoader.d.ts b/examples/jsm/loaders/PLYLoader.d.ts index 10fbb85c45b8211e8860ce8c18df0b2ba84fe419..9836303b37a4b1677c908b678b85dac8015539ac 100644 --- a/examples/jsm/loaders/PLYLoader.d.ts +++ b/examples/jsm/loaders/PLYLoader.d.ts @@ -1,15 +1,17 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class PLYLoader extends Loader { - constructor(manager?: LoadingManager); - propertyNameMapping: object; - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - setPropertyNameMapping(mapping: object) : void; - parse(data: ArrayBuffer | string) : BufferGeometry; + constructor( manager?: LoadingManager ); + propertyNameMapping: object; + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + setPropertyNameMapping( mapping: object ) : void; + parse( data: ArrayBuffer | string ) : BufferGeometry; + } diff --git a/examples/jsm/loaders/PRWMLoader.d.ts b/examples/jsm/loaders/PRWMLoader.d.ts index 41ad6d492ef70d18f67c630577e7e5a7d57c9244..6d738dd8b122d494275ef4506ec69bc702e61707 100644 --- a/examples/jsm/loaders/PRWMLoader.d.ts +++ b/examples/jsm/loaders/PRWMLoader.d.ts @@ -1,15 +1,17 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class PRWMLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: ArrayBuffer) : BufferGeometry; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer ) : BufferGeometry; + + static isBigEndianPlatform(): boolean; - static isBigEndianPlatform(): boolean; } diff --git a/examples/jsm/loaders/PVRLoader.d.ts b/examples/jsm/loaders/PVRLoader.d.ts index addc7d7be10d17d0267081a126d9b3ead2c5192c..bda0f100dcdbe2a9e790c641218daca2a5e91357 100644 --- a/examples/jsm/loaders/PVRLoader.d.ts +++ b/examples/jsm/loaders/PVRLoader.d.ts @@ -1,20 +1,22 @@ import { - LoadingManager, - CompressedTextureLoader, - CompressedPixelFormat + LoadingManager, + CompressedTextureLoader, + CompressedPixelFormat } from '../../../src/Three'; export interface PVR { - mipmaps: object[]; - width: number; - height: number; - format: CompressedPixelFormat; - mipmapCount: number; - isCubemap: boolean; + mipmaps: object[]; + width: number; + height: number; + format: CompressedPixelFormat; + mipmapCount: number; + isCubemap: boolean; } export class PVRLoader extends CompressedTextureLoader { - constructor(manager?: LoadingManager); - parse(buffer: ArrayBuffer, loadMipmaps: boolean): PVR; + constructor( manager?: LoadingManager ); + + parse( buffer: ArrayBuffer, loadMipmaps: boolean ): PVR; + } diff --git a/examples/jsm/loaders/RGBELoader.d.ts b/examples/jsm/loaders/RGBELoader.d.ts index def67a3e1cfe871717ed160807dd58913b586312..7c7b19ba9da2b83f411a6b000914c64ad58c2101 100644 --- a/examples/jsm/loaders/RGBELoader.d.ts +++ b/examples/jsm/loaders/RGBELoader.d.ts @@ -1,25 +1,27 @@ import { - LoadingManager, - DataTextureLoader, - TextureDataType, - PixelFormat + LoadingManager, + DataTextureLoader, + TextureDataType, + PixelFormat } from '../../../src/Three'; export interface RGBE { - width: number; - height: number; - data: Float32Array | Uint8Array; - header: string; - gamma: number; - exposure: number; - format: PixelFormat; - type: TextureDataType; + width: number; + height: number; + data: Float32Array | Uint8Array; + header: string; + gamma: number; + exposure: number; + format: PixelFormat; + type: TextureDataType; } export class RGBELoader extends DataTextureLoader { - constructor(manager?: LoadingManager); - type: TextureDataType; - parse(buffer: ArrayBuffer): RGBE; - setDataType(type: TextureDataType): this; + constructor( manager?: LoadingManager ); + type: TextureDataType; + + parse( buffer: ArrayBuffer ): RGBE; + setDataType( type: TextureDataType ): this; + } diff --git a/examples/jsm/loaders/STLLoader.d.ts b/examples/jsm/loaders/STLLoader.d.ts index d9a1be9c7676b8400d4ba115b8cdee09c626b78b..660937fc533dd5302b98bce9db1d7edf862f9214 100644 --- a/examples/jsm/loaders/STLLoader.d.ts +++ b/examples/jsm/loaders/STLLoader.d.ts @@ -1,13 +1,15 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class STLLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: ArrayBuffer | string) : BufferGeometry; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer | string ) : BufferGeometry; + } diff --git a/examples/jsm/loaders/SVGLoader.d.ts b/examples/jsm/loaders/SVGLoader.d.ts index 076317de10964b79012a5c9093c32592271f5c6d..7416593eade43ea6eacacd36cc41f443b0982ae5 100644 --- a/examples/jsm/loaders/SVGLoader.d.ts +++ b/examples/jsm/loaders/SVGLoader.d.ts @@ -1,31 +1,33 @@ import { - Loader, - LoadingManager, - ShapePath, - BufferGeometry, - Vector3 + Loader, + LoadingManager, + ShapePath, + BufferGeometry, + Vector3 } from '../../../src/Three'; export interface SVGResult { - paths: ShapePath[]; - xml: XMLDocument; + paths: ShapePath[]; + xml: XMLDocument; } export interface StrokeStyle { - strokeColor: string; - strokeWidth: number; - strokeLineJoin: string; - strokeLineCap: string; - strokeMiterLimit: number; + strokeColor: string; + strokeWidth: number; + strokeLineJoin: string; + strokeLineCap: string; + strokeMiterLimit: number; } export class SVGLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (data: SVGResult) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(text: string) : SVGResult; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( data: SVGResult ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( text: string ) : SVGResult; + + static getStrokeStyle( width: number, color: string, lineJoin: string, lineCap: string, miterLimit: number ): StrokeStyle; + static pointsToStroke( points: Vector3[], style: StrokeStyle, arcDivisions: number, minDistance: number ): BufferGeometry; + static pointsToStrokeWithBuffers( points: Vector3[], style: StrokeStyle, arcDivisions: number, minDistance: number, vertices: number[], normals: number[], uvs: number[], vertexOffset: number ): number; - static getStrokeStyle(width: number, color: string, lineJoin: string, lineCap: string, miterLimit: number): StrokeStyle; - static pointsToStroke(points: Vector3[], style: StrokeStyle, arcDivisions: number, minDistance: number ): BufferGeometry; - static pointsToStrokeWithBuffers(points: Vector3[], style: StrokeStyle, arcDivisions: number, minDistance: number, vertices: number[], normals: number[], uvs: number[], vertexOffset: number): number; } diff --git a/examples/jsm/loaders/TDSLoader.d.ts b/examples/jsm/loaders/TDSLoader.d.ts index e5a1b80da83a0c8f5fb671d358309124ee59de8a..0e558c51396dfaaa5dcd4e52decfa6bb48616632 100644 --- a/examples/jsm/loaders/TDSLoader.d.ts +++ b/examples/jsm/loaders/TDSLoader.d.ts @@ -1,44 +1,46 @@ import { - Color, - Group, - Loader, - LoadingManager, - Material, - Mesh, - Texture + Color, + Group, + Loader, + LoadingManager, + Material, + Mesh, + Texture } from '../../../src/Three'; export class TDSLoader extends Loader { - constructor(manager?: LoadingManager); - debug: boolean; - group: Group; - manager: LoadingManager; - materials: Material[]; - meshes: Mesh[]; - position: number; - load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(arraybuffer: ArrayBuffer, path: string): Group; + constructor( manager?: LoadingManager ); + debug: boolean; + group: Group; + manager: LoadingManager; + materials: Material[]; + meshes: Mesh[]; + position: number; + + load( url: string, onLoad: ( object: Group ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( arraybuffer: ArrayBuffer, path: string ): Group; + + debugMessage( message: object ): void; + endChunk( chunk: object ): void; + nextChunk( data: DataView, chunk: object ): void; + readByte( data: DataView ): number; + readChunk( data: DataView ): object; + readColor( data: DataView ): Color; + readDWord( data: DataView ): number; + readFaceArray( data: DataView, mesh: Mesh ): void; + readFile( arraybuffer: ArrayBuffer, path: string ): void; + readFloat( data: DataView ): number; + readInt( data: DataView ): number; + readMap( data: DataView, path: string ): Texture; + readMesh( data: DataView ): Mesh; + readMeshData( data: DataView, path: string ): void; + readMaterialEntry( data: DataView, path: string ): void; + readMaterialGroup( data: DataView ): object; + readNamedObject( data: DataView ): void; + readShort( data: DataView ): number; + readString( data: DataView, maxLength: number ): string; + readWord( data: DataView ): number; + resetPosition(): void; - debugMessage(message: object): void; - endChunk(chunk: object): void; - nextChunk(data: DataView, chunk: object): void; - readByte(data: DataView): number; - readChunk(data: DataView): object; - readColor(data: DataView): Color; - readDWord(data: DataView): number; - readFaceArray(data: DataView, mesh: Mesh): void; - readFile(arraybuffer: ArrayBuffer, path: string): void; - readFloat(data: DataView): number; - readInt(data: DataView): number; - readMap(data: DataView, path: string): Texture; - readMesh(data: DataView): Mesh; - readMeshData(data: DataView, path: string): void; - readMaterialEntry(data: DataView, path: string): void; - readMaterialGroup(data: DataView): object; - readNamedObject(data: DataView): void; - readShort(data: DataView): number; - readString(data: DataView, maxLength: number): string; - readWord(data: DataView): number; - resetPosition(): void; } diff --git a/examples/jsm/loaders/TGALoader.d.ts b/examples/jsm/loaders/TGALoader.d.ts index 1fe0f5258c65d26f3f1b074150258653c87ff03e..ab3e6e7afacebddd3db060cb6cca62fb66f3af2a 100644 --- a/examples/jsm/loaders/TGALoader.d.ts +++ b/examples/jsm/loaders/TGALoader.d.ts @@ -1,12 +1,14 @@ import { - Texture, - Loader, - LoadingManager + Texture, + Loader, + LoadingManager } from '../../../src/Three'; export class TGALoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (texture: Texture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: ArrayBuffer) : Texture; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( texture: Texture ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer ) : Texture; + } diff --git a/examples/jsm/loaders/TTFLoader.d.ts b/examples/jsm/loaders/TTFLoader.d.ts index 2c47dd06c182ca95e230242b909b769ec1253f20..617970b120cf84da549433f63b8d6c8fb81e1f54 100644 --- a/examples/jsm/loaders/TTFLoader.d.ts +++ b/examples/jsm/loaders/TTFLoader.d.ts @@ -1,13 +1,15 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class TTFLoader extends Loader { - constructor(manager?: LoadingManager); - reversed: boolean; - load(url: string, onLoad: (json: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(arraybuffer: ArrayBuffer): object; + constructor( manager?: LoadingManager ); + reversed: boolean; + + load( url: string, onLoad: ( json: object ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( arraybuffer: ArrayBuffer ): object; + } diff --git a/examples/jsm/loaders/VRMLLoader.d.ts b/examples/jsm/loaders/VRMLLoader.d.ts index 30735bc2e5aacc25650de37cfbf6dc1b3dd22a87..69a91e4e27e80d36c68d22c04009afabd37c5d12 100644 --- a/examples/jsm/loaders/VRMLLoader.d.ts +++ b/examples/jsm/loaders/VRMLLoader.d.ts @@ -1,12 +1,14 @@ import { - Scene, - Loader, - LoadingManager + Scene, + Loader, + LoadingManager } from '../../../src/Three'; export class VRMLLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(data: string, path: string) : Scene; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( scene: Scene ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: string, path: string ) : Scene; + } diff --git a/examples/jsm/loaders/VRMLoader.d.ts b/examples/jsm/loaders/VRMLoader.d.ts index 76004fa7ef887b805fbdbe4115ee7e2b18ce5292..5b8272d280f97828aa6ac9cabfe38ef8c0e551ed 100644 --- a/examples/jsm/loaders/VRMLoader.d.ts +++ b/examples/jsm/loaders/VRMLoader.d.ts @@ -1,16 +1,18 @@ import { - Loader, - LoadingManager + Loader, + LoadingManager } from '../../../src/Three'; import { GLTFLoader, GLTF } from './GLTFLoader'; import { DRACOLoader } from './DRACOLoader'; export class VRMLoader extends Loader { - constructor(manager?: LoadingManager); - gltfLoader: GLTFLoader; - load(url: string, onLoad: (scene: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void; - parse(gltf: GLTF, onLoad: (scene: GLTF) => void): void; - setDRACOLoader(dracoLoader: DRACOLoader): this; + constructor( manager?: LoadingManager ); + gltfLoader: GLTFLoader; + + load( url: string, onLoad: ( scene: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( gltf: GLTF, onLoad: ( scene: GLTF ) => void ): void; + setDRACOLoader( dracoLoader: DRACOLoader ): this; + } diff --git a/examples/jsm/loaders/VTKLoader.d.ts b/examples/jsm/loaders/VTKLoader.d.ts index 7b72ffaa8bd22f5882a06a4a532adf35e38b17b3..08a749ce4f6786ae129b22734bfded22f50c1be1 100644 --- a/examples/jsm/loaders/VTKLoader.d.ts +++ b/examples/jsm/loaders/VTKLoader.d.ts @@ -1,12 +1,14 @@ import { - BufferGeometry, - Loader, - LoadingManager + BufferGeometry, + Loader, + LoadingManager } from '../../../src/Three'; export class VTKLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer | string, path: string): BufferGeometry; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( geometry: BufferGeometry ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer | string, path: string ): BufferGeometry; + } diff --git a/examples/jsm/loaders/XLoader.d.ts b/examples/jsm/loaders/XLoader.d.ts index d972d7800a285e7d99724e0c2029cd1702753260..6cf33b8bfacc15688e63a36ecc455f4040737e51 100644 --- a/examples/jsm/loaders/XLoader.d.ts +++ b/examples/jsm/loaders/XLoader.d.ts @@ -1,17 +1,19 @@ import { - Mesh, - Loader, - LoadingManager + Mesh, + Loader, + LoadingManager } from '../../../src/Three'; export interface XResult { - animations: object[]; - models: Mesh[]; + animations: object[]; + models: Mesh[]; } export class XLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (object: XResult) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer | string, onLoad: (object: object) => void): object; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( object: XResult ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer | string, onLoad: ( object: object ) => void ): object; + } diff --git a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts index bd3a611b0feca557ee9320f6679c2324a95291cf..7c1bfc517d803333bb50098242c0c46f6881698a 100644 --- a/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts +++ b/examples/jsm/loaders/deprecated/LegacyGLTFLoader.d.ts @@ -1,21 +1,23 @@ import { - AnimationClip, - Camera, - Loader, - LoadingManager, - Scene + AnimationClip, + Camera, + Loader, + LoadingManager, + Scene } from '../../../../src/Three'; export interface GLTF { - animations: AnimationClip[]; - scene: Scene; - scenes: Scene[]; - cameras: Camera[]; + animations: AnimationClip[]; + scene: Scene; + scenes: Scene[]; + cameras: Camera[]; } export class LegacyGLTFLoader extends Loader { - constructor(manager?: LoadingManager); - load(url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(data: ArrayBuffer | string, path: string, callback: (gltf: GLTF) => void): void; + constructor( manager?: LoadingManager ); + + load( url: string, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( data: ArrayBuffer | string, path: string, callback: ( gltf: GLTF ) => void ): void; + } diff --git a/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts b/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts index cba206499f3c7c81ec9b08ffc0a184974022db85..57e83625b014fc08742e11aba376dbf5baeed3a1 100644 --- a/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts +++ b/examples/jsm/loaders/deprecated/LegacyJSONLoader.d.ts @@ -1,19 +1,21 @@ import { - Geometry, - Loader, - LoadingManager, - Material + Geometry, + Loader, + LoadingManager, + Material } from '../../../../src/Three'; export interface LegacyJSONLoaderResult { - geometry: Geometry; - materials: Material[]; + geometry: Geometry; + materials: Material[]; } export class LegacyJSONLoader extends Loader { - constructor(manager?: LoadingManager); - withCredentials: boolean; - load(url: string, onLoad: (geometry: Geometry, materials: Material[]) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(json: object, path: string): LegacyJSONLoaderResult; + constructor( manager?: LoadingManager ); + withCredentials: boolean; + + load( url: string, onLoad: ( geometry: Geometry, materials: Material[] ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void; + parse( json: object, path: string ): LegacyJSONLoaderResult; + } diff --git a/examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts b/examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts index a92df3cb109f0a3409f4fa88dd272bfa61476ae2..3ed3d3a618449cd150aac4adcd6f5157c8ea816e 100644 --- a/examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts +++ b/examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts @@ -1,8 +1,8 @@ import { - MaterialCreator + MaterialCreator } from '../../MTLLoader'; export namespace MtlObjBridge { - export function link(processResult: object, assetLoader: object): void; - export function addMaterialsFromMtlLoader(materialCreator: MaterialCreator): object; + export function link( processResult: object, assetLoader: object ): void; + export function addMaterialsFromMtlLoader( materialCreator: MaterialCreator ): object; } diff --git a/examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts b/examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts index 622b53606aab9b5c9ef8721fefc8d7d301f10389..0753be90cb96cb370b7e22d6e0a3083b2794a5be 100644 --- a/examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts +++ b/examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts @@ -1,24 +1,26 @@ import { - Material + Material } from '../../../../../src/Three'; export class MaterialHandler { - constructor(); - logging: { - enabled: boolean; - debug: boolean; - }; - callbacks: { - onLoadMaterials: Function; - }; - materials: object; - createDefaultMaterials(overrideExisting: boolean): void; - addMaterials(materials: object, overrideExisting: boolean, newMaterials: object): object; - addPayloadMaterials(materialPayload: object): object; - setLogging(enabled: boolean, debug: boolean): void; - getMaterials(): object; - getMaterial(materialName: string): Material; - getMaterialsJSON(): object; - clearMaterials(): void; + constructor(); + logging: { + enabled: boolean; + debug: boolean; + }; + callbacks: { + onLoadMaterials: Function; + }; + materials: object; + + createDefaultMaterials( overrideExisting: boolean ): void; + addMaterials( materials: object, overrideExisting: boolean, newMaterials: object ): object; + addPayloadMaterials( materialPayload: object ): object; + setLogging( enabled: boolean, debug: boolean ): void; + getMaterials(): object; + getMaterial( materialName: string ): Material; + getMaterialsJSON(): object; + clearMaterials(): void; + } diff --git a/examples/jsm/loaders/obj2/shared/MaterialHandler.js b/examples/jsm/loaders/obj2/shared/MaterialHandler.js index 3917c706e2f107190d2e418bee1eb9d694a47dbf..9e3e4aeafd7dd64fc9dbf512cb94084ffcbc48cc 100644 --- a/examples/jsm/loaders/obj2/shared/MaterialHandler.js +++ b/examples/jsm/loaders/obj2/shared/MaterialHandler.js @@ -114,7 +114,7 @@ MaterialHandler.prototype = { } else { - if ( this.logging.enabled) { + if ( this.logging.enabled ) { console.info( 'Requested material "' + materialNameOrg + '" is not available!' ); @@ -255,7 +255,9 @@ MaterialHandler.prototype = { * Removes all materials */ clearMaterials: function () { + this.materials = {}; + } }; diff --git a/examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts b/examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts index 540021972c203e87194ade49e113e3274778f6c9..34ffb4f3dae8faab74bc1a5ffb54a0ba762d84e2 100644 --- a/examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts +++ b/examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts @@ -1,22 +1,23 @@ import { - Mesh + Mesh } from '../../../../../src/Three'; -import { MaterialHandler } from './MaterialHandler' +import { MaterialHandler } from './MaterialHandler'; export class MeshReceiver { - constructor(materialHandler: MaterialHandler); - logging: { - enabled: boolean; - debug: boolean; - }; - callbacks: { - onParseProgress: Function; - onMeshAlter: Function; - }; - materialHandler: MaterialHandler; - buildMeshes(meshPayload: object): Mesh[]; - setLogging(enabled: boolean, debug: boolean): void; + constructor( materialHandler: MaterialHandler ); + logging: { + enabled: boolean; + debug: boolean; + }; + callbacks: { + onParseProgress: Function; + onMeshAlter: Function; + }; + materialHandler: MaterialHandler; + + buildMeshes( meshPayload: object ): Mesh[]; + setLogging( enabled: boolean, debug: boolean ): void; } diff --git a/examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts b/examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts index b6da013bf48ecf5b9f345ef7efedca41bf2f34a7..82bb00c13b9ffaa7d65a13b2a968ee06792ba360 100644 --- a/examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts +++ b/examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts @@ -1,10 +1,11 @@ export namespace CodeSerializer { - export function serializeObject(fullName: string, serializationTarget: object): string; - export function serializeClass(fullObjectName: string, serializationTarget: object, basePrototypeName?: string, overrideFunctions?: CodeSerializationInstruction[]): string; + export function serializeObject( fullName: string, serializationTarget: object ): string; + export function serializeClass( fullObjectName: string, serializationTarget: object, basePrototypeName?: string, overrideFunctions?: CodeSerializationInstruction[] ): string; } export class CodeSerializationInstruction { - constructor(name: string, fullName: string); + + constructor( name: string, fullName: string ); name: string; fullName: string; code: string; @@ -12,8 +13,9 @@ export class CodeSerializationInstruction { getName(): string; getFullName(): string; - setCode(code: string): this; + setCode( code: string ): this; getCode(): string; - setRemoveCode(removeCode: boolean): this; + setRemoveCode( removeCode: boolean ): this; isRemoveCode(): boolean; + } diff --git a/examples/jsm/loaders/obj2/utils/ObjectManipulator.d.ts b/examples/jsm/loaders/obj2/utils/ObjectManipulator.d.ts index 46332a72ba93f9c3fab4c24b19c38eab22ff9646..53023520afbed414f324e9bd845389434fd038ea 100644 --- a/examples/jsm/loaders/obj2/utils/ObjectManipulator.d.ts +++ b/examples/jsm/loaders/obj2/utils/ObjectManipulator.d.ts @@ -1,3 +1,3 @@ export namespace ObjectManipulator { - export function applyProperties(objToAlter: object, params: object, forceCreation: boolean): void; + export function applyProperties( objToAlter: object, params: object, forceCreation: boolean ): void; } diff --git a/examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts b/examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts index 021f0a6ed3d920843d8c9eb1ad03d9aa4ccd0fd6..38c1d8b16c1edc600150d83b4b26ca3746e96cf9 100644 --- a/examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts +++ b/examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts @@ -1,59 +1,63 @@ export class CodeBuilderInstructions { - constructor(supportsStandardWorker: boolean, supportsJsmWorker: boolean, preferJsmWorker: boolean); - supportsStandardWorker: boolean; - supportsJsmWorker: boolean; - preferJsmWorker: boolean; - startCode: string; - codeFragments: string[]; - importStatements: string[]; - jsmWorkerFile: string; - defaultGeometryType: number; - - isSupportsStandardWorker(): boolean; - isSupportsJsmWorker(): boolean; - isPreferJsmWorker(): boolean; - setJsmWorkerFile(jsmWorkerFile: string): void; - addStartCode(startCode: string): void; - addCodeFragment(code: string): void; - addLibraryImport(libraryPath: string): void; - getImportStatements(): string[]; - getCodeFragments(): string[]; - getStartCode(): string; + + constructor( supportsStandardWorker: boolean, supportsJsmWorker: boolean, preferJsmWorker: boolean ); + supportsStandardWorker: boolean; + supportsJsmWorker: boolean; + preferJsmWorker: boolean; + startCode: string; + codeFragments: string[]; + importStatements: string[]; + jsmWorkerFile: string; + defaultGeometryType: number; + + isSupportsStandardWorker(): boolean; + isSupportsJsmWorker(): boolean; + isPreferJsmWorker(): boolean; + setJsmWorkerFile( jsmWorkerFile: string ): void; + addStartCode( startCode: string ): void; + addCodeFragment( code: string ): void; + addLibraryImport( libraryPath: string ): void; + getImportStatements(): string[]; + getCodeFragments(): string[]; + getStartCode(): string; + } export class WorkerExecutionSupport { - constructor(); - - logging: { - enabled: boolean; - debug: boolean; - }; - - worker: { - native: Worker; - jsmWorker: boolean; - logging: boolean; - workerRunner: { - name: string; - usesMeshDisassembler: boolean; - defaultGeometryType: number; - }; - terminateWorkerOnLoad: boolean; - forceWorkerDataCopy: boolean; - started: boolean; - queuedMessage: object; - callbacks: { - onAssetAvailable: Function; - onLoad: Function; - terminate: Function; - }; - }; - - setLogging(enabled: boolean, debug: boolean): this; - setForceWorkerDataCopy(forceWorkerDataCopy: boolean): this; - setTerminateWorkerOnLoad(terminateWorkerOnLoad: boolean): this; - updateCallbacks(onAssetAvailable: Function, onLoad: Function): void; - buildWorker(codeBuilderInstructions: CodeBuilderInstructions): void; - isWorkerLoaded(requireJsmWorker: boolean): boolean; - executeParallel(payload:object, transferables?: object[]); + + constructor(); + + logging: { + enabled: boolean; + debug: boolean; + }; + + worker: { + native: Worker; + jsmWorker: boolean; + logging: boolean; + workerRunner: { + name: string; + usesMeshDisassembler: boolean; + defaultGeometryType: number; + }; + terminateWorkerOnLoad: boolean; + forceWorkerDataCopy: boolean; + started: boolean; + queuedMessage: object; + callbacks: { + onAssetAvailable: Function; + onLoad: Function; + terminate: Function; + }; + }; + + setLogging( enabled: boolean, debug: boolean ): this; + setForceWorkerDataCopy( forceWorkerDataCopy: boolean ): this; + setTerminateWorkerOnLoad( terminateWorkerOnLoad: boolean ): this; + updateCallbacks( onAssetAvailable: Function, onLoad: Function ): void; + buildWorker( codeBuilderInstructions: CodeBuilderInstructions ): void; + isWorkerLoaded( requireJsmWorker: boolean ): boolean; + executeParallel( payload:object, transferables?: object[] ); + } diff --git a/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.d.ts b/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.d.ts index ec4fbb8c068513910815aec6806317f1c03da52a..cc33773140ba21f3d9bd1f3c5bdb04dfc56bf11f 100644 --- a/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.d.ts +++ b/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.d.ts @@ -1,72 +1,74 @@ export class OBJLoader2Parser { - constructor(); - callbacks: { - onProgress: Function; - onAssetAvailable: Function; - onError: Function; - onLoad: Function; - }; - contentRef: Uint8Array; - legacyMode: boolean; - materials: object; - materialPerSmoothingGroup: boolean; - useOAsMesh: boolean; - useIndices: boolean; - disregardNormals: boolean; - vertices: number[]; - colors: number[]; - normals: number[]; - uvs: number[]; + constructor(); + callbacks: { + onProgress: Function; + onAssetAvailable: Function; + onError: Function; + onLoad: Function; + }; + contentRef: Uint8Array; + legacyMode: boolean; + materials: object; + materialPerSmoothingGroup: boolean; + useOAsMesh: boolean; + useIndices: boolean; + disregardNormals: boolean; - rawMesh: { - objectName: string; - groupName: string; - activeMtlName: string; - mtllibName: string; - faceType: number; - subGroups: object[]; - subGroupInUse: object; - smoothingGroup: { - splitMaterials: boolean; - normalized: boolean; - real: boolean; - }; - counts: { - doubleIndicesCount: number; - faceCount: number; - mtlCount: number; - smoothingGroupCount: number; - } - }; + vertices: number[]; + colors: number[]; + normals: number[]; + uvs: number[]; - inputObjectCount: number; - outputObjectCount: number; - globalCounts: { - vertices: number; - faces: number; - doubleIndicesCount: number; - lineByte: number; - currentByte: number; - totalBytes: number; - }; + rawMesh: { + objectName: string; + groupName: string; + activeMtlName: string; + mtllibName: string; + faceType: number; + subGroups: object[]; + subGroupInUse: object; + smoothingGroup: { + splitMaterials: boolean; + normalized: boolean; + real: boolean; + }; + counts: { + doubleIndicesCount: number; + faceCount: number; + mtlCount: number; + smoothingGroupCount: number; + } + }; - logging: { - enabled: boolean; - debug: boolean; - }; + inputObjectCount: number; + outputObjectCount: number; + globalCounts: { + vertices: number; + faces: number; + doubleIndicesCount: number; + lineByte: number; + currentByte: number; + totalBytes: number; + }; - setMaterialPerSmoothingGroup(materialPerSmoothingGroup: boolean): this; - setUseOAsMesh(useOAsMesh: boolean): this; - setUseIndices(useIndices: boolean): this; - setDisregardNormals(disregardNormals: boolean): this; + logging: { + enabled: boolean; + debug: boolean; + }; + + setMaterialPerSmoothingGroup( materialPerSmoothingGroup: boolean ): this; + setUseOAsMesh( useOAsMesh: boolean ): this; + setUseIndices( useIndices: boolean ): this; + setDisregardNormals( disregardNormals: boolean ): this; + + setCallbackOnAssetAvailable( onAssetAvailable: Function ): this; + setCallbackOnProgress( onProgress: Function ): this; + setCallbackOnError( onError: Function ): this; + setCallbackOnLoad( onLoad: Function ): this; + setLogging( enabled: boolean, debug: boolean ): this; + setMaterials( materials: Object ): void; + execute( arrayBuffer: Uint8Array ): void; + executeLegacy( text: string ): void; - setCallbackOnAssetAvailable(onAssetAvailable: Function): this; - setCallbackOnProgress(onProgress: Function): this; - setCallbackOnError(onError: Function): this; - setCallbackOnLoad(onLoad: Function): this; - setLogging(enabled: boolean, debug: boolean): this; - setMaterials(materials: Object): void; - execute(arrayBuffer: Uint8Array): void; - executeLegacy(text: string): void; } diff --git a/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js b/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js index 53cb4198823d914525f4c222df9047f138e8d97d..25cdbf6c3d6a0fb9ad565cc20a4e748f48912395 100644 --- a/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js +++ b/examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js @@ -16,16 +16,24 @@ const OBJLoader2Parser = function () { let scope = this; this.callbacks = { onProgress: function ( text ) { - scope._onProgress( text ) + + scope._onProgress( text ); + }, onAssetAvailable: function ( payload ) { - scope._onAssetAvailable( payload ) + + scope._onAssetAvailable( payload ); + }, onError: function ( errorMessage ) { - scope._onError( errorMessage ) + + scope._onError( errorMessage ); + }, onLoad: function ( object3d, message ) { - scope._onLoad( object3d, message ) + + scope._onLoad( object3d, message ); + }, }; this.contentRef = null; diff --git a/examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts b/examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts index 8285866841645be9b482aa80bb1f736e75764402..6b05b70bd66060c4c4b7fde61e798e674ffb840d 100644 --- a/examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts +++ b/examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts @@ -1,24 +1,28 @@ import { OBJLoader2Parser } from './OBJLoader2Parser'; export class DefaultWorkerPayloadHandler { - constructor(parser: OBJLoader2Parser); - logging: { - enabled: boolean; - debug: boolean; - }; - parser: OBJLoader2Parser; - - handlePayload(payload: object): void; + + constructor( parser: OBJLoader2Parser ); + logging: { + enabled: boolean; + debug: boolean; + }; + parser: OBJLoader2Parser; + + handlePayload( payload: object ): void; + } export class WorkerRunner { - constructor(payloadHandler: object); - logging: { - enabled: boolean; - debug: boolean; - }; - resourceDescriptors: OBJLoader2Parser; - payloadHandler: object; - - processMessage(payload: object): void; + + constructor( payloadHandler: object ); + logging: { + enabled: boolean; + debug: boolean; + }; + resourceDescriptors: OBJLoader2Parser; + payloadHandler: object; + + processMessage( payload: object ): void; + } diff --git a/examples/jsm/math/ColorConverter.d.ts b/examples/jsm/math/ColorConverter.d.ts index 3b2ff9aa1d17863108dd13f0582456792afbb505..bd00fc7f9974d284e82289ab6801e607dd348860 100644 --- a/examples/jsm/math/ColorConverter.d.ts +++ b/examples/jsm/math/ColorConverter.d.ts @@ -1,25 +1,25 @@ import { - Color + Color } from '../../../src/Three'; export interface HSL { - h: number; - s: number; - l: number; + h: number; + s: number; + l: number; } export interface CMYK { - c: number; - m: number; - y: number; - k: number; + c: number; + m: number; + y: number; + k: number; } export namespace ColorConverter { - export function setHSV(color: Color, h: number, s: number, v: number): Color; - export function getHSV(color: Color, target: HSL): HSL; - export function setCMYK(color: Color, c: number, m: number, y: number, k: number): Color; - export function getCMYK(color: Color, target: CMYK): CMYK; + export function setHSV( color: Color, h: number, s: number, v: number ): Color; + export function getHSV( color: Color, target: HSL ): HSL; + export function setCMYK( color: Color, c: number, m: number, y: number, k: number ): Color; + export function getCMYK( color: Color, target: CMYK ): CMYK; } diff --git a/examples/jsm/math/ConvexHull.d.ts b/examples/jsm/math/ConvexHull.d.ts index 028538979c1e78c88faa0e6c6e4e11becebecc0a..3abf69bd56642a4d546bbb2d221cba93cbc3d41f 100644 --- a/examples/jsm/math/ConvexHull.d.ts +++ b/examples/jsm/math/ConvexHull.d.ts @@ -1,93 +1,103 @@ import { - Object3D, - Ray, - Vector3 + Object3D, + Ray, + Vector3 } from '../../../src/Three'; declare class Face { - constructor(); - normal: Vector3; - midpoint: Vector3; - area: number; - constant: number; - outside: VertexNode; - mark: number; - edge: HalfEdge; - - static create(a: VertexNode, b: VertexNode, c: VertexNode): Face; - - compute(): this; - getEdge(i: number): HalfEdge; + + constructor(); + normal: Vector3; + midpoint: Vector3; + area: number; + constant: number; + outside: VertexNode; + mark: number; + edge: HalfEdge; + + static create( a: VertexNode, b: VertexNode, c: VertexNode ): Face; + + compute(): this; + getEdge( i: number ): HalfEdge; + } declare class HalfEdge { - constructor(vertex: VertexNode, face: Face); - vertex: VertexNode; - prev: HalfEdge; - next: HalfEdge; - twin: HalfEdge; - face: Face; - - head(): VertexNode; - length(): number; - lengthSquared(): number; - setTwin(edge: HalfEdge): this; - tail(): VertexNode; + + constructor( vertex: VertexNode, face: Face ); + vertex: VertexNode; + prev: HalfEdge; + next: HalfEdge; + twin: HalfEdge; + face: Face; + + head(): VertexNode; + length(): number; + lengthSquared(): number; + setTwin( edge: HalfEdge ): this; + tail(): VertexNode; + } declare class VertexNode { - constructor(point: Vector3); - point: Vector3; - prev: VertexNode; - next: VertexNode; - face: Face; + + constructor( point: Vector3 ); + point: Vector3; + prev: VertexNode; + next: VertexNode; + face: Face; + } declare class VertexList { - constructor(); - head: VertexNode; - tail: VertexNode; - - append(vertex: VertexNode): this; - appendChain(vertex: VertexNode): this; - clear(): this; - first(): VertexNode; - insertAfter(target: VertexNode, vertex: VertexNode): this; - insertBefore(target: VertexNode, vertex: VertexNode): this; - isEmpty(): boolean; - last(): VertexNode; - remove(vertex: VertexNode): this; - removeSubList(a: VertexNode, b: VertexNode): this; + + constructor(); + head: VertexNode; + tail: VertexNode; + + append( vertex: VertexNode ): this; + appendChain( vertex: VertexNode ): this; + clear(): this; + first(): VertexNode; + insertAfter( target: VertexNode, vertex: VertexNode ): this; + insertBefore( target: VertexNode, vertex: VertexNode ): this; + isEmpty(): boolean; + last(): VertexNode; + remove( vertex: VertexNode ): this; + removeSubList( a: VertexNode, b: VertexNode ): this; + } export class ConvexHull { - constructor(); - tolerance: number; - faces: Face[]; - newFaces: Face[]; - assigned: VertexList; - unassigned: VertexList; - vertices: VertexNode[]; - - addAdjoiningFace(eyeVertex: VertexNode, horizonEdge: HalfEdge): HalfEdge; - addNewFaces(eyeVertex: VertexNode, horizon: HalfEdge[]): this; - addVertexToFace(vertex: VertexNode, face: Face): this; - addVertexToHull(eyeVertex: VertexNode): this; - cleanup(): this; - compute(): this; - computeExtremes(): object; - computeHorizon(eyePoint: Vector3, crossEdge: HalfEdge, face: Face, horizon: HalfEdge[]): this; - computeInitialHull(): this; - containsPoint(point: Vector3): boolean; - deleteFaceVertices(face: Face, absorbingFace: Face): this; - intersectRay(ray: Ray, target: Vector3): Vector3 | null; - intersectsRay(ray: Ray): boolean; - makeEmpty(): this; - nextVertexToAdd(): VertexNode | undefined; - reindexFaces(): this; - removeAllVerticesFromFace(face: Face): VertexNode | undefined; - removeVertexFromFace(vertex: VertexNode, face: Face): this; - resolveUnassignedPoints(newFaces: Face[]): this; - setFromPoints(points: Vector3[]): this; - setFromObject(object: Object3D): this; + + constructor(); + tolerance: number; + faces: Face[]; + newFaces: Face[]; + assigned: VertexList; + unassigned: VertexList; + vertices: VertexNode[]; + + addAdjoiningFace( eyeVertex: VertexNode, horizonEdge: HalfEdge ): HalfEdge; + addNewFaces( eyeVertex: VertexNode, horizon: HalfEdge[] ): this; + addVertexToFace( vertex: VertexNode, face: Face ): this; + addVertexToHull( eyeVertex: VertexNode ): this; + cleanup(): this; + compute(): this; + computeExtremes(): object; + computeHorizon( eyePoint: Vector3, crossEdge: HalfEdge, face: Face, horizon: HalfEdge[] ): this; + computeInitialHull(): this; + containsPoint( point: Vector3 ): boolean; + deleteFaceVertices( face: Face, absorbingFace: Face ): this; + intersectRay( ray: Ray, target: Vector3 ): Vector3 | null; + intersectsRay( ray: Ray ): boolean; + makeEmpty(): this; + nextVertexToAdd(): VertexNode | undefined; + reindexFaces(): this; + removeAllVerticesFromFace( face: Face ): VertexNode | undefined; + removeVertexFromFace( vertex: VertexNode, face: Face ): this; + resolveUnassignedPoints( newFaces: Face[] ): this; + setFromPoints( points: Vector3[] ): this; + setFromObject( object: Object3D ): this; + } diff --git a/examples/jsm/math/ImprovedNoise.d.ts b/examples/jsm/math/ImprovedNoise.d.ts index 45652889089b0b1e9140468333f6a2bb55d8bb66..af46e63b6263c76fca63049084de5cadc960cc59 100644 --- a/examples/jsm/math/ImprovedNoise.d.ts +++ b/examples/jsm/math/ImprovedNoise.d.ts @@ -1,4 +1,6 @@ export class ImprovedNoise { - constructor(); - noise(x: number, y: number, z: number): number; + + constructor(); + noise( x: number, y: number, z: number ): number; + } diff --git a/examples/jsm/math/Lut.d.ts b/examples/jsm/math/Lut.d.ts index c6285b403bb6aa898d46c3aa88fccb19140d417d..767465209dea9429389ccca7082568ea6d4ae26c 100644 --- a/examples/jsm/math/Lut.d.ts +++ b/examples/jsm/math/Lut.d.ts @@ -1,29 +1,31 @@ import { - Color + Color } from '../../../src/Three'; export class Lut { - constructor(colormap?: string, numberofcolors?: number); - lut: Color[]; - map: object[]; - n: number; - minV: number; - maxV: number; - set(value: Lut): this; - setMin(min: number): this; - setMax(max: number): this; - setColorMap(colormap?: string, numberofcolors?: number): this; - copy(lut: Lut): this; - getColor(alpha: number): Color; - addColorMap(colormapName: string, arrayOfColors: number[][]): void; - createCanvas(): HTMLCanvasElement; - updateCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement; + constructor( colormap?: string, numberofcolors?: number ); + lut: Color[]; + map: object[]; + n: number; + minV: number; + maxV: number; + + set( value: Lut ): this; + setMin( min: number ): this; + setMax( max: number ): this; + setColorMap( colormap?: string, numberofcolors?: number ): this; + copy( lut: Lut ): this; + getColor( alpha: number ): Color; + addColorMap( colormapName: string, arrayOfColors: number[][] ): void; + createCanvas(): HTMLCanvasElement; + updateCanvas( canvas: HTMLCanvasElement ): HTMLCanvasElement; + } export interface ColorMapKeywords { - rainbow: number[][]; - cooltowarm: number[][]; - blackbody: number[][]; - grayscale: number[][]; + rainbow: number[][]; + cooltowarm: number[][]; + blackbody: number[][]; + grayscale: number[][]; } diff --git a/examples/jsm/math/SimplexNoise.d.ts b/examples/jsm/math/SimplexNoise.d.ts index 129311fa9d6810e9482afa091f53367721a2e188..6085f669202eb8ca462d254b8b712170a1f9c259 100644 --- a/examples/jsm/math/SimplexNoise.d.ts +++ b/examples/jsm/math/SimplexNoise.d.ts @@ -1,9 +1,11 @@ export class SimplexNoise { - constructor(r?: object); - dot(g: number[], x: number, y: number): number; - dot3(g: number[], x: number, y: number, z: number): number; - dot4(g: number[], x: number, y: number, z: number, w: number): number; - noise(xin: number, yin: number): number; - noise3d(xin: number, yin: number, zin: number): number; - noise4d(x: number, y: number, z: number, w: number): number; + + constructor( r?: object ); + dot( g: number[], x: number, y: number ): number; + dot3( g: number[], x: number, y: number, z: number ): number; + dot4( g: number[], x: number, y: number, z: number, w: number ): number; + noise( xin: number, yin: number ): number; + noise3d( xin: number, yin: number, zin: number ): number; + noise4d( x: number, y: number, z: number, w: number ): number; + } diff --git a/examples/jsm/misc/CarControls.d.ts b/examples/jsm/misc/CarControls.d.ts index cac818f1180721c33b610bcd6a2d47d92e05644a..75eb2227cd92febd5c1b356a29b4dfc141b402a5 100644 --- a/examples/jsm/misc/CarControls.d.ts +++ b/examples/jsm/misc/CarControls.d.ts @@ -1,21 +1,22 @@ import { - Object3D, + Object3D, } from '../../../src/Three'; export class CarControls { - constructor( maxSpeed?: number, acceleration?: number, brakePower?: number, turningRadius?: number, keys?: object ); - // API - enabled: boolean; - elemNames: object; - maxSpeed: number; - acceleration: number; - turningRadius: number; - brakePower: number; - speed: number; + constructor( maxSpeed?: number, acceleration?: number, brakePower?: number, turningRadius?: number, keys?: object ); - dispose(): void; - update( delta: number ): void; - setModel ( model: Object3D, elemNames: object ): void; + // API + enabled: boolean; + elemNames: object; + maxSpeed: number; + acceleration: number; + turningRadius: number; + brakePower: number; + speed: number; + + dispose(): void; + update( delta: number ): void; + setModel ( model: Object3D, elemNames: object ): void; } diff --git a/examples/jsm/misc/ConvexObjectBreaker.d.ts b/examples/jsm/misc/ConvexObjectBreaker.d.ts index c4ad9606b16f72d32fb7a5a29c82fc72f4cb268e..ea82580e0908cb5d88f6464daacb32bd44fb348c 100644 --- a/examples/jsm/misc/ConvexObjectBreaker.d.ts +++ b/examples/jsm/misc/ConvexObjectBreaker.d.ts @@ -1,17 +1,19 @@ import { - Object3D, - Plane, - Vector3 + Object3D, + Plane, + Vector3 } from '../../../src/Three'; export interface CutByPlaneOutput { - object1: Object3D; - object2: Object3D; + object1: Object3D; + object2: Object3D; } export class ConvexObjectBreaker { - constructor(minSizeForBreak?: number, smallDelta?: number); - prepareBreakableObject(object: Object3D, mass: number, velocity: Vector3, angularVelocity: Vector3, breakable: boolean): void; - subdivideByImpact(object: Object3D, pointOfImpact: Vector3, normal: Vector3, maxRadialIterations: number, maxRandomIterations: number): Object3D[]; - cutByPlane(object: Object3D, plane: Plane, output: CutByPlaneOutput): number; + + constructor( minSizeForBreak?: number, smallDelta?: number ); + prepareBreakableObject( object: Object3D, mass: number, velocity: Vector3, angularVelocity: Vector3, breakable: boolean ): void; + subdivideByImpact( object: Object3D, pointOfImpact: Vector3, normal: Vector3, maxRadialIterations: number, maxRandomIterations: number ): Object3D[]; + cutByPlane( object: Object3D, plane: Plane, output: CutByPlaneOutput ): number; + } diff --git a/examples/jsm/misc/GPUComputationRenderer.d.ts b/examples/jsm/misc/GPUComputationRenderer.d.ts index 3672c7a013293bfe3e4a74accecac6d125ed36c3..6d9f3fb340af3a4c31adfbc25e75e7d620e4781f 100644 --- a/examples/jsm/misc/GPUComputationRenderer.d.ts +++ b/examples/jsm/misc/GPUComputationRenderer.d.ts @@ -1,41 +1,43 @@ import { - WebGLRenderer, - RenderTarget, - Texture, - DataTexture, - Material, - ShaderMaterial, - Wrapping, - TextureFilter + WebGLRenderer, + RenderTarget, + Texture, + DataTexture, + Material, + ShaderMaterial, + Wrapping, + TextureFilter } from '../../../src/Three'; export interface Variable { - name: string; - initialValueTexture: Texture; - material: Material; - dependencies: Variable[]; - renderTargets: RenderTarget[]; - wrapS: number; - wrapT: number; - minFilter: number; - magFilter: number; + name: string; + initialValueTexture: Texture; + material: Material; + dependencies: Variable[]; + renderTargets: RenderTarget[]; + wrapS: number; + wrapT: number; + minFilter: number; + magFilter: number; } export class GPUComputationRenderer { - constructor(sizeX: number, sizeY: number, renderer: WebGLRenderer); - addVariable(variableName: string, computeFragmentShader: string, initialValueTexture: Texture): Variable; - setVariableDependencies(variable: Variable, dependencies: Variable[] | null): void; + constructor( sizeX: number, sizeY: number, renderer: WebGLRenderer ); - init(): string | null; - compute(): void; + addVariable( variableName: string, computeFragmentShader: string, initialValueTexture: Texture ): Variable; + setVariableDependencies( variable: Variable, dependencies: Variable[] | null ): void; + + init(): string | null; + compute(): void; + + getCurrentRenderTarget( variable: Variable ): RenderTarget; + getAlternateRenderTarget( variable: Variable ): RenderTarget; + addResolutionDefine( materialShader: ShaderMaterial ): void; + createRenderTarget( sizeXTexture: number, sizeYTexture: number, wrapS: Wrapping, wrapT: number, minFilter: TextureFilter, magFilter: TextureFilter ): RenderTarget; + createTexture(): DataTexture; + renderTexture( input: Texture, output: Texture ): void; + doRenderTarget( material: Material, output: RenderTarget ): void; - getCurrentRenderTarget(variable: Variable): RenderTarget; - getAlternateRenderTarget(variable: Variable): RenderTarget; - addResolutionDefine(materialShader: ShaderMaterial): void; - createRenderTarget(sizeXTexture: number, sizeYTexture: number, wrapS: Wrapping, wrapT: number, minFilter: TextureFilter, magFilter: TextureFilter): RenderTarget; - createTexture(): DataTexture; - renderTexture(input: Texture, output: Texture): void; - doRenderTarget( material: Material, output: RenderTarget ): void; } diff --git a/examples/jsm/misc/Gyroscope.d.ts b/examples/jsm/misc/Gyroscope.d.ts index 5fed871e2dac3eb9a5e6591e48660e7a2ff2e2c1..3ad2e77db5b6b90e10f2799f63f7db250a42e99f 100644 --- a/examples/jsm/misc/Gyroscope.d.ts +++ b/examples/jsm/misc/Gyroscope.d.ts @@ -1,7 +1,9 @@ import { - Object3D + Object3D } from '../../../src/Three'; export class Gyroscope extends Object3D { - constructor(); + + constructor(); + } diff --git a/examples/jsm/misc/MD2Character.d.ts b/examples/jsm/misc/MD2Character.d.ts index 4fe57980bcff497b92d75228eb09fe54f933daa1..3c97d6c12958ddc53abd57c5e9f428bcf4d74316 100644 --- a/examples/jsm/misc/MD2Character.d.ts +++ b/examples/jsm/misc/MD2Character.d.ts @@ -1,24 +1,26 @@ import { - Object3D, - Mesh, - Texture + Object3D, + Mesh, + Texture } from '../../../src/Three'; export class MD2Character { - constructor(); - scale: number; - animationFPS: number; - root: Object3D; - meshBody: Mesh | null; - meshWeapon: Mesh | null; - skinsBody: Texture[]; - skinsWeapon: Texture[]; - setPlaybackRate(rate: number): void; - setWireframe(wireframeEnabled: boolean): void; - setSkin(index: number): void; - setWeapon(index: number): void; - setAnimation(clipName: string): void; - syncWeaponAnimation(): void; - update(delta: number): void; + constructor(); + scale: number; + animationFPS: number; + root: Object3D; + meshBody: Mesh | null; + meshWeapon: Mesh | null; + skinsBody: Texture[]; + skinsWeapon: Texture[]; + + setPlaybackRate( rate: number ): void; + setWireframe( wireframeEnabled: boolean ): void; + setSkin( index: number ): void; + setWeapon( index: number ): void; + setAnimation( clipName: string ): void; + syncWeaponAnimation(): void; + update( delta: number ): void; + } diff --git a/examples/jsm/misc/MD2CharacterComplex.d.ts b/examples/jsm/misc/MD2CharacterComplex.d.ts index b570f11d6fee1c0c4c4a78eafddfe747843947fb..910fe5054cc149c60752f72c269479e7963a0d56 100644 --- a/examples/jsm/misc/MD2CharacterComplex.d.ts +++ b/examples/jsm/misc/MD2CharacterComplex.d.ts @@ -1,51 +1,53 @@ import { - Object3D, - Mesh, - Texture + Object3D, + Mesh, + Texture } from '../../../src/Three'; export class MD2CharacterComplex { - constructor(); - scale: number; - animationFPS: number; - transitionFrames: number; - maxSpeed: number; - maxReverseSpeed: number; - frontAcceleration: number; - backAcceleration: number; - frontDecceleration: number; - angularSpeed: number; - root: Object3D; - meshBody: Mesh | null; - meshWeapon: Mesh | null; - controls: null; - skinsBody: Texture[]; - skinsWeapon: Texture[]; - weapons: Mesh[]; - currentSkin: number; - onLoadComplete: () => void; - meshes: Mesh[]; - animations: object[]; - loadCounter: number; - speed: number; - bodyOrientation: number; - walkSpeed: number; - crouchSpeed: number; - activeAnimation: string; - oldAnimation: string; + constructor(); + scale: number; + animationFPS: number; + transitionFrames: number; + maxSpeed: number; + maxReverseSpeed: number; + frontAcceleration: number; + backAcceleration: number; + frontDecceleration: number; + angularSpeed: number; + root: Object3D; + meshBody: Mesh | null; + meshWeapon: Mesh | null; + controls: null; + skinsBody: Texture[]; + skinsWeapon: Texture[]; + weapons: Mesh[]; + currentSkin: number; + onLoadComplete: () => void; + + meshes: Mesh[]; + animations: object[]; + loadCounter: number; + speed: number; + bodyOrientation: number; + walkSpeed: number; + crouchSpeed: number; + activeAnimation: string; + oldAnimation: string; + + enableShadows( enable: boolean ): void; + setVisible( enable: boolean ): void; + shareParts( original: MD2CharacterComplex ): void; + loadParts( config: object ): void; + setPlaybackRate( rate: number ): void; + setWireframe( wireframeEnabled: boolean ): void; + setSkin( index: number ): void; + setWeapon( index: number ): void; + setAnimation( animationName: string ): void; + update( delta: number ): void; + updateAnimations( delta: number ): void; + updateBehaviors(): void; + updateMovementModel( delta: number ): void; - enableShadows(enable: boolean): void; - setVisible(enable: boolean): void; - shareParts(original: MD2CharacterComplex): void; - loadParts(config: object): void; - setPlaybackRate(rate: number): void; - setWireframe(wireframeEnabled: boolean): void; - setSkin(index: number): void; - setWeapon(index: number): void; - setAnimation(animationName: string): void; - update(delta: number): void; - updateAnimations(delta: number): void; - updateBehaviors(): void; - updateMovementModel(delta: number): void; } diff --git a/examples/jsm/misc/MorphAnimMesh.d.ts b/examples/jsm/misc/MorphAnimMesh.d.ts index fdc23a8c8b94bfb22b32403954f7cdfd3df8a25b..89cbcea5538e67f82386da8ecf1716ae3ff60165 100644 --- a/examples/jsm/misc/MorphAnimMesh.d.ts +++ b/examples/jsm/misc/MorphAnimMesh.d.ts @@ -1,20 +1,22 @@ import { - AnimationAction, - AnimationMixer, - BufferGeometry, - Geometry, - Material, - Mesh + AnimationAction, + AnimationMixer, + BufferGeometry, + Geometry, + Material, + Mesh } from '../../../src/Three'; export class MorphAnimMesh extends Mesh { - constructor(geometry: BufferGeometry | Geometry, material: Material); - mixer: AnimationMixer; - activeAction: AnimationAction | null; - setDirectionForward(): void; - setDirectionBackward(): void; - playAnimation(label: string, fps: number): void; - updateAnimation(delta: number): void; - copy(source: MorphAnimMesh): this; + constructor( geometry: BufferGeometry | Geometry, material: Material ); + mixer: AnimationMixer; + activeAction: AnimationAction | null; + + setDirectionForward(): void; + setDirectionBackward(): void; + playAnimation( label: string, fps: number ): void; + updateAnimation( delta: number ): void; + copy( source: MorphAnimMesh ): this; + } diff --git a/examples/jsm/misc/MorphBlendMesh.d.ts b/examples/jsm/misc/MorphBlendMesh.d.ts index 3740ba71b8f62e7721a7ea1c7c353f1b3ac976e2..1f26cb37e8be8aab1a395174b7621401d6f0aa6c 100644 --- a/examples/jsm/misc/MorphBlendMesh.d.ts +++ b/examples/jsm/misc/MorphBlendMesh.d.ts @@ -1,26 +1,28 @@ import { - BufferGeometry, - Geometry, - Material, - Mesh + BufferGeometry, + Geometry, + Material, + Mesh } from '../../../src/Three'; export class MorphBlendMesh extends Mesh { - constructor(geometry: BufferGeometry | Geometry, material: Material); - animationsMap: object; - animationsList: object[]; - createAnimation(name: string, start: number, end: number, fps: number): void; - autoCreateAnimations(fps: number): void; - setAnimationDirectionForward(name: string): void; - setAnimationDirectionBackward(name: string): void; - setAnimationFPS(name: string, fps: number): void; - setAnimationDuration(name: string, duration: number): void; - setAnimationWeight(name: string, weight: number): void; - setAnimationTime(name: string, time: number): void; - getAnimationTime(name: string): number; - getAnimationDuration(name: string): number; - playAnimation(name: string): void; - stopAnimation(name: string): void; - update(delta: number): void; + constructor( geometry: BufferGeometry | Geometry, material: Material ); + animationsMap: object; + animationsList: object[]; + + createAnimation( name: string, start: number, end: number, fps: number ): void; + autoCreateAnimations( fps: number ): void; + setAnimationDirectionForward( name: string ): void; + setAnimationDirectionBackward( name: string ): void; + setAnimationFPS( name: string, fps: number ): void; + setAnimationDuration( name: string, duration: number ): void; + setAnimationWeight( name: string, weight: number ): void; + setAnimationTime( name: string, time: number ): void; + getAnimationTime( name: string ): number; + getAnimationDuration( name: string ): number; + playAnimation( name: string ): void; + stopAnimation( name: string ): void; + update( delta: number ): void; + } diff --git a/examples/jsm/misc/Ocean.d.ts b/examples/jsm/misc/Ocean.d.ts index 703033d46b0bf73b524333ff3b876ce0a5d7f7b4..f228d6d8a23db05eea00f68c95a74016d2e64e3c 100644 --- a/examples/jsm/misc/Ocean.d.ts +++ b/examples/jsm/misc/Ocean.d.ts @@ -1,24 +1,25 @@ import { - OrthographicCamera, - Mesh, - Scene, - ShaderMaterial, - Vector3, - WebGLRenderer, - WebGLRenderTarget, + OrthographicCamera, + Mesh, + Scene, + ShaderMaterial, + Vector3, + WebGLRenderer, + WebGLRenderTarget, } from '../../../src/Three'; export class Ocean { - constructor( renderer: WebGLRenderer, camera?: OrthographicCamera, scene?: Scene, options?: object ); + + constructor( renderer: WebGLRenderer, camera?: OrthographicCamera, scene?: Scene, options?: object ); changed: boolean; initial: boolean; oceanCamera: OrthographicCamera renderer: WebGLRenderer; - scene: Scene; + scene: Scene; - clearColor: number[]; + clearColor: number[]; geometryOrigin: number[]; sunDirectionX: number; sunDirectionY: number; @@ -33,9 +34,9 @@ export class Ocean { windX: number; windY: number; size: number; - choppiness: number; + choppiness: number; - initialSpectrumFramebuffer: WebGLRenderTarget; + initialSpectrumFramebuffer: WebGLRenderTarget; spectrumFramebuffer: WebGLRenderTarget; pingPhaseFramebuffer: WebGLRenderTarget; pongPhaseFramebuffer: WebGLRenderTarget; @@ -44,25 +45,25 @@ export class Ocean { displacementMapFramebuffer: WebGLRenderTarget; normalMapFramebuffer: WebGLRenderTarget; - matrixNeedsUpdate: boolean; + matrixNeedsUpdate: boolean; - materialOceanHorizontal: ShaderMaterial; - materialOceanVertical: ShaderMaterial; - materialInitialSpectrum: ShaderMaterial; - materialPhase: ShaderMaterial; - materialSpectrum: ShaderMaterial; - materialNormal: ShaderMaterial; - materialOcean: ShaderMaterial; + materialOceanHorizontal: ShaderMaterial; + materialOceanVertical: ShaderMaterial; + materialInitialSpectrum: ShaderMaterial; + materialPhase: ShaderMaterial; + materialSpectrum: ShaderMaterial; + materialNormal: ShaderMaterial; + materialOcean: ShaderMaterial; - screenQuad: Mesh; + screenQuad: Mesh; - generateSeedPhaseTexture(): void; + generateSeedPhaseTexture(): void; generateMesh(): void; - render(): void; - renderInitialSpectrum(): void; - renderWavePhase(): void; - renderSpectrum(): void; - renderSpectrumFFT(): void; - renderNormalMap(): void; + render(): void; + renderInitialSpectrum(): void; + renderWavePhase(): void; + renderSpectrum(): void; + renderSpectrumFFT(): void; + renderNormalMap(): void; } diff --git a/examples/jsm/misc/RollerCoaster.d.ts b/examples/jsm/misc/RollerCoaster.d.ts index 241559df0f40f4fe5de93de470b91648f56e6dcc..758bcc2d1d3170ff3360eb5c016a41dde1470481 100644 --- a/examples/jsm/misc/RollerCoaster.d.ts +++ b/examples/jsm/misc/RollerCoaster.d.ts @@ -1,26 +1,36 @@ import { - BufferGeometry, - Curve, - Mesh, - Vector3 + BufferGeometry, + Curve, + Mesh, + Vector3 } from '../../../src/Three'; export class RollerCoasterGeometry extends BufferGeometry { - constructor(curve: Curve, divisions: number); + + constructor( curve: Curve, divisions: number ); + } export class RollerCoasterLiftersGeometry extends BufferGeometry { - constructor(curve: Curve, divisions: number); + + constructor( curve: Curve, divisions: number ); + } export class RollerCoasterShadowGeometry extends BufferGeometry { - constructor(curve: Curve, divisions: number); + + constructor( curve: Curve, divisions: number ); + } export class SkyGeometry extends BufferGeometry { - constructor(curve: Curve, divisions: number); + + constructor( curve: Curve, divisions: number ); + } export class TreesGeometry extends BufferGeometry { - constructor(landscape: Mesh); + + constructor( landscape: Mesh ); + } diff --git a/examples/jsm/misc/Volume.d.ts b/examples/jsm/misc/Volume.d.ts index dc4f12adbd4ed4b1e541894ebab2647213cea3d1..84d7c4ba884700871283873b809e475c4d28660a 100644 --- a/examples/jsm/misc/Volume.d.ts +++ b/examples/jsm/misc/Volume.d.ts @@ -1,38 +1,39 @@ import { - Matrix3, + Matrix3, } from '../../../src/Three'; import { VolumeSlice } from "./VolumeSlice.js"; export class Volume { - constructor( xLength?: number, yLength?: number, zLength?: number, type?:string, arrayBuffer?: ArrayLike ); - xLength: number; - yLength: number; - zLength: number; + constructor( xLength?: number, yLength?: number, zLength?: number, type?:string, arrayBuffer?: ArrayLike ); - data: ArrayLike; + xLength: number; + yLength: number; + zLength: number; - spacing: number[]; - offset: number[]; + data: ArrayLike; - matrix: Matrix3; + spacing: number[]; + offset: number[]; - lowerThreshold: number; - upperThreshold: number; + matrix: Matrix3; - sliceList: VolumeSlice[]; + lowerThreshold: number; + upperThreshold: number; - getData( i: number, j: number, k: number ): number; - access( i: number, j: number, k: number ): number; - reverseAccess( index: number ): number[]; + sliceList: VolumeSlice[]; - map( functionToMap: Function, context: this ): this; + getData( i: number, j: number, k: number ): number; + access( i: number, j: number, k: number ): number; + reverseAccess( index: number ): number[]; - extractPerpendicularPlane ( axis: string, RASIndex: number ): object; - extractSlice( axis: string, index: number ): VolumeSlice; + map( functionToMap: Function, context: this ): this; - repaintAllSlices(): this; - computeMinMax(): number[]; + extractPerpendicularPlane ( axis: string, RASIndex: number ): object; + extractSlice( axis: string, index: number ): VolumeSlice; + + repaintAllSlices(): this; + computeMinMax(): number[]; } diff --git a/examples/jsm/misc/VolumeSlice.d.ts b/examples/jsm/misc/VolumeSlice.d.ts index 5e88fd13f51641354857621568ab8d8cad489cab..a07ce72a1c5b1c17cd3e199a3f919e22ad5f17c8 100644 --- a/examples/jsm/misc/VolumeSlice.d.ts +++ b/examples/jsm/misc/VolumeSlice.d.ts @@ -1,32 +1,33 @@ import { - Matrix3, - Mesh, + Matrix3, + Mesh, } from '../../../src/Three'; import { Volume } from './Volume'; export class VolumeSlice { - constructor( volume: Volume, index?: number, axis?: string ); - index: number; - axis: string; + constructor( volume: Volume, index?: number, axis?: string ); - canvas: HTMLCanvasElement; - canvasBuffer: HTMLCanvasElement; + index: number; + axis: string; - ctx: CanvasRenderingContext2D; - ctxBuffer: CanvasRenderingContext2D; + canvas: HTMLCanvasElement; + canvasBuffer: HTMLCanvasElement; - mesh: Mesh; + ctx: CanvasRenderingContext2D; + ctxBuffer: CanvasRenderingContext2D; - geometryNeedsUpdate: boolean; + mesh: Mesh; - sliceAccess: number; - jLength: number; - iLength: number; - matrix: Matrix3; + geometryNeedsUpdate: boolean; - repaint(): void; - updateGeometry(): void; + sliceAccess: number; + jLength: number; + iLength: number; + matrix: Matrix3; + + repaint(): void; + updateGeometry(): void; } diff --git a/examples/jsm/modifiers/ExplodeModifier.d.ts b/examples/jsm/modifiers/ExplodeModifier.d.ts index 6efdae3c5e0b2062b4839a887f36e77ff8169f36..57902c2a6f5c2f3a9b9fdd4238bff3b09331b04f 100644 --- a/examples/jsm/modifiers/ExplodeModifier.d.ts +++ b/examples/jsm/modifiers/ExplodeModifier.d.ts @@ -1,8 +1,10 @@ import { - Geometry + Geometry } from '../../../src/Three'; export class ExplodeModifier { - constructor(); - modify(geometry: Geometry): void; + + constructor(); + modify( geometry: Geometry ): void; + } diff --git a/examples/jsm/modifiers/SimplifyModifier.d.ts b/examples/jsm/modifiers/SimplifyModifier.d.ts index aad56003f28cc16fe84e3a954f267608f116ab05..2d4188bfd4a29502c053cedb5c6d64eac7f7cb30 100644 --- a/examples/jsm/modifiers/SimplifyModifier.d.ts +++ b/examples/jsm/modifiers/SimplifyModifier.d.ts @@ -1,9 +1,11 @@ import { - BufferGeometry, - Geometry + BufferGeometry, + Geometry } from '../../../src/Three'; export class SimplifyModifier { - constructor(); - modify(geometry: BufferGeometry | Geometry, count: number): BufferGeometry; + + constructor(); + modify( geometry: BufferGeometry | Geometry, count: number ): BufferGeometry; + } diff --git a/examples/jsm/modifiers/SubdivisionModifier.d.ts b/examples/jsm/modifiers/SubdivisionModifier.d.ts index 5c92c1e9ce2ed7cfd5485728bcef520c6735f93c..adf6f4f13b7009e047a747c8d6aa1467f88b5d91 100644 --- a/examples/jsm/modifiers/SubdivisionModifier.d.ts +++ b/examples/jsm/modifiers/SubdivisionModifier.d.ts @@ -1,12 +1,14 @@ import { - BufferGeometry, - Geometry + BufferGeometry, + Geometry } from '../../../src/Three'; export class SubdivisionModifier { - constructor(subdivisions?: number); - subdivisions: number; - - modify(geometry: BufferGeometry | Geometry): Geometry; - smooth(geometry: Geometry): void; + + constructor( subdivisions?: number ); + subdivisions: number; + + modify( geometry: BufferGeometry | Geometry ): Geometry; + smooth( geometry: Geometry ): void; + } diff --git a/examples/jsm/modifiers/TessellateModifier.d.ts b/examples/jsm/modifiers/TessellateModifier.d.ts index da634d6b8a58a658a071d58aea11ee7e876fe975..ff2c1440101cc9e77dde09fd36d561df882ab136 100644 --- a/examples/jsm/modifiers/TessellateModifier.d.ts +++ b/examples/jsm/modifiers/TessellateModifier.d.ts @@ -1,10 +1,12 @@ import { - Geometry + Geometry } from '../../../src/Three'; export class SubdivisionModifier { - constructor(maxEdgeLength: number); - maxEdgeLength: number; - modify(geometry: Geometry): void; + constructor( maxEdgeLength: number ); + maxEdgeLength: number; + + modify( geometry: Geometry ): void; + } diff --git a/examples/jsm/nodes/Nodes.d.ts b/examples/jsm/nodes/Nodes.d.ts index 9f4e9ad38d1eed0a21ef89dbf7c8ae277fd2af87..8ee1197236bab2c2d176af837917e8984aca042c 100644 --- a/examples/jsm/nodes/Nodes.d.ts +++ b/examples/jsm/nodes/Nodes.d.ts @@ -101,4 +101,4 @@ export * from './materials/MeshStandardNodeMaterial'; // postprocessing export * from './postprocessing/NodePostProcessing'; -// export * from './postprocessing/NodePass'; \ No newline at end of file +// export * from './postprocessing/NodePass'; diff --git a/examples/jsm/nodes/accessors/CameraNode.d.ts b/examples/jsm/nodes/accessors/CameraNode.d.ts index 7926fd8e173e246d80a6b024364e995ad77a57ca..124ecb154e5f8bcacfc1fb37ca088a61454337a3 100644 --- a/examples/jsm/nodes/accessors/CameraNode.d.ts +++ b/examples/jsm/nodes/accessors/CameraNode.d.ts @@ -7,25 +7,27 @@ import { FunctionNode } from '../core/FunctionNode'; import { FloatNode } from '../inputs/FloatNode'; export class CameraNode extends TempNode { - constructor(scope?: string, camera?: Camera); - scope: string; - near: FloatNode | undefined; - far: FloatNode | undefined; - camera: Camera | undefined; - updateFrame: boolean | undefined; - nodeType: string; + constructor( scope?: string, camera?: Camera ); - setCamera(camera: Camera): void; - setScope(scope: string): void; - generate(builder: NodeBuilder, output: string): string; - onUpdateFrame(frame: NodeFrame): void; - copy(source: CameraNode): this; + scope: string; + near: FloatNode | undefined; + far: FloatNode | undefined; + camera: Camera | undefined; + updateFrame: boolean | undefined; + nodeType: string; + + setCamera( camera: Camera ): void; + setScope( scope: string ): void; + generate( builder: NodeBuilder, output: string ): string; + onUpdateFrame( frame: NodeFrame ): void; + copy( source: CameraNode ): this; + + static Nodes: { + depthColor: FunctionNode; + }; + static POSITION: string; + static DEPTH: string; + static TO_VERTEX: string; - static Nodes: { - depthColor: FunctionNode; - }; - static POSITION: string; - static DEPTH: string; - static TO_VERTEX: string; } diff --git a/examples/jsm/nodes/accessors/ColorsNode.d.ts b/examples/jsm/nodes/accessors/ColorsNode.d.ts index 514cddc27397c28ee4d8127d2befd7301e8f7f4a..610b66dee48e254c676c2ecd1095ca677accf471 100644 --- a/examples/jsm/nodes/accessors/ColorsNode.d.ts +++ b/examples/jsm/nodes/accessors/ColorsNode.d.ts @@ -2,11 +2,13 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class ColorsNode extends TempNode { - constructor(index?: number); - index: number; - nodeType: string; + constructor( index?: number ); + + index: number; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: ColorsNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: ColorsNode): this; } diff --git a/examples/jsm/nodes/accessors/LightNode.d.ts b/examples/jsm/nodes/accessors/LightNode.d.ts index 7836aaade009f0ef036f3abaf7339c27682ea52f..1f349ada2b2dff807ca95216a8f1174c18c6df6f 100644 --- a/examples/jsm/nodes/accessors/LightNode.d.ts +++ b/examples/jsm/nodes/accessors/LightNode.d.ts @@ -2,13 +2,15 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class LightNode extends TempNode { - constructor(scope?: string); - scope: string; - nodeType: string; + constructor( scope?: string ); - generate(builder: NodeBuilder, output: string): string; - copy(source: LightNode): this; + scope: string; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: LightNode ): this; + + static TOTAL: string; - static TOTAL: string; } diff --git a/examples/jsm/nodes/accessors/NormalNode.d.ts b/examples/jsm/nodes/accessors/NormalNode.d.ts index 2a2dbc9f14d389cb2649176ccaf9576a69ee6512..df035da13a5a2670df88a491895c4e0ade097cb3 100644 --- a/examples/jsm/nodes/accessors/NormalNode.d.ts +++ b/examples/jsm/nodes/accessors/NormalNode.d.ts @@ -2,14 +2,16 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class NormalNode extends TempNode { - constructor(scope?: string); - scope: string; - nodeType: string; + constructor( scope?: string ); - generate(builder: NodeBuilder, output: string): string; - copy(source: NormalNode): this; + scope: string; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: NormalNode ): this; + + static LOCAL: string; + static WORLD: string; - static LOCAL: string; - static WORLD: string; } diff --git a/examples/jsm/nodes/accessors/NormalNode.js b/examples/jsm/nodes/accessors/NormalNode.js index 72186df0f0d400afaf68f5adbf5ff23417fa83a6..55c460b2e839312ef42f37fc1fe070df3a6b3c57 100644 --- a/examples/jsm/nodes/accessors/NormalNode.js +++ b/examples/jsm/nodes/accessors/NormalNode.js @@ -45,15 +45,15 @@ NormalNode.prototype.generate = function ( builder, output ) { case NormalNode.LOCAL: if ( builder.isShader( 'vertex' ) ) { - + result = 'objectNormal'; - + } else { - + builder.requires.normal = true; - + result = 'vObjectNormal'; - + } break; diff --git a/examples/jsm/nodes/accessors/PositionNode.d.ts b/examples/jsm/nodes/accessors/PositionNode.d.ts index 0507e0c12e93ee6b0e8198988393adca1d8cc8bc..347def23d8ffc57efac1269c17ec5042adadb647 100644 --- a/examples/jsm/nodes/accessors/PositionNode.d.ts +++ b/examples/jsm/nodes/accessors/PositionNode.d.ts @@ -2,16 +2,18 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class PositionNode extends TempNode { - constructor(scope?: string); - scope: string; - nodeType: string; + constructor( scope?: string ); - generate(builder: NodeBuilder, output: string): string; - copy(source: PositionNode): this; + scope: string; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: PositionNode ): this; + + static LOCAL: string; + static WORLD: string; + static VIEW: string; + static PROJECTION: string; - static LOCAL: string; - static WORLD: string; - static VIEW: string; - static PROJECTION: string; } diff --git a/examples/jsm/nodes/accessors/ReflectNode.d.ts b/examples/jsm/nodes/accessors/ReflectNode.d.ts index 6a0b39ba559d8e776d0d639b267599dd56b5c5ba..05e5b69b85ce2c497ffbf9b8ae8079544a6741e1 100644 --- a/examples/jsm/nodes/accessors/ReflectNode.d.ts +++ b/examples/jsm/nodes/accessors/ReflectNode.d.ts @@ -4,14 +4,16 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class ReflectNode extends TempNode { - constructor(scope?: string); - scope: string; - nodeType: string; + constructor( scope?: string ); - generate(builder: NodeBuilder, output: string): string; + scope: string; + nodeType: string; - static CUBE: string; - static SPHERE: string; - static VECTOR: string; -} \ No newline at end of file + generate( builder: NodeBuilder, output: string ): string; + + static CUBE: string; + static SPHERE: string; + static VECTOR: string; + +} diff --git a/examples/jsm/nodes/accessors/ReflectNode.js b/examples/jsm/nodes/accessors/ReflectNode.js index 7f1d4aee6ceaa8595b0a747e35525ab070e64abe..b4134ed6bdd9c111c711b35d7eadefb4c528ecd7 100644 --- a/examples/jsm/nodes/accessors/ReflectNode.js +++ b/examples/jsm/nodes/accessors/ReflectNode.js @@ -24,7 +24,7 @@ ReflectNode.prototype.nodeType = "Reflect"; ReflectNode.prototype.getUnique = function ( builder ) { - return !builder.context.viewNormal; + return ! builder.context.viewNormal; }; diff --git a/examples/jsm/nodes/accessors/ResolutionNode.d.ts b/examples/jsm/nodes/accessors/ResolutionNode.d.ts index 18fe82dc1d8578e30947b4f70fe27d169e0fe2d3..235bd6b6b8c6b14ecd5243882fb90ceb77891595 100644 --- a/examples/jsm/nodes/accessors/ResolutionNode.d.ts +++ b/examples/jsm/nodes/accessors/ResolutionNode.d.ts @@ -5,11 +5,13 @@ import { NodeFrame } from '../core/NodeFrame'; import { Vector2Node } from '../inputs/Vector2Node'; export class ResolutionNode extends Vector2Node { - constructor(); - size: Vector2; - nodeType: string; + constructor(); + + size: Vector2; + nodeType: string; + + updateFrame( frame: NodeFrame ): void; + copy( source: ResolutionNode ): this; - updateFrame(frame: NodeFrame): void; - copy(source: ResolutionNode): this; } diff --git a/examples/jsm/nodes/accessors/ScreenUVNode.d.ts b/examples/jsm/nodes/accessors/ScreenUVNode.d.ts index eab03f199c3e801a9dc8d120668c938666ccdbf9..eb011cbb1b281138263962783d85e1dc5c11ebac 100644 --- a/examples/jsm/nodes/accessors/ScreenUVNode.d.ts +++ b/examples/jsm/nodes/accessors/ScreenUVNode.d.ts @@ -3,11 +3,13 @@ import { TempNode } from '../core/TempNode'; import { ResolutionNode } from './ResolutionNode'; export class ScreenUVNode extends TempNode { - constructor(resolution?: ResolutionNode); - resolution: ResolutionNode; - nodeType: string; + constructor( resolution?: ResolutionNode ); + + resolution: ResolutionNode; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: ScreenUVNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: ScreenUVNode): this; } diff --git a/examples/jsm/nodes/accessors/UVNode.d.ts b/examples/jsm/nodes/accessors/UVNode.d.ts index c356d49705473b9045d70c3e375372d0f6d9b9ce..b48d995f4d0de59e861f7198164bedb8326ceb7e 100644 --- a/examples/jsm/nodes/accessors/UVNode.d.ts +++ b/examples/jsm/nodes/accessors/UVNode.d.ts @@ -2,11 +2,13 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { TempNode } from '../core/TempNode'; export class UVNode extends TempNode { - constructor(index?: number); - index: number; - nodeType: string; + constructor( index?: number ); + + index: number; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: UVNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: UVNode): this; } diff --git a/examples/jsm/nodes/core/AttributeNode.d.ts b/examples/jsm/nodes/core/AttributeNode.d.ts index 66170befe5389a7768701a6b06c706abbfc08aad..366c779155b6d44cb294d5a850418d629bf32cea 100644 --- a/examples/jsm/nodes/core/AttributeNode.d.ts +++ b/examples/jsm/nodes/core/AttributeNode.d.ts @@ -2,13 +2,15 @@ import { TempNode } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export class AttributeNode extends TempNode { - constructor(name: string, type?: string); - name: string; - nodeType: string; + constructor( name: string, type?: string ); + + name: string; + nodeType: string; + + getAttributeType( builder: NodeBuilder ): string; + getType( builder: NodeBuilder ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: AttributeNode ): this; - getAttributeType(builder: NodeBuilder): string; - getType(builder: NodeBuilder): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: AttributeNode): this; } diff --git a/examples/jsm/nodes/core/ConstNode.d.ts b/examples/jsm/nodes/core/ConstNode.d.ts index 78776eed33d698db85672c72c13bc01c7203a783..093360d9b6a82cfa50fcd3402748ee79e3a788de 100644 --- a/examples/jsm/nodes/core/ConstNode.d.ts +++ b/examples/jsm/nodes/core/ConstNode.d.ts @@ -2,22 +2,24 @@ import { TempNode } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export class ConstNode extends TempNode { - constructor(src: string, useDefine?: boolean); - src: string; - useDefine: boolean; - nodeType: string; + constructor( src: string, useDefine?: boolean ); - getType(builder: NodeBuilder): string; - parse(src: string, useDefine?: boolean): void; - build(builder: NodeBuilder, output: string): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: ConstNode): this; + src: string; + useDefine: boolean; + nodeType: string; + + getType( builder: NodeBuilder ): string; + parse( src: string, useDefine?: boolean ): void; + build( builder: NodeBuilder, output: string ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: ConstNode ): this; + + static PI: string; + static PI2: string; + static RECIPROCAL_PI: string; + static RECIPROCAL_PI2: string; + static LOG2: string; + static EPSILON: string; - static PI: string; - static PI2: string; - static RECIPROCAL_PI: string; - static RECIPROCAL_PI2: string; - static LOG2: string; - static EPSILON: string; } diff --git a/examples/jsm/nodes/core/ExpressionNode.d.ts b/examples/jsm/nodes/core/ExpressionNode.d.ts index 86168aa9749055b215d494840c82d316c646614f..1e0c64a6e333bcf1115f17e31ce8289613902342 100644 --- a/examples/jsm/nodes/core/ExpressionNode.d.ts +++ b/examples/jsm/nodes/core/ExpressionNode.d.ts @@ -1,5 +1,7 @@ import { FunctionNode } from './FunctionNode'; export class ExpressionNode extends FunctionNode { - constructor(src: string, includes?: object[], extensions?: object, keywords?: object, type?: string); + + constructor( src: string, includes?: object[], extensions?: object, keywords?: object, type?: string ); + } diff --git a/examples/jsm/nodes/core/FunctionCallNode.d.ts b/examples/jsm/nodes/core/FunctionCallNode.d.ts index 64484dd14741b89c576d243a5c788c4e0890dce1..3015be9f4bf32e6acd95040007db7fe10eeb49a8 100644 --- a/examples/jsm/nodes/core/FunctionCallNode.d.ts +++ b/examples/jsm/nodes/core/FunctionCallNode.d.ts @@ -4,16 +4,18 @@ import { TempNode } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export class FunctionCallNode extends TempNode { - constructor(func: FunctionNode, inputs?: Node[]); - nodeType: string; + constructor( func: FunctionNode, inputs?: Node[] ); - value: FunctionNode; - inputs: Node[]; + nodeType: string; + + value: FunctionNode; + inputs: Node[]; + + setFunction( func: FunctionNode, inputs?: Node[] ): void; + getFunction(): FunctionNode; + getType(): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: FunctionCallNode ): this; - setFunction(func: FunctionNode, inputs?: Node[]): void; - getFunction(): FunctionNode; - getType(): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: FunctionCallNode): this; } diff --git a/examples/jsm/nodes/core/FunctionNode.d.ts b/examples/jsm/nodes/core/FunctionNode.d.ts index c6fa53291b51f69c74505fda445be93d21052ef0..578df180b1e11487f23d5f14eeb70faa95adcb2a 100644 --- a/examples/jsm/nodes/core/FunctionNode.d.ts +++ b/examples/jsm/nodes/core/FunctionNode.d.ts @@ -2,28 +2,30 @@ import { TempNode } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export interface FunctionNodeInput { - name: string; - type: string; - qualifier: string; + name: string; + type: string; + qualifier: string; } export class FunctionNode extends TempNode { - constructor(src: string, includes?: object[], extensions?: object, keywords?: object, type?: string); - isMethod: boolean; - nodeType: string; - useKeywords: boolean; + constructor( src: string, includes?: object[], extensions?: object, keywords?: object, type?: string ); - inputs: FunctionNodeInput[] | undefined; - includes: object[] | undefined; - extensions: object | undefined; - keywords: object | undefined; + isMethod: boolean; + nodeType: string; + useKeywords: boolean; + + inputs: FunctionNodeInput[] | undefined; + includes: object[] | undefined; + extensions: object | undefined; + keywords: object | undefined; + + getShared( builder: NodeBuilder, output: string ): boolean; + getType( builder: NodeBuilder ): string; + getInputByName( name: string ): FunctionNodeInput | undefined; + getIncludeByName( name: string ): object | undefined; + generate( builder: NodeBuilder, output: string ): string; + parse( src: string, includes?: object[], extensions?: object, keywords?: object ): void; + copy( source: FunctionNode ): this; - getShared(builder: NodeBuilder, output: string): boolean; - getType(builder: NodeBuilder): string; - getInputByName(name: string): FunctionNodeInput | undefined; - getIncludeByName(name: string): object | undefined; - generate(builder: NodeBuilder, output: string): string; - parse(src: string, includes?: object[], extensions?: object, keywords?: object): void; - copy(source: FunctionNode): this; } diff --git a/examples/jsm/nodes/core/FunctionNode.js b/examples/jsm/nodes/core/FunctionNode.js index 32403c57edc201a67ae68f08d83aa231d3eb0c83..3c1e2a48da30ff1a96579abdbf2a54cd6d00d39e 100644 --- a/examples/jsm/nodes/core/FunctionNode.js +++ b/examples/jsm/nodes/core/FunctionNode.js @@ -209,7 +209,7 @@ FunctionNode.prototype.parse = function ( src, includes, extensions, keywords ) } - this.isInterface = this.src.indexOf('{') === -1; + this.isInterface = this.src.indexOf( '{' ) === - 1; } else { diff --git a/examples/jsm/nodes/core/InputNode.d.ts b/examples/jsm/nodes/core/InputNode.d.ts index 6951b99fa816d92f0713e14bb899852607e65b39..6b7073ffd97d602e0b3af5772c5dbd697db43e71 100644 --- a/examples/jsm/nodes/core/InputNode.d.ts +++ b/examples/jsm/nodes/core/InputNode.d.ts @@ -2,12 +2,14 @@ import { TempNode, TempNodeParams } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export class InputNode extends TempNode { - constructor(type: string, params?: TempNodeParams); - readonly: boolean; + constructor( type: string, params?: TempNodeParams ); + + readonly: boolean; + + setReadonly( value: boolean ): this; + getReadonly( builder: NodeBuilder ): boolean; + copy( source: InputNode ): this; + generate( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; - setReadonly(value: boolean): this; - getReadonly(builder: NodeBuilder): boolean; - copy(source: InputNode): this; - generate(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; } diff --git a/examples/jsm/nodes/core/Node.d.ts b/examples/jsm/nodes/core/Node.d.ts index 2b73e7491771d963cec743f30d6c7c632157cf88..137c5a8e40ad7b68ce7f3fbb3ae35614927b713a 100644 --- a/examples/jsm/nodes/core/Node.d.ts +++ b/examples/jsm/nodes/core/Node.d.ts @@ -1,25 +1,27 @@ import { NodeBuilder } from './NodeBuilder'; export class Node { - constructor(type?: string); - uuid: string; - name: string; - type: string | undefined; - userData: object; - isNode: boolean; - frameId: number | undefined; + constructor( type?: string ); + + uuid: string; + name: string; + type: string | undefined; + userData: object; + isNode: boolean; + frameId: number | undefined; + + analyze( builder: NodeBuilder, settings?: object ): void; + analyzeAndFlow( builder: NodeBuilder, output: string, settings?: object ): object; + flow( builder: NodeBuilder, output: string, settings?: object ): object; + build( builder: NodeBuilder, output: string, uuid?: string ): string; + appendDepsNode( builder: NodeBuilder, data: object, output: string ): void; + setName( name: string ): this; + getName( builder: NodeBuilder ): string; + getType( builder: NodeBuilder, output?: string ): string; + getJSONNode( meta?: object | string ): object | undefined; + copy( source: Node ): this; + createJSONNode( meta?: object | string ): object; + toJSON( meta?: object | string ): object; - analyze(builder: NodeBuilder, settings?: object): void; - analyzeAndFlow(builder: NodeBuilder, output: string, settings?: object): object; - flow(builder: NodeBuilder, output: string, settings?: object): object; - build(builder: NodeBuilder, output: string, uuid?: string): string; - appendDepsNode(builder: NodeBuilder, data: object, output: string): void; - setName(name: string): this; - getName(builder: NodeBuilder): string; - getType(builder: NodeBuilder, output?: string): string; - getJSONNode(meta?: object | string): object | undefined; - copy(source: Node): this; - createJSONNode(meta?: object | string): object; - toJSON(meta?: object | string): object; } diff --git a/examples/jsm/nodes/core/NodeBuilder.d.ts b/examples/jsm/nodes/core/NodeBuilder.d.ts index 7e2a02a62ec23abe41b63d478b641ce433051004..505d8a14fcfcab053bbc331e7f3ca07612220abb 100644 --- a/examples/jsm/nodes/core/NodeBuilder.d.ts +++ b/examples/jsm/nodes/core/NodeBuilder.d.ts @@ -1,146 +1,148 @@ import { - Material, - Texture, - TextureEncoding, - WebGLRenderer + Material, + Texture, + TextureEncoding, + WebGLRenderer } from '../../../../src/Three'; import { Node } from './Node'; import { NodeUniform } from './NodeUniform'; export class NodeBuilder { - constructor(); - - slots: string[]; - caches: string[]; - contexts: object[]; - - keywords: object; - nodeData: object; - - requires: { - uv: boolean[]; - color: boolean[]; - lights: boolean; - fog: boolean; - }; - - includes: { - consts: object[]; - functions: object[]; - structs: object[]; - }; - - attributes: object; - prefixCode: string; - - parsCode: { - vertex: string; - fragment: string; - }; - - code: { - vertex: string; - fragment: string; - }; - - nodeCode: { - vertex: string; - fragment: string; - }; - - resultCode: { - vertex: string; - fragment: string; - }; - - finalCode: { - vertex: string; - fragment: string; - }; - - inputs: { - uniforms: { - list: object[]; - vertex: object[]; - fragment: object[]; - }; - vars: { - varying: object[]; - vertex: object[]; - fragment: object[]; - } - }; - - defines: object; - uniforms: object; - extensions: object; - updaters: object[]; - nodes: object[]; - - analyzing: boolean; - - build(vertex: Node, fragment: Node): this; - buildShader(shader: string, node: Node): void; - setMaterial(material: Material, renderer: WebGLRenderer): this; - addFlow(slot: string, cache?: string, context?: object): this; - removeFlow(): this; - addCache(name: string): this; - removeCache(): this; - addContext(context: object): this; - removeContext(): this; - addSlot(name: string): this; - removeSlot(): this; - addVertexCode(code: string): void; - addFragmentCode(code: string): void; - addCode(code: string, shader: string): void; - addVertexNodeCode(code: string): void; - addFragmentNodeCode(code: string): void; - addNodeCode(code: string, shader: string): void; - clearNodeCode(shader: string): string; - clearVertexNodeCode(): string; - clearFragmentNodeCode(): string; - addVertexFinalCode(code: string): void; - addFragmentFinalCode(code: string): void; - addFinalCode(code: string, shader: string): void; - addVertexParsCode(code: string): void; - addFragmentParsCode(code: string): void; - addParsCode(code: string, shader: string): void; - addVaryCode(code: string): void; - isCache(name: string): boolean; - isSlot(name: string): boolean; - define(name: string, value: any): void; - isDefined(name: string): boolean; - getVar(uuid: string, type: string, ns: string, shader?: string, prefix?: string, label?: string): object; - getVar(uuid: string, type: string, ns: string, label: string): object; - getAttribute(name: string, type: string); - getCode(shader: string): string; - getVarListCode(vars: object[], prefix?: string): string; - getVars(shader: string): object[]; - getNodeData(node: Node): object; - createUniform(shader: string, type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string): NodeUniform; - createVertexUniform(type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string): NodeUniform; - createFragmentUniform(type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string): NodeUniform; - include(node: Node, parent?: boolean, source?: string): void; - colorToVectorProperties(color: string): string; - colorToVector(color: string): string; - getIncludes(type: string, shader: string): object[]; - getIncludesCode(type: string, shader: string): string; - getConstructorFromLength(len: number): string; - isTypeMatrix(format: string): boolean; - getTypeLength(type: string): number; - getTypeFromLength(len: number): string; - findNode(): Node; - resolve(): void; - format(code: string, from: string, to: string): string; - getTypeByFormat(format: string): string; - getFormatByType(type: string): string; - getUuid(uuid: string, useCache?: boolean): string; - getElementByIndex(index: number): string; - getIndexByElement(elm: string): number; - isShader(shader: string): boolean; - setShader(shader: string): this; - mergeDefines(defines: object): object; - mergeUniform(uniforms: object): object; - getTextureEncodingFromMap(map: Texture, gammaOverrideLinear?: boolean): TextureEncoding; + + constructor(); + + slots: string[]; + caches: string[]; + contexts: object[]; + + keywords: object; + nodeData: object; + + requires: { + uv: boolean[]; + color: boolean[]; + lights: boolean; + fog: boolean; + }; + + includes: { + consts: object[]; + functions: object[]; + structs: object[]; + }; + + attributes: object; + prefixCode: string; + + parsCode: { + vertex: string; + fragment: string; + }; + + code: { + vertex: string; + fragment: string; + }; + + nodeCode: { + vertex: string; + fragment: string; + }; + + resultCode: { + vertex: string; + fragment: string; + }; + + finalCode: { + vertex: string; + fragment: string; + }; + + inputs: { + uniforms: { + list: object[]; + vertex: object[]; + fragment: object[]; + }; + vars: { + varying: object[]; + vertex: object[]; + fragment: object[]; + } + }; + + defines: object; + uniforms: object; + extensions: object; + updaters: object[]; + nodes: object[]; + + analyzing: boolean; + + build( vertex: Node, fragment: Node ): this; + buildShader( shader: string, node: Node ): void; + setMaterial( material: Material, renderer: WebGLRenderer ): this; + addFlow( slot: string, cache?: string, context?: object ): this; + removeFlow(): this; + addCache( name: string ): this; + removeCache(): this; + addContext( context: object ): this; + removeContext(): this; + addSlot( name: string ): this; + removeSlot(): this; + addVertexCode( code: string ): void; + addFragmentCode( code: string ): void; + addCode( code: string, shader: string ): void; + addVertexNodeCode( code: string ): void; + addFragmentNodeCode( code: string ): void; + addNodeCode( code: string, shader: string ): void; + clearNodeCode( shader: string ): string; + clearVertexNodeCode(): string; + clearFragmentNodeCode(): string; + addVertexFinalCode( code: string ): void; + addFragmentFinalCode( code: string ): void; + addFinalCode( code: string, shader: string ): void; + addVertexParsCode( code: string ): void; + addFragmentParsCode( code: string ): void; + addParsCode( code: string, shader: string ): void; + addVaryCode( code: string ): void; + isCache( name: string ): boolean; + isSlot( name: string ): boolean; + define( name: string, value: any ): void; + isDefined( name: string ): boolean; + getVar( uuid: string, type: string, ns: string, shader?: string, prefix?: string, label?: string ): object; + getVar( uuid: string, type: string, ns: string, label: string ): object; + getAttribute( name: string, type: string ); + getCode( shader: string ): string; + getVarListCode( vars: object[], prefix?: string ): string; + getVars( shader: string ): object[]; + getNodeData( node: Node ): object; + createUniform( shader: string, type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string ): NodeUniform; + createVertexUniform( type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string ): NodeUniform; + createFragmentUniform( type: string, node: Node, ns?: string, needsUpdate?: boolean, label?: string ): NodeUniform; + include( node: Node, parent?: boolean, source?: string ): void; + colorToVectorProperties( color: string ): string; + colorToVector( color: string ): string; + getIncludes( type: string, shader: string ): object[]; + getIncludesCode( type: string, shader: string ): string; + getConstructorFromLength( len: number ): string; + isTypeMatrix( format: string ): boolean; + getTypeLength( type: string ): number; + getTypeFromLength( len: number ): string; + findNode(): Node; + resolve(): void; + format( code: string, from: string, to: string ): string; + getTypeByFormat( format: string ): string; + getFormatByType( type: string ): string; + getUuid( uuid: string, useCache?: boolean ): string; + getElementByIndex( index: number ): string; + getIndexByElement( elm: string ): number; + isShader( shader: string ): boolean; + setShader( shader: string ): this; + mergeDefines( defines: object ): object; + mergeUniform( uniforms: object ): object; + getTextureEncodingFromMap( map: Texture, gammaOverrideLinear?: boolean ): TextureEncoding; + } diff --git a/examples/jsm/nodes/core/NodeFrame.d.ts b/examples/jsm/nodes/core/NodeFrame.d.ts index 7e5dc4345b2eb5a10577acde00308cc4ff6a0700..c1be1aaf74ae39d2f9fbb51728a733ba3e7d5289 100644 --- a/examples/jsm/nodes/core/NodeFrame.d.ts +++ b/examples/jsm/nodes/core/NodeFrame.d.ts @@ -1,20 +1,22 @@ import { - Texture, - WebGLRenderer + Texture, + WebGLRenderer } from '../../../../src/Three'; import { Node } from './Node'; export class NodeFrame { - constructor(time: number); - time: number; - id: number; - delta: number | undefined; - renderer: WebGLRenderer | undefined; - renderTexture: Texture | undefined; - - update(delta: number): this; - setRenderer(renderer: WebGLRenderer): this; - setRenderTexture(renderTexture: Texture): this; - updateNode(node: Node): this; + + constructor( time: number ); + time: number; + id: number; + delta: number | undefined; + renderer: WebGLRenderer | undefined; + renderTexture: Texture | undefined; + + update( delta: number ): this; + setRenderer( renderer: WebGLRenderer ): this; + setRenderTexture( renderTexture: Texture ): this; + updateNode( node: Node ): this; + } diff --git a/examples/jsm/nodes/core/NodeLib.d.ts b/examples/jsm/nodes/core/NodeLib.d.ts index 0c855a270532e065eab333886abee3c66730a68a..2956cea978d7d9c3076c3028dfa99d50f9deee16 100644 --- a/examples/jsm/nodes/core/NodeLib.d.ts +++ b/examples/jsm/nodes/core/NodeLib.d.ts @@ -2,23 +2,23 @@ import { Node } from './Node'; import { NodeBuilder } from './NodeBuilder'; export interface NodeLibKeyword { - callback: (builder: NodeBuilder) => void; - cache?: object; + callback: ( builder: NodeBuilder ) => void; + cache?: object; } export namespace NodeLib { - export const nodes: object; - export const keywords: object; + export const nodes: object; + export const keywords: object; - export function add(node: Node): void; - export function addKeyword(name: string, callback: (builder: NodeBuilder) => void, cache?: object): void; - export function remove(node: Node): void; - export function removeKeyword(name: string): void; - export function get(name: string): Node; - export function getKeyword(name: string, builder: NodeBuilder): any; - export function getKeywordData(name: string): NodeLibKeyword; - export function contains(name: string): boolean; - export function containsKeyword(name: string): boolean; + export function add( node: Node ): void; + export function addKeyword( name: string, callback: ( builder: NodeBuilder ) => void, cache?: object ): void; + export function remove( node: Node ): void; + export function removeKeyword( name: string ): void; + export function get( name: string ): Node; + export function getKeyword( name: string, builder: NodeBuilder ): any; + export function getKeywordData( name: string ): NodeLibKeyword; + export function contains( name: string ): boolean; + export function containsKeyword( name: string ): boolean; } diff --git a/examples/jsm/nodes/core/NodeUniform.d.ts b/examples/jsm/nodes/core/NodeUniform.d.ts index 3a378fb9cd352d8afe1a83d849220ef713e4f0e2..d96543be46348d469795d241edd486b56c920d03 100644 --- a/examples/jsm/nodes/core/NodeUniform.d.ts +++ b/examples/jsm/nodes/core/NodeUniform.d.ts @@ -1,17 +1,19 @@ import { Node } from './Node'; export interface NodeUniformParams { - name?: string; - type?: string; - node?: Node; - needsUpdate?: boolean; + name?: string; + type?: string; + node?: Node; + needsUpdate?: boolean; } export class NodeUniform { - constructor(params?: NodeUniformParams); - name: string | undefined; - type: string | undefined; - node: Node | undefined; - needsUpdate: boolean | undefined; - value: any; + + constructor( params?: NodeUniformParams ); + name: string | undefined; + type: string | undefined; + node: Node | undefined; + needsUpdate: boolean | undefined; + value: any; + } diff --git a/examples/jsm/nodes/core/NodeUtils.d.ts b/examples/jsm/nodes/core/NodeUtils.d.ts index 52f1fd0a99c9fd9fcd80364fc78b2d70b6d2d7a7..f70d96f24c10aa91388c626554fd926e372b9c0f 100644 --- a/examples/jsm/nodes/core/NodeUtils.d.ts +++ b/examples/jsm/nodes/core/NodeUtils.d.ts @@ -2,8 +2,8 @@ import { Node } from './Node'; export namespace NodeUtils { - export const elements: string[]; + export const elements: string[]; - export function addShortcuts(proto: Node, proxy: string, list: any[]): void; + export function addShortcuts( proto: Node, proxy: string, list: any[] ): void; } diff --git a/examples/jsm/nodes/core/StructNode.d.ts b/examples/jsm/nodes/core/StructNode.d.ts index ef07ee30e7daa1f8b087ec6f7db4b1ee1616de48..a125c7d687c3eccfe03142361c8dd4822e477a21 100644 --- a/examples/jsm/nodes/core/StructNode.d.ts +++ b/examples/jsm/nodes/core/StructNode.d.ts @@ -2,19 +2,21 @@ import { TempNode } from './TempNode'; import { NodeBuilder } from './NodeBuilder'; export interface StructNodeInput { - type: string; - name: string; + type: string; + name: string; } export class StructNode extends TempNode { - constructor(src?: string); - inputs: StructNodeInput[]; - src: string; - nodeType: string; + constructor( src?: string ); + + inputs: StructNodeInput[]; + src: string; + nodeType: string; + + getType( builder: NodeBuilder ): string; + getInputByName( name: string ): StructNodeInput; + generate( builder: NodeBuilder, output: string ): string; + parse( src: string ): void; - getType(builder: NodeBuilder): string; - getInputByName(name: string): StructNodeInput; - generate(builder: NodeBuilder, output: string): string; - parse(src: string): void; } diff --git a/examples/jsm/nodes/core/TempNode.d.ts b/examples/jsm/nodes/core/TempNode.d.ts index ce53aab01a696b40370f2d1c32b1f6a67b26a22b..93f90129bdae4e4f40c01d5a0c0080c6d4b724ca 100644 --- a/examples/jsm/nodes/core/TempNode.d.ts +++ b/examples/jsm/nodes/core/TempNode.d.ts @@ -2,23 +2,25 @@ import { Node } from './Node'; import { NodeBuilder } from './NodeBuilder'; export interface TempNodeParams { - shared?: boolean; - unique?: boolean; + shared?: boolean; + unique?: boolean; } export class TempNode extends Node { - constructor(type: string, params?: TempNodeParams); - shared: boolean; - unique: boolean; - label: string | undefined; + constructor( type: string, params?: TempNodeParams ); + + shared: boolean; + unique: boolean; + label: string | undefined; + + build( builder: NodeBuilder, output: string, uuid?: string, ns?: string ): string; + getShared( builder: NodeBuilder, output: string ): boolean; + getUnique( builder: NodeBuilder, output: string ): boolean; + setLabel( name: string ): this; + getLabel( builder: NodeBuilder ): string; + getUuid( unique: boolean ): string; + getTemp( builder: NodeBuilder, uuid: string ): string | undefined; + generate( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string ): string; - build(builder: NodeBuilder, output: string, uuid?: string, ns?: string): string; - getShared(builder: NodeBuilder, output: string): boolean; - getUnique(builder: NodeBuilder, output: string): boolean; - setLabel(name: string): this; - getLabel(builder: NodeBuilder): string; - getUuid(unique: boolean): string; - getTemp(builder: NodeBuilder, uuid: string): string | undefined; - generate(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string): string; } diff --git a/examples/jsm/nodes/core/VarNode.d.ts b/examples/jsm/nodes/core/VarNode.d.ts index c44d0260b6e4fe7df62efce3dea09584aff21c69..115025fbe66d447c0ba9e1dc8a0ab9d57b4cefc0 100644 --- a/examples/jsm/nodes/core/VarNode.d.ts +++ b/examples/jsm/nodes/core/VarNode.d.ts @@ -2,12 +2,14 @@ import { Node } from './Node'; import { NodeBuilder } from './NodeBuilder'; export class VarNode extends Node { - constructor(type: string, value?: any); - value: any; - nodeType: string; + constructor( type: string, value?: any ); + + value: any; + nodeType: string; + + getType( builder: NodeBuilder ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: VarNode ): this; - getType(builder: NodeBuilder): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: VarNode): this; } diff --git a/examples/jsm/nodes/effects/BlurNode.d.ts b/examples/jsm/nodes/effects/BlurNode.d.ts index 5e85d0e0fd673de2128df27e1bd2e9d67665a491..daaa4142e865efcfe87fbe95e0666b298383b9f4 100644 --- a/examples/jsm/nodes/effects/BlurNode.d.ts +++ b/examples/jsm/nodes/effects/BlurNode.d.ts @@ -10,24 +10,26 @@ import { FunctionNode } from '../core/FunctionNode'; import { TextureNode } from '../inputs/TextureNode'; export class BlurNode extends TempNode { - constructor(value: TextureNode, uv?: UVNode, radius?: number, size?: Vector2); - value: TextureNode; - uv: UVNode; - radius: Vector2Node; - size: Vector2; - blurX: boolean; - blurY: boolean; - horizontal: FloatNode; - vertical: FloatNode; - nodeType: string; + constructor( value: TextureNode, uv?: UVNode, radius?: number, size?: Vector2 ); - updateFrame(frame: NodeFrame): void; - generate(builder: NodeBuilder, output: string): string; - copy(source: BlurNode): this; + value: TextureNode; + uv: UVNode; + radius: Vector2Node; + size: Vector2; + blurX: boolean; + blurY: boolean; + horizontal: FloatNode; + vertical: FloatNode; + nodeType: string; + + updateFrame( frame: NodeFrame ): void; + generate( builder: NodeBuilder, output: string ): string; + copy( source: BlurNode ): this; + + static Nodes: { + blurX: FunctionNode; + blurY: FunctionNode; + } - static Nodes: { - blurX: FunctionNode; - blurY: FunctionNode; - } } diff --git a/examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts b/examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts index 8d08c530d7a82ba0b48dddb211ed202d2eecad43..fab8f47f80000b9d410ae2424b51834dc21c8873 100644 --- a/examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts +++ b/examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts @@ -5,26 +5,27 @@ import { FunctionNode } from '../core/FunctionNode'; import { Node } from '../core/Node'; export class ColorAdjustmentNode extends TempNode { - constructor(rgb: Node, adjustment?: FloatNode, method?: string); - rgb: Node; - adjustment: FloatNode | undefined; - method: string; - nodeType: string; + constructor( rgb: Node, adjustment?: FloatNode, method?: string ); - generate(builder: NodeBuilder, output: string): string; - copy(source: ColorAdjustmentNode): this; + rgb: Node; + adjustment: FloatNode | undefined; + method: string; + nodeType: string; - static Nodes: { - hue: FunctionNode; - saturation: FunctionNode; - vibrance: FunctionNode; - } + generate( builder: NodeBuilder, output: string ): string; + copy( source: ColorAdjustmentNode ): this; - static SATURATION: string; - static HUE: string; - static VIBRANCE: string; - static BRIGHTNESS: string; - static CONTRAST: string; + static Nodes: { + hue: FunctionNode; + saturation: FunctionNode; + vibrance: FunctionNode; + } + + static SATURATION: string; + static HUE: string; + static VIBRANCE: string; + static BRIGHTNESS: string; + static CONTRAST: string; } diff --git a/examples/jsm/nodes/effects/LuminanceNode.d.ts b/examples/jsm/nodes/effects/LuminanceNode.d.ts index 8926ef4c75f09291ef6eba5bd3ca1bf436c41668..b0900743d748112b2f2cf7a059071b6d8b4a085a 100644 --- a/examples/jsm/nodes/effects/LuminanceNode.d.ts +++ b/examples/jsm/nodes/effects/LuminanceNode.d.ts @@ -5,17 +5,18 @@ import { ConstNode } from '../core/ConstNode'; import { Node } from '../core/Node'; export class LuminanceNode extends TempNode { - constructor(rgb: Node); - rgb: Node; - nodeType: string; + constructor( rgb: Node ); - generate(builder: NodeBuilder, output: string): string; - copy(source: LuminanceNode): this; + rgb: Node; + nodeType: string; - static Nodes: { - LUMA: ConstNode; - luminance: FunctionNode; - } + generate( builder: NodeBuilder, output: string ): string; + copy( source: LuminanceNode ): this; + + static Nodes: { + LUMA: ConstNode; + luminance: FunctionNode; + } } diff --git a/examples/jsm/nodes/inputs/BoolNode.d.ts b/examples/jsm/nodes/inputs/BoolNode.d.ts index 1c38ba3b2c89a3e6b67d1f5e8010b447044dbb7b..a7a46a9251dfc5cd34ca73882184539fae70eeee 100644 --- a/examples/jsm/nodes/inputs/BoolNode.d.ts +++ b/examples/jsm/nodes/inputs/BoolNode.d.ts @@ -2,11 +2,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class BoolNode extends InputNode { - constructor(value?: boolean); - value: boolean; - nodeType: string; + constructor( value?: boolean ); + + value: boolean; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: BoolNode ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: BoolNode): this; } diff --git a/examples/jsm/nodes/inputs/ColorNode.d.ts b/examples/jsm/nodes/inputs/ColorNode.d.ts index 479e69d3600768c0cdf127ed02ef20c26638cccc..bc7999d26fa583de36cb1201b0cab82764246e41 100644 --- a/examples/jsm/nodes/inputs/ColorNode.d.ts +++ b/examples/jsm/nodes/inputs/ColorNode.d.ts @@ -4,11 +4,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class ColorNode extends InputNode { - constructor(color: Color | number | string, g?: number, b?: number); - value: Color; - nodeType: string; + constructor( color: Color | number | string, g?: number, b?: number ); + + value: Color; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: ColorNode ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: ColorNode): this; } diff --git a/examples/jsm/nodes/inputs/CubeTextureNode.d.ts b/examples/jsm/nodes/inputs/CubeTextureNode.d.ts index 1556085fbfb3341fb5d97d62e50e64fb8c01a18d..8855ed71d0065e424cde72849b0788a47c9f0773 100644 --- a/examples/jsm/nodes/inputs/CubeTextureNode.d.ts +++ b/examples/jsm/nodes/inputs/CubeTextureNode.d.ts @@ -5,14 +5,16 @@ import { Node } from '../core/Node'; import { NodeBuilder } from '../core/NodeBuilder'; export class CubeTextureNode extends InputNode { - constructor(value: CubeTexture, uv?: Node, bias?: Node); - value: CubeTexture; - uv: Node | undefined; - bias: Node | undefined; - nodeType: string; + constructor( value: CubeTexture, uv?: Node, bias?: Node ); + + value: CubeTexture; + uv: Node | undefined; + bias: Node | undefined; + nodeType: string; + + getTexture( builder: NodeBuilder, output: string ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: CubeTextureNode ): this; - getTexture(builder: NodeBuilder, output: string): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: CubeTextureNode): this; } diff --git a/examples/jsm/nodes/inputs/FloatNode.d.ts b/examples/jsm/nodes/inputs/FloatNode.d.ts index c0073cba4ea72aa24ccd833ccdcd291a1dcbb3da..614019bc189c525c0200290553af236edbf0e30d 100644 --- a/examples/jsm/nodes/inputs/FloatNode.d.ts +++ b/examples/jsm/nodes/inputs/FloatNode.d.ts @@ -2,11 +2,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class FloatNode extends InputNode { - constructor(value?: number); - value: number; - nodeType: string; + constructor( value?: number ); + + value: number; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: FloatNode ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: FloatNode): this; } diff --git a/examples/jsm/nodes/inputs/IntNode.d.ts b/examples/jsm/nodes/inputs/IntNode.d.ts index d54c24498d2deda86636ab78e83b87de66d7aeba..03f073783bc323ff18c08df607ec8e9ad8234259 100644 --- a/examples/jsm/nodes/inputs/IntNode.d.ts +++ b/examples/jsm/nodes/inputs/IntNode.d.ts @@ -2,11 +2,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class IntNode extends InputNode { - constructor(value?: number); - value: number; - nodeType: string; + constructor( value?: number ); + + value: number; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: IntNode ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: IntNode): this; } diff --git a/examples/jsm/nodes/inputs/Matrix3Node.d.ts b/examples/jsm/nodes/inputs/Matrix3Node.d.ts index 5b1c3e175380c6037f2338781a47d46b177081f4..2c0c1dcc6b8643226fe6c0599365ead7e1155f86 100644 --- a/examples/jsm/nodes/inputs/Matrix3Node.d.ts +++ b/examples/jsm/nodes/inputs/Matrix3Node.d.ts @@ -4,12 +4,14 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class Matrix3Node extends InputNode { - constructor(matrix?: Matrix3); - value: Matrix3; - nodeType: string; - elements: number[]; + constructor( matrix?: Matrix3 ); + + value: Matrix3; + nodeType: string; + elements: number[]; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: Matrix3Node ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: Matrix3Node): this; } diff --git a/examples/jsm/nodes/inputs/Matrix4Node.d.ts b/examples/jsm/nodes/inputs/Matrix4Node.d.ts index 87246c8330c383844314ef905ec2c76dfc2f8e09..cb846558e4d61a323462cd1447a28ee3d8dc263e 100644 --- a/examples/jsm/nodes/inputs/Matrix4Node.d.ts +++ b/examples/jsm/nodes/inputs/Matrix4Node.d.ts @@ -4,12 +4,14 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class Matrix4Node extends InputNode { - constructor(matrix?: Matrix4); - value: Matrix4; - nodeType: string; - elements: number[]; + constructor( matrix?: Matrix4 ); + + value: Matrix4; + nodeType: string; + elements: number[]; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: Matrix4Node ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: Matrix4Node): this; } diff --git a/examples/jsm/nodes/inputs/PropertyNode.d.ts b/examples/jsm/nodes/inputs/PropertyNode.d.ts index 64c7035dce2d60d19e9ebd2a8946fc9d5926fa7b..967908d2333934c1a88ac0929d8cd2f8de1005be 100644 --- a/examples/jsm/nodes/inputs/PropertyNode.d.ts +++ b/examples/jsm/nodes/inputs/PropertyNode.d.ts @@ -1,10 +1,12 @@ import { InputNode } from '../core/InputNode'; export class PropertyNode extends InputNode { - constructor(object: object, property: string, type: string); - object: object; - property: string; - nodeType: string; - value: any; + constructor( object: object, property: string, type: string ); + + object: object; + property: string; + nodeType: string; + value: any; + } diff --git a/examples/jsm/nodes/inputs/RTTNode.d.ts b/examples/jsm/nodes/inputs/RTTNode.d.ts index 7ce1fc9eeb2a785fa1a9531c24b1e0dedce19ee6..fc5e5ec0753e03d0b8f09595c71dd57e8a80880b 100644 --- a/examples/jsm/nodes/inputs/RTTNode.d.ts +++ b/examples/jsm/nodes/inputs/RTTNode.d.ts @@ -1,9 +1,9 @@ import { - Mesh, - OrthographicCamera, - Scene, - WebGLRenderTarget, - WebGLRenderTargetOptions + Mesh, + OrthographicCamera, + Scene, + WebGLRenderTarget, + WebGLRenderTargetOptions } from '../../../../src/Three'; import { NodeBuilder } from '../core/NodeBuilder'; @@ -11,23 +11,25 @@ import { NodeFrame } from '../core/NodeFrame'; import { TextureNode } from './TextureNode'; export interface RTTNodeOptions extends WebGLRenderTargetOptions { - clear?: boolean; + clear?: boolean; } export class RTTNode extends TextureNode { - constructor(width: number, height: number, input: TextureNode, options?: RTTNodeOptions); - input: TextureNode; - clear: boolean; - renderTarget: WebGLRenderTarget; - material: object; // NodeMaterial - camera: OrthographicCamera; - scene: Scene; - quad: Mesh; - render: boolean; + constructor( width: number, height: number, input: TextureNode, options?: RTTNodeOptions ); + + input: TextureNode; + clear: boolean; + renderTarget: WebGLRenderTarget; + material: object; // NodeMaterial + camera: OrthographicCamera; + scene: Scene; + quad: Mesh; + render: boolean; + + build( builder: NodeBuilder, output: string, uuid?: string ): string; + updateFramesaveTo( frame: NodeFrame ): void; + updateFrame( frame: NodeFrame ): void; + copy( source: RTTNode ): this; - build(builder: NodeBuilder, output: string, uuid?: string): string; - updateFramesaveTo(frame: NodeFrame): void; - updateFrame(frame: NodeFrame): void; - copy(source: RTTNode): this; } diff --git a/examples/jsm/nodes/inputs/ReflectorNode.d.ts b/examples/jsm/nodes/inputs/ReflectorNode.d.ts index 547d8fca65fe0c47be7344dc06fed4cdcf1649a0..1ee33abebcdca8f885ca814066ac60a1313c5212 100644 --- a/examples/jsm/nodes/inputs/ReflectorNode.d.ts +++ b/examples/jsm/nodes/inputs/ReflectorNode.d.ts @@ -7,17 +7,19 @@ import { TextureNode } from './TextureNode'; import { PositionNode } from '../accessors/PositionNode'; export class ReflectorNode extends TempNode { - constructor(mirror?: ReflectorRTT); - mirror: ReflectorRTT; - textureMatrix: Matrix4Node; - localPosition: PositionNode; - uv: OperatorNode; - uvResult: OperatorNode; - texture: TextureNode; + constructor( mirror?: ReflectorRTT ); - nodeType: string; + mirror: ReflectorRTT; + textureMatrix: Matrix4Node; + localPosition: PositionNode; + uv: OperatorNode; + uvResult: OperatorNode; + texture: TextureNode; + + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: ReflectorNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: ReflectorNode): this; } diff --git a/examples/jsm/nodes/inputs/ScreenNode.d.ts b/examples/jsm/nodes/inputs/ScreenNode.d.ts index dc41d1dec7e8ff9f42c6d43f72715718af5398f3..70928e545dfe658d3ceadb416b50c43c4ad64fed 100644 --- a/examples/jsm/nodes/inputs/ScreenNode.d.ts +++ b/examples/jsm/nodes/inputs/ScreenNode.d.ts @@ -3,9 +3,11 @@ import { TextureNode } from './TextureNode'; import { UVNode } from '../accessors/UVNode'; export class ScreenNode extends TextureNode { - constructor(uv?: UVNode); - nodeType: string; + constructor( uv?: UVNode ); + + nodeType: string; + + getTexture( builder: NodeBuilder, output: string ): string; - getTexture(builder: NodeBuilder, output: string): string; } diff --git a/examples/jsm/nodes/inputs/TextureNode.d.ts b/examples/jsm/nodes/inputs/TextureNode.d.ts index 4d7ded950112e8b347df244ea873400dfb947b40..9c4565a5e152d3631910b8588167d0e8b600970c 100644 --- a/examples/jsm/nodes/inputs/TextureNode.d.ts +++ b/examples/jsm/nodes/inputs/TextureNode.d.ts @@ -1,6 +1,6 @@ import { - Matrix4, - Texture + Matrix4, + Texture } from '../../../../src/Three'; import { InputNode } from '../core/InputNode'; @@ -9,15 +9,17 @@ import { Node } from '../core/Node'; import { UVNode } from '../accessors/UVNode'; export class TextureNode extends InputNode { - constructor(value: Texture, uv?: UVNode, bias?: Node, project?: boolean); - value: Matrix4; - uv: UVNode; - bias: Matrix4; - project: boolean; - nodeType: string; + constructor( value: Texture, uv?: UVNode, bias?: Node, project?: boolean ); + + value: Matrix4; + uv: UVNode; + bias: Matrix4; + project: boolean; + nodeType: string; + + getTexture( builder: NodeBuilder, output: string ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: TextureNode ): this; - getTexture(builder: NodeBuilder, output: string): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: TextureNode): this; } diff --git a/examples/jsm/nodes/inputs/Vector2Node.d.ts b/examples/jsm/nodes/inputs/Vector2Node.d.ts index c2da6bca22598ddcb820ad48f9de6a389aaf88ff..0c64b7c93cfbef22b505d3f1603976953e7d89db 100644 --- a/examples/jsm/nodes/inputs/Vector2Node.d.ts +++ b/examples/jsm/nodes/inputs/Vector2Node.d.ts @@ -4,11 +4,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class Vector2Node extends InputNode { - constructor(x: Vector2 | number, y?: number); - value: Vector2; - nodeType: string; + constructor( x: Vector2 | number, y?: number ); + + value: Vector2; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: Vector2Node ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: Vector2Node): this; } diff --git a/examples/jsm/nodes/inputs/Vector3Node.d.ts b/examples/jsm/nodes/inputs/Vector3Node.d.ts index 3cef960cbe05fd5db4e08e51c555c9485237ecfa..aae9cee9336a2fe3382388f1cde183da7d1f4ebd 100644 --- a/examples/jsm/nodes/inputs/Vector3Node.d.ts +++ b/examples/jsm/nodes/inputs/Vector3Node.d.ts @@ -4,11 +4,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class Vector3Node extends InputNode { - constructor(x: Vector3 | number, y?: number, z?: number); - value: Vector3; - nodeType: string; + constructor( x: Vector3 | number, y?: number, z?: number ); + + value: Vector3; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: Vector3Node ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: Vector3Node): this; } diff --git a/examples/jsm/nodes/inputs/Vector4Node.d.ts b/examples/jsm/nodes/inputs/Vector4Node.d.ts index 176acb24c2eeaeb4f96728119eb5e59f2a64fcc8..4c5195bf849366333ecaf84645d7a2e2aaa8a443 100644 --- a/examples/jsm/nodes/inputs/Vector4Node.d.ts +++ b/examples/jsm/nodes/inputs/Vector4Node.d.ts @@ -4,11 +4,13 @@ import { InputNode } from '../core/InputNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class Vector4Node extends InputNode { - constructor(x: Vector4 | number, y?: number, z?: number, w?: number); - value: Vector4; - nodeType: string; + constructor( x: Vector4 | number, y?: number, z?: number, w?: number ); + + value: Vector4; + nodeType: string; + + generateReadonly( builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean ): string; + copy( source: Vector4Node ): this; - generateReadonly(builder: NodeBuilder, output: string, uuid?: string, type?: string, ns?: string, needsUpdate?: boolean): string; - copy(source: Vector4Node): this; } diff --git a/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts b/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts index 729c17d86c0c43ee36b9ea506a97d9b771d48172..b559877fedad92700aa159a94980c1e2a5dc07cb 100644 --- a/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts +++ b/examples/jsm/nodes/materials/MeshStandardNodeMaterial.d.ts @@ -1,5 +1,7 @@ import { NodeMaterial } from './NodeMaterial'; export class MeshStandardNodeMaterial extends NodeMaterial { - constructor(); -} \ No newline at end of file + + constructor(); + +} diff --git a/examples/jsm/nodes/materials/NodeMaterial.d.ts b/examples/jsm/nodes/materials/NodeMaterial.d.ts index c2b50eedb53ac3937e0db2b4732525587efa984e..7d23034dccfabbb12b7b073bf14e32ddc9e938a3 100644 --- a/examples/jsm/nodes/materials/NodeMaterial.d.ts +++ b/examples/jsm/nodes/materials/NodeMaterial.d.ts @@ -1,6 +1,6 @@ import { - ShaderMaterial, - WebGLRenderer + ShaderMaterial, + WebGLRenderer } from '../../../../src/Three'; import { NodeBuilder } from '../core/NodeBuilder'; @@ -11,22 +11,24 @@ import { MeshStandardNode } from './nodes/MeshStandardNode'; import { RawNode } from './nodes/RawNode'; export interface NodeMaterialBuildParams { - builder?: NodeBuilder; - renderer?: WebGLRenderer; + builder?: NodeBuilder; + renderer?: WebGLRenderer; } export class NodeMaterial extends ShaderMaterial { - constructor(vertex: MeshStandardNode, fragment: MeshStandardNode); - vertex: MeshStandardNode | RawNode; - fragment: MeshStandardNode | RawNode; + constructor( vertex: MeshStandardNode, fragment: MeshStandardNode ); - updaters: object[]; + vertex: MeshStandardNode | RawNode; + fragment: MeshStandardNode | RawNode; - isNodeMaterial: boolean; - properties: object; + updaters: object[]; + + isNodeMaterial: boolean; + properties: object; + + updateFrame( frame: NodeFrame ): void; + build( params?: NodeMaterialBuildParams ): this; + copy( source: NodeMaterial ): this; - updateFrame(frame: NodeFrame): void; - build(params?: NodeMaterialBuildParams): this; - copy(source: NodeMaterial): this; } diff --git a/examples/jsm/nodes/materials/PhongNodeMaterial.d.ts b/examples/jsm/nodes/materials/PhongNodeMaterial.d.ts index 6f66024dfc2b2afc6ffd0002b6c1120a37b4ff70..8991bceec4cea2f0c08d14b2e53e932ea1f3e763 100644 --- a/examples/jsm/nodes/materials/PhongNodeMaterial.d.ts +++ b/examples/jsm/nodes/materials/PhongNodeMaterial.d.ts @@ -1,5 +1,7 @@ import { NodeMaterial } from './NodeMaterial'; export class PhongNodeMaterial extends NodeMaterial { - constructor(); -} \ No newline at end of file + + constructor(); + +} diff --git a/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts b/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts index 4708fac015af61c4645ad83d1581cc653fb947dd..85ab5ba2e6047f7345dbc619e02f1366fa18d9f1 100644 --- a/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts +++ b/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts @@ -1,5 +1,7 @@ import { NodeMaterial } from './NodeMaterial'; export class SpriteNodeMaterial extends NodeMaterial { - constructor(); + + constructor(); + } diff --git a/examples/jsm/nodes/materials/StandardNodeMaterial.d.ts b/examples/jsm/nodes/materials/StandardNodeMaterial.d.ts index 55a335138b1e7232b1c720d0ebdd568570c57c7d..670081970e883578016ff5338c918c366771d9ff 100644 --- a/examples/jsm/nodes/materials/StandardNodeMaterial.d.ts +++ b/examples/jsm/nodes/materials/StandardNodeMaterial.d.ts @@ -1,5 +1,7 @@ import { NodeMaterial } from './NodeMaterial'; export class StandardNodeMaterial extends NodeMaterial { - constructor(); + + constructor(); + } diff --git a/examples/jsm/nodes/materials/nodes/MeshStandardNode.d.ts b/examples/jsm/nodes/materials/nodes/MeshStandardNode.d.ts index 639a2a02686c0bee966aac0d4a753e79af4caaf4..5503cb4329b0014542c197246bf2c1ecb257d877 100644 --- a/examples/jsm/nodes/materials/nodes/MeshStandardNode.d.ts +++ b/examples/jsm/nodes/materials/nodes/MeshStandardNode.d.ts @@ -1,6 +1,6 @@ import { - Color, - Vector2 + Color, + Vector2 } from '../../../../../src/Three'; import { NodeBuilder } from '../../core/NodeBuilder'; @@ -8,21 +8,23 @@ import { StandardNode } from './StandardNode'; import { PropertyNode } from "../../inputs/PropertyNode"; export class MeshStandardNode extends StandardNode { - constructor(); - properties: { - color: Color; - roughness: number; - metalness: number; - normalScale: Vector2; - } + constructor(); - inputs: { - color: PropertyNode - roughness: PropertyNode - metalness: PropertyNode - normalScale: PropertyNode - } + properties: { + color: Color; + roughness: number; + metalness: number; + normalScale: Vector2; + } + + inputs: { + color: PropertyNode + roughness: PropertyNode + metalness: PropertyNode + normalScale: PropertyNode + } + + build( builder: NodeBuilder ): string; - build(builder: NodeBuilder): string; } diff --git a/examples/jsm/nodes/materials/nodes/PhongNode.d.ts b/examples/jsm/nodes/materials/nodes/PhongNode.d.ts index ff95df8d4bc53853e1bbca70843c7b527b48d5c7..e685bb234d1eeb981ab0a1e8f3b3972615b22bf0 100644 --- a/examples/jsm/nodes/materials/nodes/PhongNode.d.ts +++ b/examples/jsm/nodes/materials/nodes/PhongNode.d.ts @@ -4,13 +4,15 @@ import { ColorNode } from '../../inputs/ColorNode'; import { FloatNode } from '../../inputs/FloatNode'; export class PhongNode extends Node { - constructor(); - color: ColorNode; - specular: ColorNode; - shininess: FloatNode; - nodeType: string; + constructor(); + + color: ColorNode; + specular: ColorNode; + shininess: FloatNode; + nodeType: string; + + build( builder: NodeBuilder ): string; + copy( source: PhongNode ): this; - build(builder: NodeBuilder): string; - copy(source: PhongNode): this; } diff --git a/examples/jsm/nodes/materials/nodes/RawNode.d.ts b/examples/jsm/nodes/materials/nodes/RawNode.d.ts index 2a1f19fedc5ac1129ceb11872bc4b9a91f14dc5c..13e3b69e3bfffc8bbfe5c6a6c1afcdbfaac26084 100644 --- a/examples/jsm/nodes/materials/nodes/RawNode.d.ts +++ b/examples/jsm/nodes/materials/nodes/RawNode.d.ts @@ -2,11 +2,13 @@ import { NodeBuilder } from '../../core/NodeBuilder'; import { Node } from '../../core/Node'; export class RawNode extends Node { - constructor(value: Node); - value: Node; - nodeType: string; + constructor( value: Node ); - generate(builder: NodeBuilder): string; - copy(source: RawNode): this; -} \ No newline at end of file + value: Node; + nodeType: string; + + generate( builder: NodeBuilder ): string; + copy( source: RawNode ): this; + +} diff --git a/examples/jsm/nodes/materials/nodes/SpriteNode.d.ts b/examples/jsm/nodes/materials/nodes/SpriteNode.d.ts index 274fde298e97d989450b0001295528c1421ee9a1..aa7f7e44bca5e835c62e6ad81dc3d8192c096946 100644 --- a/examples/jsm/nodes/materials/nodes/SpriteNode.d.ts +++ b/examples/jsm/nodes/materials/nodes/SpriteNode.d.ts @@ -3,12 +3,14 @@ import { Node } from '../../core/Node'; import { ColorNode } from '../../inputs/ColorNode'; export class SpriteNode extends Node { - constructor(); - color: ColorNode; - spherical: true; - nodeType: string; + constructor(); + + color: ColorNode; + spherical: true; + nodeType: string; + + build( builder: NodeBuilder ): string; + copy( source: SpriteNode ): this; - build(builder: NodeBuilder): string; - copy(source: SpriteNode): this; } diff --git a/examples/jsm/nodes/materials/nodes/StandardNode.d.ts b/examples/jsm/nodes/materials/nodes/StandardNode.d.ts index ba718ce8494819c4157d4f11099e5281c784384b..af0eee998f72288f92720350244c265e4e7c3c8d 100644 --- a/examples/jsm/nodes/materials/nodes/StandardNode.d.ts +++ b/examples/jsm/nodes/materials/nodes/StandardNode.d.ts @@ -4,14 +4,15 @@ import { ColorNode } from '../../inputs/ColorNode'; import { FloatNode } from '../../inputs/FloatNode'; export class StandardNode extends Node { - constructor(); - color: ColorNode; - roughness: FloatNode; - metalness: FloatNode; - nodeType: string; + constructor(); - build(builder: NodeBuilder): string; - copy(source: StandardNode): this; + color: ColorNode; + roughness: FloatNode; + metalness: FloatNode; + nodeType: string; + + build( builder: NodeBuilder ): string; + copy( source: StandardNode ): this; } diff --git a/examples/jsm/nodes/materials/nodes/StandardNode.js b/examples/jsm/nodes/materials/nodes/StandardNode.js index 7204af3de3d696699b9372f272bf45f07a090e00..b874aec2a2be4748f465fedcc02188ab502dbb12 100644 --- a/examples/jsm/nodes/materials/nodes/StandardNode.js +++ b/examples/jsm/nodes/materials/nodes/StandardNode.js @@ -33,11 +33,11 @@ StandardNode.prototype.build = function ( builder ) { var code; - builder.define('STANDARD'); + builder.define( 'STANDARD' ); var useClearcoat = this.clearcoat || this.clearcoatRoughness || this.clearCoatNormal; - if( useClearcoat ){ + if ( useClearcoat ) { builder.define( 'CLEARCOAT' ); @@ -129,13 +129,13 @@ StandardNode.prototype.build = function ( builder ) { } else { - var specularRoughness = new ExpressionNode('material.specularRoughness', 'f' ); - var clearcoatRoughness = new ExpressionNode('material.clearcoatRoughness', 'f' ); + var specularRoughness = new ExpressionNode( 'material.specularRoughness', 'f' ); + var clearcoatRoughness = new ExpressionNode( 'material.clearcoatRoughness', 'f' ); var contextEnvironment = { roughness: specularRoughness, bias: new SpecularMIPLevelNode( specularRoughness ), - viewNormal: new ExpressionNode('normal', 'v3'), + viewNormal: new ExpressionNode( 'normal', 'v3' ), gamma: true }; @@ -146,7 +146,7 @@ StandardNode.prototype.build = function ( builder ) { var contextClearcoatEnvironment = { roughness: clearcoatRoughness, bias: new SpecularMIPLevelNode( clearcoatRoughness ), - viewNormal: new ExpressionNode('clearcoatNormal', 'v3'), + viewNormal: new ExpressionNode( 'clearcoatNormal', 'v3' ), gamma: true }; diff --git a/examples/jsm/nodes/math/CondNode.d.ts b/examples/jsm/nodes/math/CondNode.d.ts index d2d5cf1b0ef4110aa1de080c13c9a82cea3981ea..265d7585be4aad5c251d63f3f1c024bcb9130a94 100644 --- a/examples/jsm/nodes/math/CondNode.d.ts +++ b/examples/jsm/nodes/math/CondNode.d.ts @@ -3,23 +3,25 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { Node } from '../core/Node'; export class CondNode extends TempNode { - constructor(a: Node, b: Node, op: string, ifNode: Node, elseNode: Node); - a: Node; - b: Node; - op: string; - ifNode: Node; - elseNode: Node; - nodeType: string; + constructor( a: Node, b: Node, op: string, ifNode: Node, elseNode: Node ); - getCondType(builder: NodeBuilder): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: CondNode): this; + a: Node; + b: Node; + op: string; + ifNode: Node; + elseNode: Node; + nodeType: string; + + getCondType( builder: NodeBuilder ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: CondNode ): this; + + static EQUAL: string; + static NOT_EQUAL: string; + static GREATER: string; + static GREATER_EQUAL: string; + static LESS: string; + static LESS_EQUAL: string; - static EQUAL: string; - static NOT_EQUAL: string; - static GREATER: string; - static GREATER_EQUAL: string; - static LESS: string; - static LESS_EQUAL: string; } diff --git a/examples/jsm/nodes/math/MathNode.d.ts b/examples/jsm/nodes/math/MathNode.d.ts index 91601e83f235231b0042c32087f4c817d639d8cd..4d6043142fe742e5b594b319dbb15aa3b2cf8ee9 100644 --- a/examples/jsm/nodes/math/MathNode.d.ts +++ b/examples/jsm/nodes/math/MathNode.d.ts @@ -3,56 +3,58 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { Node } from '../core/Node'; export class MathNode extends TempNode { - constructor(a: Node, bOrMethod: Node | string, cOrMethod?: Node | string, method?: string); - - a: Node; - b: Node | string | undefined; - c: Node | string | undefined; - method: string; - nodeType: string; - - getNumInputs(builder: NodeBuilder): number; - getInputType(builder: NodeBuilder): string; - generate(builder: NodeBuilder, output: string): string; - copy(source: MathNode): this; - - static RAD: string; - static DEG: string; - static EXP: string; - static EXP2: string; - static LOG: string; - static LOG2: string; - static SQRT: string; - static INV_SQRT: string; - static FLOOR: string; - static CEIL: string; - static NORMALIZE: string; - static SATURATE: string; - static SIN: string; - static COS: string; - static TAN: string; - static ASIN: string; - static ACOS: string; - static ARCTAN: string; - static ABS: string; - static SIGN: string; - static LENGTH: string; - static NEGATE: string; - static INVERT: string; - - static MIN: string; - static MAX: string; - static MOD: string; - static STEP: string; - static REFLECT: string; - static DISTANCE: string; - static DOT: string; - static CROSS: string; - static POW: string; - - static MIX: string; - static CLAMP: string; - static REFRACT: string; - static SMOOTHSTEP: string; - static FACEFORWARD: string; + + constructor( a: Node, bOrMethod: Node | string, cOrMethod?: Node | string, method?: string ); + + a: Node; + b: Node | string | undefined; + c: Node | string | undefined; + method: string; + nodeType: string; + + getNumInputs( builder: NodeBuilder ): number; + getInputType( builder: NodeBuilder ): string; + generate( builder: NodeBuilder, output: string ): string; + copy( source: MathNode ): this; + + static RAD: string; + static DEG: string; + static EXP: string; + static EXP2: string; + static LOG: string; + static LOG2: string; + static SQRT: string; + static INV_SQRT: string; + static FLOOR: string; + static CEIL: string; + static NORMALIZE: string; + static SATURATE: string; + static SIN: string; + static COS: string; + static TAN: string; + static ASIN: string; + static ACOS: string; + static ARCTAN: string; + static ABS: string; + static SIGN: string; + static LENGTH: string; + static NEGATE: string; + static INVERT: string; + + static MIN: string; + static MAX: string; + static MOD: string; + static STEP: string; + static REFLECT: string; + static DISTANCE: string; + static DOT: string; + static CROSS: string; + static POW: string; + + static MIX: string; + static CLAMP: string; + static REFRACT: string; + static SMOOTHSTEP: string; + static FACEFORWARD: string; + } diff --git a/examples/jsm/nodes/math/OperatorNode.d.ts b/examples/jsm/nodes/math/OperatorNode.d.ts index f15c00e9ccc52fcf077472737d875ab8f81094d5..4c6a4f83d51210cacb0a8a93fc5bdbb7af383468 100644 --- a/examples/jsm/nodes/math/OperatorNode.d.ts +++ b/examples/jsm/nodes/math/OperatorNode.d.ts @@ -3,17 +3,19 @@ import { NodeBuilder } from '../core/NodeBuilder'; import { Node } from '../core/Node'; export class OperatorNode extends TempNode { - constructor(a: Node, b: Node, op: string); - a: Node; - b: Node; - op: string; + constructor( a: Node, b: Node, op: string ); - generate(builder: NodeBuilder, output: string): string; - copy(source: OperatorNode): this; + a: Node; + b: Node; + op: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: OperatorNode ): this; + + static ADD: string; + static SUB: string; + static MUL: string; + static DIV: string; - static ADD: string; - static SUB: string; - static MUL: string; - static DIV: string; } diff --git a/examples/jsm/nodes/misc/BumpMapNode.d.ts b/examples/jsm/nodes/misc/BumpMapNode.d.ts index 53d25827d87ddb39bf2662027550a95b0bb7a942..6b52569981b0e511b6201980df2f4ea588add7f6 100644 --- a/examples/jsm/nodes/misc/BumpMapNode.d.ts +++ b/examples/jsm/nodes/misc/BumpMapNode.d.ts @@ -5,19 +5,21 @@ import { FunctionNode } from '../core/FunctionNode'; import { TextureNode } from '../inputs/TextureNode'; export class BumpMapNode extends TempNode { - constructor(value: TextureNode, scale?: FloatNode); - value: TextureNode; - scale: FloatNode; - toNormalMap: boolean; - nodeType: string; + constructor( value: TextureNode, scale?: FloatNode ); - generate(builder: NodeBuilder, output: string): string; - copy(source: BumpMapNode): this; + value: TextureNode; + scale: FloatNode; + toNormalMap: boolean; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: BumpMapNode ): this; + + static Nodes: { + dHdxy_fwd: FunctionNode; + perturbNormalArb: FunctionNode; + bumpToNormal: FunctionNode; + } - static Nodes: { - dHdxy_fwd: FunctionNode; - perturbNormalArb: FunctionNode; - bumpToNormal: FunctionNode; - } } diff --git a/examples/jsm/nodes/misc/NormalMapNode.d.ts b/examples/jsm/nodes/misc/NormalMapNode.d.ts index 449b65f85bc5e2f8c1c4804b08ba3a7a6c4edff1..d3627b6e6619a58561b01792625ae860be0ac327 100644 --- a/examples/jsm/nodes/misc/NormalMapNode.d.ts +++ b/examples/jsm/nodes/misc/NormalMapNode.d.ts @@ -5,17 +5,19 @@ import { TextureNode } from '../inputs/TextureNode'; import { Vector2Node } from '../inputs/Vector2Node'; export class NormalMapNode extends TempNode { - constructor(value: TextureNode, scale?: Vector2Node); - value: TextureNode; - scale: Vector2Node; - toNormalMap: boolean; - nodeType: string; + constructor( value: TextureNode, scale?: Vector2Node ); - generate(builder: NodeBuilder, output: string): string; - copy(source: NormalMapNode): this; + value: TextureNode; + scale: Vector2Node; + toNormalMap: boolean; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: NormalMapNode ): this; + + static Nodes: { + perturbNormal2Arb: FunctionNode; + } - static Nodes: { - perturbNormal2Arb: FunctionNode; - } } diff --git a/examples/jsm/nodes/misc/NormalMapNode.js b/examples/jsm/nodes/misc/NormalMapNode.js index 857e0752712bf6930219c7f2faa0a12751c86294..f2350ec0ed0e84238f1559363013482a1ca0358f 100644 --- a/examples/jsm/nodes/misc/NormalMapNode.js +++ b/examples/jsm/nodes/misc/NormalMapNode.js @@ -20,12 +20,12 @@ function NormalMapNode( value, scale ) { NormalMapNode.Nodes = ( function () { - var perturbNormal2Arb = new FunctionNode( + var perturbNormal2Arb = new FunctionNode( -// Per-Pixel Tangent Space Normal Mapping -// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html - -`vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) { + // Per-Pixel Tangent Space Normal Mapping + // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html + + `vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) { // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988 diff --git a/examples/jsm/nodes/misc/TextureCubeNode.d.ts b/examples/jsm/nodes/misc/TextureCubeNode.d.ts index a092c8622c27a50f8058ad4fc8fb3bf496d785b3..745bc7217f3afd22af10af734ce078dcfe1c79aa 100644 --- a/examples/jsm/nodes/misc/TextureCubeNode.d.ts +++ b/examples/jsm/nodes/misc/TextureCubeNode.d.ts @@ -5,19 +5,20 @@ import { FloatNode } from '../inputs/FloatNode'; import { TextureCubeUVNode } from './TextureCubeUVNode'; export class TextureCubeNode extends TempNode { - constructor(value: TextureNode, textureSize?: FloatNode); - value: TextureNode; - textureSize: FloatNode; - radianceCache: { - uv: TextureCubeUVNode - }; - irradianceCache: { - uv: TextureCubeUVNode - }; - nodeType: string; + constructor( value: TextureNode, textureSize?: FloatNode ); - generateTextureCubeUV(builder: NodeBuilder, output: string): string; - generate(builder: NodeBuilder, output: string): string; + value: TextureNode; + textureSize: FloatNode; + radianceCache: { + uv: TextureCubeUVNode + }; + irradianceCache: { + uv: TextureCubeUVNode + }; + nodeType: string; + + generateTextureCubeUV( builder: NodeBuilder, output: string ): string; + generate( builder: NodeBuilder, output: string ): string; } diff --git a/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts b/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts index 71346c428980c8b828a432cf491780be14c026c9..adddeac2fcd83504bbcfd9bb19fc823b8f78375d 100644 --- a/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts +++ b/examples/jsm/nodes/misc/TextureCubeUVNode.d.ts @@ -6,17 +6,18 @@ import { FunctionNode } from '../core/FunctionNode'; import { Node } from '../core/Node'; export class TextureCubeUVNode extends TempNode { - constructor(uv: Node, textureSize: FloatNode); - uv: Node; - textureSize: FloatNode; - nodeType: string; + constructor( uv: Node, textureSize: FloatNode ); - generate(builder: NodeBuilder, output: string): string; + uv: Node; + textureSize: FloatNode; + nodeType: string; - static Nodes: { - TextureCubeUVData: StructNode; - textureCubeUV: FunctionNode; - } + generate( builder: NodeBuilder, output: string ): string; + + static Nodes: { + TextureCubeUVData: StructNode; + textureCubeUV: FunctionNode; + } } diff --git a/examples/jsm/nodes/postprocessing/NodePass.d.ts b/examples/jsm/nodes/postprocessing/NodePass.d.ts index 5a22e3e9a58ec8d742d6eedf6c3cb39430c02af1..1a48af3895df5ced32dba84379756bdfc625604e 100644 --- a/examples/jsm/nodes/postprocessing/NodePass.d.ts +++ b/examples/jsm/nodes/postprocessing/NodePass.d.ts @@ -3,14 +3,16 @@ import { ShaderPass } from '../../postprocessing/ShaderPass'; import { ScreenNode } from '../inputs/ScreenNode'; export class NodePass extends ShaderPass { - constructor(); - name: string; - uuid: string; - userData: object; - input: ScreenNode; - needsUpdate: boolean; + constructor(); + + name: string; + uuid: string; + userData: object; + input: ScreenNode; + needsUpdate: boolean; + + copy( source: NodePass ): this; + toJSON( meta?: object | string ): object; - copy(source: NodePass): this; - toJSON(meta?: object | string): object; } diff --git a/examples/jsm/nodes/postprocessing/NodePostProcessing.d.ts b/examples/jsm/nodes/postprocessing/NodePostProcessing.d.ts index d2c21cfe6eeff7a67cf73ceee798bd00e19dba3c..02fa7ac663e7ddbc128bc1c4c66ddc84b84673d7 100644 --- a/examples/jsm/nodes/postprocessing/NodePostProcessing.d.ts +++ b/examples/jsm/nodes/postprocessing/NodePostProcessing.d.ts @@ -1,10 +1,10 @@ import { - Camera, - Mesh, - OrthographicCamera, - Scene, - WebGLRenderer, - WebGLRenderTarget, + Camera, + Mesh, + OrthographicCamera, + Scene, + WebGLRenderer, + WebGLRenderTarget, } from '../../../../src/Three'; import { ScreenNode } from '../inputs/ScreenNode'; @@ -12,22 +12,24 @@ import { NodeMaterial } from '../materials/NodeMaterial'; import { NodeFrame } from '../core/NodeFrame'; export class NodePostProcessing { - constructor(renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget); - renderer: WebGLRenderer; - renderTarget: WebGLRenderTarget; + constructor( renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget ); - output: ScreenNode; - material: NodeMaterial + renderer: WebGLRenderer; + renderTarget: WebGLRenderTarget; - camera: OrthographicCamera; - scene: Scene; + output: ScreenNode; + material: NodeMaterial - quad: Mesh; - needsUpdate: boolean; + camera: OrthographicCamera; + scene: Scene; - render(scene: Scene, camera: Camera, frame: NodeFrame): void; - setSize(width: number, height: number): void; - copy(source: NodePostProcessing): this; - toJSON(meta?: object | string): object; -} \ No newline at end of file + quad: Mesh; + needsUpdate: boolean; + + render( scene: Scene, camera: Camera, frame: NodeFrame ): void; + setSize( width: number, height: number ): void; + copy( source: NodePostProcessing ): this; + toJSON( meta?: object | string ): object; + +} diff --git a/examples/jsm/nodes/procedural/CheckerNode.d.ts b/examples/jsm/nodes/procedural/CheckerNode.d.ts index 82c1ff5d00d548bcbbf231ca245addb2a948d4cd..e96908d595eb76a1a10ff5e67adb0f76641da048 100644 --- a/examples/jsm/nodes/procedural/CheckerNode.d.ts +++ b/examples/jsm/nodes/procedural/CheckerNode.d.ts @@ -5,15 +5,17 @@ import { UVNode } from '../accessors/UVNode'; import { UVTransformNode } from '../utils/UVTransformNode'; export class CheckerNode extends TempNode { - constructor(uv?: UVNode | UVTransformNode); - uv: UVNode | UVTransformNode; - nodeType: string; + constructor( uv?: UVNode | UVTransformNode ); - generate(builder: NodeBuilder, output: string): string; - copy(source: CheckerNode): this; + uv: UVNode | UVTransformNode; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: CheckerNode ): this; + + static Nodes: { + checker: FunctionNode; + }; - static Nodes: { - checker: FunctionNode; - }; } diff --git a/examples/jsm/nodes/procedural/NoiseNode.d.ts b/examples/jsm/nodes/procedural/NoiseNode.d.ts index 343484765fef8c75ae07b593aa46a250af8827db..93693701cb538b067477ef084ead96049a90afd0 100644 --- a/examples/jsm/nodes/procedural/NoiseNode.d.ts +++ b/examples/jsm/nodes/procedural/NoiseNode.d.ts @@ -5,15 +5,17 @@ import { UVNode } from '../accessors/UVNode'; import { UVTransformNode } from '../utils/UVTransformNode'; export class NoiseNode extends TempNode { - constructor(uv?: UVNode | UVTransformNode); - uv: UVNode | UVTransformNode; - nodeType: string; + constructor( uv?: UVNode | UVTransformNode ); - generate(builder: NodeBuilder, output: string): string; - copy(source: NoiseNode): this; + uv: UVNode | UVTransformNode; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: NoiseNode ): this; + + static Nodes: { + snoise: FunctionNode; + }; - static Nodes: { - snoise: FunctionNode; - }; } diff --git a/examples/jsm/nodes/utils/BypassNode.d.ts b/examples/jsm/nodes/utils/BypassNode.d.ts index ba0fd3516c68cfb8307979d353333ef5747b5dff..44cabd545808e39c406bf0af0f3514bae6b54238 100644 --- a/examples/jsm/nodes/utils/BypassNode.d.ts +++ b/examples/jsm/nodes/utils/BypassNode.d.ts @@ -2,12 +2,14 @@ import { Node } from '../core/Node'; import { NodeBuilder } from '../core/NodeBuilder'; export class BypassNode extends Node { - constructor(code: Node, value?: Node); - code: Node; - value: Node | undefined; - nodeType: string; + constructor( code: Node, value?: Node ); + + code: Node; + value: Node | undefined; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: BypassNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: BypassNode): this; } diff --git a/examples/jsm/nodes/utils/ColorSpaceNode.d.ts b/examples/jsm/nodes/utils/ColorSpaceNode.d.ts index ad50f42dcbda033cff1eeb36d9fbf6d62c9cff80..ab062300a2c8616aade28fb5050dd7df48e25d49 100644 --- a/examples/jsm/nodes/utils/ColorSpaceNode.d.ts +++ b/examples/jsm/nodes/utils/ColorSpaceNode.d.ts @@ -4,54 +4,56 @@ import { FunctionNode } from '../core/FunctionNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class ColorSpaceNode extends TempNode { - constructor(input: Node, method?: string); - - input: Node; - method: string | undefined; - nodeType: string; - - generate(builder: NodeBuilder, output: string): string; - fromEncoding(encoding: number); - fromDecoding(encoding: number); - copy(source: ColorSpaceNode): this; - - static Nodes: { - LinearToLinear: FunctionNode; - GammaToLinear: FunctionNode; - LinearToGamma: FunctionNode; - sRGBToLinear: FunctionNode; - LinearTosRGB: FunctionNode; - RGBEToLinear: FunctionNode; - LinearToRGBE: FunctionNode; - RGBMToLinear: FunctionNode; - LinearToRGBM: FunctionNode; - RGBDToLinear: FunctionNode; - LinearToRGBD: FunctionNode; - cLogLuvM: FunctionNode; - LinearToLogLuv: FunctionNode; - cLogLuvInverseM: FunctionNode; - LogLuvToLinear: FunctionNode; - }; - - static LINEAR_TO_LINEAR: string; - - static GAMMA_TO_LINEAR: string; - static LINEAR_TO_GAMMA: string; - - static SRGB_TO_LINEAR: string; - static LINEAR_TO_SRGB: string; - - static RGBE_TO_LINEAR: string; - static LINEAR_TO_RGBE: string; - - static RGBM_TO_LINEAR: string; - static LINEAR_TO_RGBM: string; - - static RGBD_TO_LINEAR: string; - static LINEAR_TO_RGBD: string; - - static LINEAR_TO_LOG_LUV: string; - static LOG_LUV_TO_LINEAR: string; - - static getEncodingComponents(encoding: number): any[]; + + constructor( input: Node, method?: string ); + + input: Node; + method: string | undefined; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + fromEncoding( encoding: number ); + fromDecoding( encoding: number ); + copy( source: ColorSpaceNode ): this; + + static Nodes: { + LinearToLinear: FunctionNode; + GammaToLinear: FunctionNode; + LinearToGamma: FunctionNode; + sRGBToLinear: FunctionNode; + LinearTosRGB: FunctionNode; + RGBEToLinear: FunctionNode; + LinearToRGBE: FunctionNode; + RGBMToLinear: FunctionNode; + LinearToRGBM: FunctionNode; + RGBDToLinear: FunctionNode; + LinearToRGBD: FunctionNode; + cLogLuvM: FunctionNode; + LinearToLogLuv: FunctionNode; + cLogLuvInverseM: FunctionNode; + LogLuvToLinear: FunctionNode; + }; + + static LINEAR_TO_LINEAR: string; + + static GAMMA_TO_LINEAR: string; + static LINEAR_TO_GAMMA: string; + + static SRGB_TO_LINEAR: string; + static LINEAR_TO_SRGB: string; + + static RGBE_TO_LINEAR: string; + static LINEAR_TO_RGBE: string; + + static RGBM_TO_LINEAR: string; + static LINEAR_TO_RGBM: string; + + static RGBD_TO_LINEAR: string; + static LINEAR_TO_RGBD: string; + + static LINEAR_TO_LOG_LUV: string; + static LOG_LUV_TO_LINEAR: string; + + static getEncodingComponents( encoding: number ): any[]; + } diff --git a/examples/jsm/nodes/utils/JoinNode.d.ts b/examples/jsm/nodes/utils/JoinNode.d.ts index a0034e360d8ece83b150600bb8c5e770988ea0d7..008e76a4be59f3a75a0b96b858e495feb6b49297 100644 --- a/examples/jsm/nodes/utils/JoinNode.d.ts +++ b/examples/jsm/nodes/utils/JoinNode.d.ts @@ -2,15 +2,17 @@ import { TempNode } from '../core/TempNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class JoinNode extends TempNode { - constructor(x: Node, y: Node, z?: Node, w?: Node); - x: Node; - y: Node; - z: Node | undefined; - w: Node | undefined; - nodeType: string; + constructor( x: Node, y: Node, z?: Node, w?: Node ); + + x: Node; + y: Node; + z: Node | undefined; + w: Node | undefined; + nodeType: string; + + getNumElements(): number; + generate( builder: NodeBuilder, output: string ): string; + copy( source: JoinNode ): this; - getNumElements(): number; - generate(builder: NodeBuilder, output: string): string; - copy(source: JoinNode): this; } diff --git a/examples/jsm/nodes/utils/MaxMIPLevelNode.d.ts b/examples/jsm/nodes/utils/MaxMIPLevelNode.d.ts index ad6713815a9dc145d3a55b376bb06f710fd6c83e..9dddd1eb2f83949d9feed4e843f9770d5567bbf4 100644 --- a/examples/jsm/nodes/utils/MaxMIPLevelNode.d.ts +++ b/examples/jsm/nodes/utils/MaxMIPLevelNode.d.ts @@ -2,10 +2,12 @@ import { FloatNode } from '../inputs/FloatNode'; import { Node } from '../core/Node'; export class MaxMIPLevelNode extends FloatNode { - constructor(texture: Node); - texture: Node; - maxMIPLevel: number; - nodeType: string; - value: number; + constructor( texture: Node ); + + texture: Node; + maxMIPLevel: number; + nodeType: string; + value: number; + } diff --git a/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts b/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts index ea60c9d35034b14f693776466099e02aa50f5a41..6dce58290f566b45a133fc89123e070d925be12e 100644 --- a/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts +++ b/examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts @@ -4,16 +4,18 @@ import { MaxMIPLevelNode } from '../utils/MaxMIPLevelNode'; import { FunctionNode } from '../core/FunctionNode'; export class SpecularMIPLevelNode extends TempNode { - constructor(texture: Node); - texture: Node; - maxMIPLevel: MaxMIPLevelNode; - nodeType: string; + constructor( texture: Node ); - generate(builder: NodeBuilder, output: string): string; - copy(source: SpecularMIPLevelNode): this; + texture: Node; + maxMIPLevel: MaxMIPLevelNode; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: SpecularMIPLevelNode ): this; + + static Nodes: { + getSpecularMIPLevel: FunctionNode; + }; - static Nodes: { - getSpecularMIPLevel: FunctionNode; - }; } diff --git a/examples/jsm/nodes/utils/SpecularMIPLevelNode.js b/examples/jsm/nodes/utils/SpecularMIPLevelNode.js index c812b53a826f23579456163222da291cfa2228cf..524388698bb6971d20b8a2ed3634454dd895bbb6 100644 --- a/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +++ b/examples/jsm/nodes/utils/SpecularMIPLevelNode.js @@ -42,7 +42,7 @@ SpecularMIPLevelNode.prototype = Object.create( TempNode.prototype ); SpecularMIPLevelNode.prototype.constructor = SpecularMIPLevelNode; SpecularMIPLevelNode.prototype.nodeType = "SpecularMIPLevel"; -SpecularMIPLevelNode.prototype.setTexture = function( texture ) { +SpecularMIPLevelNode.prototype.setTexture = function ( texture ) { this.texture = texture; diff --git a/examples/jsm/nodes/utils/SubSlot.d.ts b/examples/jsm/nodes/utils/SubSlot.d.ts index 0496e36ac741a2a8f9aa56acdb805238b3472098..34b2f6f7f1812b42785f3c624ba0dad00cd38ddf 100644 --- a/examples/jsm/nodes/utils/SubSlot.d.ts +++ b/examples/jsm/nodes/utils/SubSlot.d.ts @@ -2,10 +2,12 @@ import { TempNode } from '../core/TempNode'; import { NodeBuilder } from '../core/NodeBuilder'; export class SubSlots extends TempNode { - constructor(slots?: object); - slots: Node[]; + constructor( slots?: object ); + + slots: Node[]; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: SubSlots ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: SubSlots): this; } diff --git a/examples/jsm/nodes/utils/SubSlotNode.js b/examples/jsm/nodes/utils/SubSlotNode.js index 67dc256beb62368eaa480d17b67d0c7e7a38492d..9fbfce7f878ee956d856811ec1bdd48c59d37736 100644 --- a/examples/jsm/nodes/utils/SubSlotNode.js +++ b/examples/jsm/nodes/utils/SubSlotNode.js @@ -26,7 +26,7 @@ SubSlotNode.prototype.generate = function ( builder, output ) { if ( this.slots[ builder.slot ] ) { - return this.slots[ builder.slot ].build( builder, output ) + return this.slots[ builder.slot ].build( builder, output ); } diff --git a/examples/jsm/nodes/utils/SwitchNode.d.ts b/examples/jsm/nodes/utils/SwitchNode.d.ts index 4247e4e517cd37b6cd6b0593fc84a048cb65e689..da20d832145fd029056fa12f84d0d34bc8c81fc3 100644 --- a/examples/jsm/nodes/utils/SwitchNode.d.ts +++ b/examples/jsm/nodes/utils/SwitchNode.d.ts @@ -2,12 +2,14 @@ import { Node } from '../core/Node'; import { NodeBuilder } from '../core/NodeBuilder'; export class SwitchNode extends Node { - constructor(node: Node, components?: string); - node: Node; - components: string; - nodeType: string; + constructor( node: Node, components?: string ); + + node: Node; + components: string; + nodeType: string; + + generate( builder: NodeBuilder, output: string ): string; + copy( source: SwitchNode ): this; - generate(builder: NodeBuilder, output: string): string; - copy(source: SwitchNode): this; } diff --git a/examples/jsm/nodes/utils/TimerNode.d.ts b/examples/jsm/nodes/utils/TimerNode.d.ts index e9053e4af81f50087d4295bfdcdc88f11f82d6ce..4399ba91b8ab151f119d8a2e75ca4da7ec51c1ed 100644 --- a/examples/jsm/nodes/utils/TimerNode.d.ts +++ b/examples/jsm/nodes/utils/TimerNode.d.ts @@ -2,18 +2,20 @@ import { NodeFrame } from '../core/NodeFrame'; import { FloatNode } from '../inputs/FloatNode'; export class TimerNode extends FloatNode { - constructor(scale?: number, scope?: string, timeScale?: boolean); - scale: number; - scope: string; - timeScale: boolean; - nodeType: string; + constructor( scale?: number, scope?: string, timeScale?: boolean ); - getUnique(): boolean; - updateFrame(frame: NodeFrame): void; - copy(source: TimerNode): this; + scale: number; + scope: string; + timeScale: boolean; + nodeType: string; + + getUnique(): boolean; + updateFrame( frame: NodeFrame ): void; + copy( source: TimerNode ): this; + + static GLOBAL: string; + static LOCAL: string; + static DELTA: string; - static GLOBAL: string; - static LOCAL: string; - static DELTA: string; } diff --git a/examples/jsm/nodes/utils/UVTransformNode.d.ts b/examples/jsm/nodes/utils/UVTransformNode.d.ts index 82bbc49311275bc4240953f730bc4b3b6c78cde5..28d826b630760936cfe90d24866cdf16a856f0c0 100644 --- a/examples/jsm/nodes/utils/UVTransformNode.d.ts +++ b/examples/jsm/nodes/utils/UVTransformNode.d.ts @@ -2,18 +2,18 @@ import { ExpressionNode } from '../core/ExpressionNode'; import { NodeBuilder } from '../core/NodeBuilder'; import { Matrix3Node } from '../inputs/Matrix3Node'; import { UVNode } from '../accessors/UVNode'; - + export class UVTransformNode extends ExpressionNode { - constructor(uv?: UVNode, position?: Matrix3Node); - uv: UVNode; - position: Matrix3Node; + constructor( uv?: UVNode, position?: Matrix3Node ); + + uv: UVNode; + position: Matrix3Node; - nodeType: string; + nodeType: string; - generate(builder: NodeBuilder, output: string): string; - setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx?: number, cy?: number): void; - copy(source: UVTransformNode): this; + generate( builder: NodeBuilder, output: string ): string; + setUvTransform( tx: number, ty: number, sx: number, sy: number, rotation: number, cx?: number, cy?: number ): void; + copy( source: UVTransformNode ): this; } - \ No newline at end of file diff --git a/examples/jsm/nodes/utils/VelocityNode.d.ts b/examples/jsm/nodes/utils/VelocityNode.d.ts index df73b15ab23998f41b9c2875d4a3191c8c565b95..bbab582d478d7edf9469bd9f2aba1a349c009532 100644 --- a/examples/jsm/nodes/utils/VelocityNode.d.ts +++ b/examples/jsm/nodes/utils/VelocityNode.d.ts @@ -1,32 +1,33 @@ -import { - Object3D, - Vector3 +import { + Object3D, + Vector3 } from '../../../../src/Three'; import { NodeFrame } from '../core/NodeFrame'; import { Vector3Node } from '../inputs/Vector3Node'; export interface VelocityNodeParams { - damping: number; - spring: number; - type: string; + damping: number; + spring: number; + type: string; } export class VelocityNode extends Vector3Node { - constructor(target: Object3D, params?: VelocityNodeParams); - velocity: Vector3; - moment: Vector3 | undefined; - speed: Vector3 | undefined; - springVelocity: Vector3 | undefined; - lastVelocity: Vector3 | undefined; + constructor( target: Object3D, params?: VelocityNodeParams ); - nodeType: string; + velocity: Vector3; + moment: Vector3 | undefined; + speed: Vector3 | undefined; + springVelocity: Vector3 | undefined; + lastVelocity: Vector3 | undefined; - setParams(params: VelocityNodeParams): void; - setTarget(target: Object3D): void; - updateFrameVelocity(frame: NodeFrame): void; - updateFrame(frame: NodeFrame): void; - copy(source: VelocityNode): this; + nodeType: string; + + setParams( params: VelocityNodeParams ): void; + setTarget( target: Object3D ): void; + updateFrameVelocity( frame: NodeFrame ): void; + updateFrame( frame: NodeFrame ): void; + copy( source: VelocityNode ): this; } diff --git a/examples/jsm/objects/Fire.d.ts b/examples/jsm/objects/Fire.d.ts index 9392c8ad2257f902241eb3b34b1a8b3699296313..1756fcbb166e7cb634efd6672aff8986d2d276a4 100644 --- a/examples/jsm/objects/Fire.d.ts +++ b/examples/jsm/objects/Fire.d.ts @@ -1,187 +1,188 @@ import { - BufferGeometry, - Color, - Clock, - DataTexture, - Mesh, - OrthographicCamera, - PlaneBufferGeometry, - Scene, - ShaderMaterial, - Texture, - Uniform, - WebGLRenderer, - WebGLRenderTarget + BufferGeometry, + Color, + Clock, + DataTexture, + Mesh, + OrthographicCamera, + PlaneBufferGeometry, + Scene, + ShaderMaterial, + Texture, + Uniform, + WebGLRenderer, + WebGLRenderTarget } from '../../../src/Three'; export interface FireOptions { - textureWidth?: number; - textureHeight?: number; - debug?: boolean; - color1?: Color; - color2?: Color; - color3?: Color; - colorBias?: number; - diffuse?: number; - viscosity?: number; - expansion?: number; - swirl?: number; - burnRate?: number; - drag?: number; - airSpeed?: number; - windVector?: number; - speed?: number; - massConservation?: boolean; + textureWidth?: number; + textureHeight?: number; + debug?: boolean; + color1?: Color; + color2?: Color; + color3?: Color; + colorBias?: number; + diffuse?: number; + viscosity?: number; + expansion?: number; + swirl?: number; + burnRate?: number; + drag?: number; + airSpeed?: number; + windVector?: number; + speed?: number; + massConservation?: boolean; } export class Fire extends Mesh { - constructor(geometry: BufferGeometry, options: FireOptions); - clock: Clock; - color1: Color; - color2: Color; - color3: Color; - colorBias: number; - diffuse: number; - viscosity: number; - expansion: number; - swirl: number; - burnRate: number; - drag: number; - airSpeed: number; - windVector: number; - speed: number; - massConservation: boolean; - - sourceData: Uint8Array; - - field0: WebGLRenderTarget; - field1: WebGLRenderTarget; - fieldProj: WebGLRenderTarget; - fieldScene: Scene; - orthoCamera: OrthographicCamera; - fieldGeometry: PlaneBufferGeometry; - internalSource: DataTexture; - sourceMaterial: ShaderMaterial; - sourceMesh: Mesh; - diffuseMaterial: ShaderMaterial; - driftMaterial: ShaderMaterial; - projMaterial1: ShaderMaterial; - projMaterial2: ShaderMaterial; - projMaterial3: ShaderMaterial; - material: ShaderMaterial; - - addSource(u: number, v: number, radius: number, density?: number, windX?: number, windY?: number): Uint8Array; - clearDiffuse(): void; - clearSources(): Uint8Array; - configShaders(dt: number): void; - renderDiffuse(renderer: WebGLRenderer): void; - renderDrift(renderer: WebGLRenderer): void; - renderProject(renderer: WebGLRenderer): void; - renderSource(renderer: WebGLRenderer): void; - restoreRenderState(renderer: WebGLRenderer): void; - saveRenderState(renderer: WebGLRenderer): void; - setSourceMap(texture: Texture): void; - swapTextures(): void; - - static SourceShader: SourceShader; - static DiffuseShader: DiffuseShader; - static DriftShader: DriftShader; - static ProjectionShader1: ProjectionShader1; - static ProjectionShader2: ProjectionShader2; - static ProjectionShader3: ProjectionShader3; - static ColorShader: ColorShader; - static DebugShader: DebugShader; + + constructor( geometry: BufferGeometry, options: FireOptions ); + clock: Clock; + color1: Color; + color2: Color; + color3: Color; + colorBias: number; + diffuse: number; + viscosity: number; + expansion: number; + swirl: number; + burnRate: number; + drag: number; + airSpeed: number; + windVector: number; + speed: number; + massConservation: boolean; + + sourceData: Uint8Array; + + field0: WebGLRenderTarget; + field1: WebGLRenderTarget; + fieldProj: WebGLRenderTarget; + fieldScene: Scene; + orthoCamera: OrthographicCamera; + fieldGeometry: PlaneBufferGeometry; + internalSource: DataTexture; + sourceMaterial: ShaderMaterial; + sourceMesh: Mesh; + diffuseMaterial: ShaderMaterial; + driftMaterial: ShaderMaterial; + projMaterial1: ShaderMaterial; + projMaterial2: ShaderMaterial; + projMaterial3: ShaderMaterial; + material: ShaderMaterial; + + addSource( u: number, v: number, radius: number, density?: number, windX?: number, windY?: number ): Uint8Array; + clearDiffuse(): void; + clearSources(): Uint8Array; + configShaders( dt: number ): void; + renderDiffuse( renderer: WebGLRenderer ): void; + renderDrift( renderer: WebGLRenderer ): void; + renderProject( renderer: WebGLRenderer ): void; + renderSource( renderer: WebGLRenderer ): void; + restoreRenderState( renderer: WebGLRenderer ): void; + saveRenderState( renderer: WebGLRenderer ): void; + setSourceMap( texture: Texture ): void; + swapTextures(): void; + + static SourceShader: SourceShader; + static DiffuseShader: DiffuseShader; + static DriftShader: DriftShader; + static ProjectionShader1: ProjectionShader1; + static ProjectionShader2: ProjectionShader2; + static ProjectionShader3: ProjectionShader3; + static ColorShader: ColorShader; + static DebugShader: DebugShader; } declare interface SourceShader { - uniforms: { - sourceMap: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + sourceMap: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface DiffuseShader { - uniforms: { - oneOverWidth: Uniform; - oneOverHeight: Uniform; - diffuse: Uniform; - viscosity: Uniform; - expansion: Uniform; - swirl: Uniform; - drag: Uniform; - burnRate: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + oneOverWidth: Uniform; + oneOverHeight: Uniform; + diffuse: Uniform; + viscosity: Uniform; + expansion: Uniform; + swirl: Uniform; + drag: Uniform; + burnRate: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface DriftShader { - uniforms: { - oneOverWidth: Uniform; - oneOverHeight: Uniform; - windVector: Uniform; - airSpeed: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + oneOverWidth: Uniform; + oneOverHeight: Uniform; + windVector: Uniform; + airSpeed: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface ProjectionShader1 { - uniforms: { - oneOverWidth: Uniform; - oneOverHeight: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + oneOverWidth: Uniform; + oneOverHeight: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface ProjectionShader2 { - uniforms: { - oneOverWidth: Uniform; - oneOverHeight: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + oneOverWidth: Uniform; + oneOverHeight: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface ProjectionShader3 { - uniforms: { - oneOverWidth: Uniform; - oneOverHeight: Uniform; - densityMap: Uniform; - projMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + oneOverWidth: Uniform; + oneOverHeight: Uniform; + densityMap: Uniform; + projMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface ColorShader { - uniforms: { - color1: Uniform; - color2: Uniform; - color3: Uniform; - colorBias: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + color1: Uniform; + color2: Uniform; + color3: Uniform; + colorBias: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } declare interface DebugShader { - uniforms: { - color1: Uniform; - color2: Uniform; - color3: Uniform; - colorBias: Uniform; - densityMap: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + color1: Uniform; + color2: Uniform; + color3: Uniform; + colorBias: Uniform; + densityMap: Uniform; + }; + vertexShader: string; + fragmentShader: string; } diff --git a/examples/jsm/objects/Lensflare.d.ts b/examples/jsm/objects/Lensflare.d.ts index 6193fd8f093109c3d6ee6c2da0736e62a9eac1ac..1cd8c1f8756de90e717ca3ba03cdcfbfeba11305 100644 --- a/examples/jsm/objects/Lensflare.d.ts +++ b/examples/jsm/objects/Lensflare.d.ts @@ -1,21 +1,25 @@ import { - Mesh, - Texture, - Color + Mesh, + Texture, + Color } from '../../../src/Three'; export class LensflareElement { - constructor(texture: Texture, size?: number, distance?: number, color?: Color ); - texture: Texture; - size: number; - distance: number; - color: Color; + + constructor( texture: Texture, size?: number, distance?: number, color?: Color ); + texture: Texture; + size: number; + distance: number; + color: Color; + } export class Lensflare extends Mesh { - constructor(); - isLensflare: boolean; - addElement(element: LensflareElement): void; - dispose(): void; + constructor(); + isLensflare: boolean; + + addElement( element: LensflareElement ): void; + dispose(): void; + } diff --git a/examples/jsm/objects/LightningStorm.d.ts b/examples/jsm/objects/LightningStorm.d.ts index 111caf6e60893ba87c4737a78ea66b75ab82ba39..3d7b3066e3ee67db32b9aa92773ecf6afe4bb460 100644 --- a/examples/jsm/objects/LightningStorm.d.ts +++ b/examples/jsm/objects/LightningStorm.d.ts @@ -1,35 +1,37 @@ import { - Material, - Vector3 + Material, + Vector3 } from '../../../src/Three'; import { LightningStrike, RayParameters } from '../geometries/LightningStrike'; export interface StormParams { - size?: number; - minHeight?: number; - maxHeight?: number; - maxSlope?: number; + size?: number; + minHeight?: number; + maxHeight?: number; + maxSlope?: number; - maxLightnings?: number; + maxLightnings?: number; - lightningMinPeriod?: number; - lightningMaxPeriod?: number; - lightningMinDuration?: number; - lightningMaxDuration?: number; + lightningMinPeriod?: number; + lightningMaxPeriod?: number; + lightningMinDuration?: number; + lightningMaxDuration?: number; - lightningParameters?: RayParameters; - lightningMaterial?: Material; + lightningParameters?: RayParameters; + lightningMaterial?: Material; - isEternal?: boolean; + isEternal?: boolean; - onRayPosition?: (source: Vector3, dest: Vector3) => void; - onLightningDown?: (lightning: LightningStrike) => void; + onRayPosition?: ( source: Vector3, dest: Vector3 ) => void; + onLightningDown?: ( lightning: LightningStrike ) => void; } export class LightningStorm { - constructor(stormParams?: StormParams); - update(time: number): void; - copy(source: LightningStorm): LightningStorm; - clone(): LightningStorm; + + constructor( stormParams?: StormParams ); + update( time: number ): void; + copy( source: LightningStorm ): LightningStorm; + clone(): LightningStorm; + } diff --git a/examples/jsm/objects/MarchingCubes.d.ts b/examples/jsm/objects/MarchingCubes.d.ts index 2c020ebbc890fe9bbbfe570e7914b769ff29ca64..77f2495a08e20ede25f25ee35ec488e4bf10ddec 100644 --- a/examples/jsm/objects/MarchingCubes.d.ts +++ b/examples/jsm/objects/MarchingCubes.d.ts @@ -1,70 +1,71 @@ import { - BufferGeometry, - Material, - ImmediateRenderObject + BufferGeometry, + Material, + ImmediateRenderObject } from '../../../src/Three'; export class MarchingCubes extends ImmediateRenderObject { - constructor(resolution: number, material: Material, enableUvs?: boolean, enableColors?: boolean); - enableUvs: boolean; - enableColors: boolean; + constructor( resolution: number, material: Material, enableUvs?: boolean, enableColors?: boolean ); - resolution: number; + enableUvs: boolean; + enableColors: boolean; - // parameters + resolution: number; - isolation: number; + // parameters - // size of field, 32 is pushing it in Javascript :) + isolation: number; - size: number; - size2: number; - size3: number; - halfsize: number; + // size of field, 32 is pushing it in Javascript :) - // deltas + size: number; + size2: number; + size3: number; + halfsize: number; - delta: number; - yd: number; - zd: number; + // deltas - field: Float32Array; - normal_cache: Float32Array; - palette: Float32Array; + delta: number; + yd: number; + zd: number; - maxCount: number; - count: number; + field: Float32Array; + normal_cache: Float32Array; + palette: Float32Array; - hasPositions: boolean; - hasNormals: boolean; - hasColors: boolean; - hasUvs: boolean; + maxCount: number; + count: number; - positionArray: Float32Array; - normalArray: Float32Array; + hasPositions: boolean; + hasNormals: boolean; + hasColors: boolean; + hasUvs: boolean; - uvArray: Float32Array; - colorArray: Float32Array; + positionArray: Float32Array; + normalArray: Float32Array; - begin(): void; - end(): void; + uvArray: Float32Array; + colorArray: Float32Array; - addBall( ballx: number, bally: number, ballz: number, strength: number, subtract: number, colors: any ): void; + begin(): void; + end(): void; - addPlaneX( strength: number, subtract: number ): void; - addPlaneY( strength: number, subtract: number ): void; - addPlaneZ( strength: number, subtract: number ): void; + addBall( ballx: number, bally: number, ballz: number, strength: number, subtract: number, colors: any ): void; - setCell ( x: number, y: number, z: number, value: number ): void; - getCell ( x: number, y: number, z: number ): number; + addPlaneX( strength: number, subtract: number ): void; + addPlaneY( strength: number, subtract: number ): void; + addPlaneZ( strength: number, subtract: number ): void; - blur( intensity: number ): void; + setCell ( x: number, y: number, z: number, value: number ): void; + getCell ( x: number, y: number, z: number ): number; - reset(): void; - render( renderCallback: any ): void; - generateGeometry(): BufferGeometry; - generateBufferGeometry(): BufferGeometry; + blur( intensity: number ): void; + + reset(): void; + render( renderCallback: any ): void; + generateGeometry(): BufferGeometry; + generateBufferGeometry(): BufferGeometry; } diff --git a/examples/jsm/objects/Reflector.d.ts b/examples/jsm/objects/Reflector.d.ts index 5f42b7af2e970f0150a3ae380295bc90414e80d7..c513e4e937137d9cdf6123355a2c0f930eb2655c 100644 --- a/examples/jsm/objects/Reflector.d.ts +++ b/examples/jsm/objects/Reflector.d.ts @@ -1,21 +1,23 @@ import { - Mesh, - BufferGeometry, - Color, - WebGLRenderTarget + Mesh, + BufferGeometry, + Color, + WebGLRenderTarget } from '../../../src/Three'; export interface ReflectorOptions { - color?: Color; - textureWidth?: number; - textureHeight?: number; - clipBias?: number; - shader?: object; - recursion?: number; + color?: Color; + textureWidth?: number; + textureHeight?: number; + clipBias?: number; + shader?: object; + recursion?: number; } export class Reflector extends Mesh { - constructor(geometry?: BufferGeometry, options?: ReflectorOptions); - getRenderTarget(): WebGLRenderTarget; + constructor( geometry?: BufferGeometry, options?: ReflectorOptions ); + + getRenderTarget(): WebGLRenderTarget; + } diff --git a/examples/jsm/objects/ReflectorRTT.d.ts b/examples/jsm/objects/ReflectorRTT.d.ts index 4e4bf8d1f4604315ef4f5bc9495d04a502e1c69d..e9a1b53f394ed1d94bebccb29d8c3e8260706f29 100644 --- a/examples/jsm/objects/ReflectorRTT.d.ts +++ b/examples/jsm/objects/ReflectorRTT.d.ts @@ -2,5 +2,7 @@ import { BufferGeometry } from '../../../src/Three'; import { Reflector, ReflectorOptions } from './Reflector'; export class ReflectorRTT extends Reflector { - constructor(geometry?: BufferGeometry, options?: ReflectorOptions); + + constructor( geometry?: BufferGeometry, options?: ReflectorOptions ); + } diff --git a/examples/jsm/objects/Refractor.d.ts b/examples/jsm/objects/Refractor.d.ts index 1c34fd6a52adcccdfa4619d906d2fe172dbf450b..d4ea091c70ac768d4df5172703cfbae59b658ab2 100644 --- a/examples/jsm/objects/Refractor.d.ts +++ b/examples/jsm/objects/Refractor.d.ts @@ -1,20 +1,22 @@ import { - Mesh, - BufferGeometry, - Color, - WebGLRenderTarget + Mesh, + BufferGeometry, + Color, + WebGLRenderTarget } from '../../../src/Three'; export interface RefractorOptions { - color?: Color; - textureWidth?: number; - textureHeight?: number; - clipBias?: number; - shader?: object; + color?: Color; + textureWidth?: number; + textureHeight?: number; + clipBias?: number; + shader?: object; } export class Refractor extends Mesh { - constructor(geometry?: BufferGeometry, options?: RefractorOptions); - getRenderTarget(): WebGLRenderTarget; + constructor( geometry?: BufferGeometry, options?: RefractorOptions ); + + getRenderTarget(): WebGLRenderTarget; + } diff --git a/examples/jsm/objects/ShadowMesh.d.ts b/examples/jsm/objects/ShadowMesh.d.ts index d48f51b5c8f6fe5515b02b9dc5d1b33996d521dc..0a3834352d2335f2d2ae549d4530fbf1fea0d4a3 100644 --- a/examples/jsm/objects/ShadowMesh.d.ts +++ b/examples/jsm/objects/ShadowMesh.d.ts @@ -1,11 +1,13 @@ import { - Mesh, - Plane, - Vector4 + Mesh, + Plane, + Vector4 } from '../../../src/Three'; export class ShadowMesh extends Mesh { - constructor(); - update(plane: Plane, lightPosition4D: Vector4): void; + constructor(); + + update( plane: Plane, lightPosition4D: Vector4 ): void; + } diff --git a/examples/jsm/objects/Sky.d.ts b/examples/jsm/objects/Sky.d.ts index d37d4f4de1afadcfcc058ca935a45861e2943fae..cb8c87c240b1f5007d2f2b0090bdbc1a193dce73 100644 --- a/examples/jsm/objects/Sky.d.ts +++ b/examples/jsm/objects/Sky.d.ts @@ -1,9 +1,11 @@ import { - Mesh + Mesh } from '../../../src/Three'; export class Sky extends Mesh { - constructor(); - static SkyShader: object; + constructor(); + + static SkyShader: object; + } diff --git a/examples/jsm/objects/Water.d.ts b/examples/jsm/objects/Water.d.ts index 912e0ddbed6ed295877ab7b29e72a138e018ffc8..05c6ce8e277ec53f50df69ccd1212988f190b5e7 100644 --- a/examples/jsm/objects/Water.d.ts +++ b/examples/jsm/objects/Water.d.ts @@ -1,29 +1,31 @@ import { - BufferGeometry, - Color, - Geometry, - Mesh, - Side, - Texture, - Vector3 + BufferGeometry, + Color, + Geometry, + Mesh, + Side, + Texture, + Vector3 } from '../../../src/Three'; export interface WaterOptions { - textureWidth?: number; - textureHeight?: number; - clipBias?: number; - alpha?: number; - time?: number; - waterNormals?: Texture; - sunDirection?: Vector3; - sunColor?: Color | string | number; - waterColor?: Color | string | number; - eye?: Vector3; - distortionScale?: number; - side?: Side; - fog?: boolean; + textureWidth?: number; + textureHeight?: number; + clipBias?: number; + alpha?: number; + time?: number; + waterNormals?: Texture; + sunDirection?: Vector3; + sunColor?: Color | string | number; + waterColor?: Color | string | number; + eye?: Vector3; + distortionScale?: number; + side?: Side; + fog?: boolean; } export class Water extends Mesh { - constructor(geometry: Geometry | BufferGeometry, options: WaterOptions); + + constructor( geometry: Geometry | BufferGeometry, options: WaterOptions ); + } diff --git a/examples/jsm/objects/Water2.d.ts b/examples/jsm/objects/Water2.d.ts index 95be46a5de45836d79f87a8d1f7e26247fb712df..6fd2f077920640d03a994d1d0bd817ce2faead3d 100644 --- a/examples/jsm/objects/Water2.d.ts +++ b/examples/jsm/objects/Water2.d.ts @@ -1,27 +1,29 @@ import { - BufferGeometry, - Color, - Geometry, - Mesh, - Texture, - Vector2 + BufferGeometry, + Color, + Geometry, + Mesh, + Texture, + Vector2 } from '../../../src/Three'; export interface WaterOptions { - color?: Color | string | number; - textureWidth?: number; - textureHeight?: number; - clipBias?: number; - flowDirection?: Vector2; - flowSpeed?: number; - reflectivity?: number; - scale?: number; - shader?: object; - flowMap?: Texture; - normalMap0?: Texture; - normalMap1?: Texture; + color?: Color | string | number; + textureWidth?: number; + textureHeight?: number; + clipBias?: number; + flowDirection?: Vector2; + flowSpeed?: number; + reflectivity?: number; + scale?: number; + shader?: object; + flowMap?: Texture; + normalMap0?: Texture; + normalMap1?: Texture; } export class Water extends Mesh { - constructor(geometry: Geometry | BufferGeometry, options: WaterOptions); + + constructor( geometry: Geometry | BufferGeometry, options: WaterOptions ); + } diff --git a/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts b/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts index 0fc97ab56abd33ddda3dfb2d244196f4fdd3c340..16df9130e23d0e9b8af4d653ae6146d3591c9610 100644 --- a/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts +++ b/examples/jsm/pmrem/PMREMCubeUVPacker.d.ts @@ -1,9 +1,11 @@ -import {CubeTexture, Renderer, WebGLRenderTarget} from '../../../src/Three'; +import { CubeTexture, Renderer, WebGLRenderTarget } from '../../../src/Three'; export class PMREMCubeUVPacker { - CubeUVRenderTarget:WebGLRenderTarget; - constructor(cubeTextureLods: CubeTexture[]); - update(renderer:Renderer): void; - dispose(): void; + CubeUVRenderTarget:WebGLRenderTarget; + + constructor( cubeTextureLods: CubeTexture[] ); + update( renderer:Renderer ): void; + dispose(): void; + } diff --git a/examples/jsm/pmrem/PMREMGenerator.d.ts b/examples/jsm/pmrem/PMREMGenerator.d.ts index 7ca98ee587e241690494381df4843d7dec1f4a54..568ada2b0a2084bd15010008ba151fbe675bbe12 100644 --- a/examples/jsm/pmrem/PMREMGenerator.d.ts +++ b/examples/jsm/pmrem/PMREMGenerator.d.ts @@ -1,16 +1,18 @@ import { - Renderer, - RenderTarget, - Texture, - CubeTexture + Renderer, + RenderTarget, + Texture, + CubeTexture } from '../../../src/Three'; export class PMREMGenerator { - cubeLods:CubeTexture[]; - constructor(sourceTexture:Texture, samplesPerLevel?:number, resolution?:number); - update(renderer:Renderer): void; - renderToCubeMapTarget(renderer:Renderer, renderTarget:any): void; - renderToCubeMapTargetFace(renderer:Renderer, renderTarget:RenderTarget, faceIndex:number): void; - dispose(): void; + cubeLods:CubeTexture[]; + + constructor( sourceTexture:Texture, samplesPerLevel?:number, resolution?:number ); + update( renderer:Renderer ): void; + renderToCubeMapTarget( renderer:Renderer, renderTarget:any ): void; + renderToCubeMapTargetFace( renderer:Renderer, renderTarget:RenderTarget, faceIndex:number ): void; + dispose(): void; + } diff --git a/examples/jsm/postprocessing/AdaptiveToneMappingPass.d.ts b/examples/jsm/postprocessing/AdaptiveToneMappingPass.d.ts index ac2b6b8f4ee70d04a2d641b4a13eb74f8522f208..e6c1f07907a1103a756f0e6f4247b00428059a98 100644 --- a/examples/jsm/postprocessing/AdaptiveToneMappingPass.d.ts +++ b/examples/jsm/postprocessing/AdaptiveToneMappingPass.d.ts @@ -1,32 +1,34 @@ import { - WebGLRenderTarget, - ShaderMaterial + WebGLRenderTarget, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class AdaptiveToneMappingPass extends Pass { - constructor(adaptive?: boolean, resolution?: number); - adaptive: boolean; - resolution: number; - needsInit: number; - luminanceRT: WebGLRenderTarget; - previousLuminanceRT: WebGLRenderTarget; - currentLuminanceRT: WebGLRenderTarget; - copyUniforms: object; - materialCopy: ShaderMaterial; - materialLuminance: ShaderMaterial; - adaptLuminanceShader: object; - materialAdaptiveLum: ShaderMaterial; - materialToneMap: ShaderMaterial; - fsQuad: object; - reset(): void; - setAdaptive(adaptive: boolean): void; - setAdaptionRate(rate: number): void; - setMinLuminance(minLum: number): void; - setMaxLuminance(maxLum: number): void; - setAverageLuminance(avgLum: number): void; - setMiddleGrey(middleGrey: number): void; - dispose(): void; + constructor( adaptive?: boolean, resolution?: number ); + adaptive: boolean; + resolution: number; + needsInit: number; + luminanceRT: WebGLRenderTarget; + previousLuminanceRT: WebGLRenderTarget; + currentLuminanceRT: WebGLRenderTarget; + copyUniforms: object; + materialCopy: ShaderMaterial; + materialLuminance: ShaderMaterial; + adaptLuminanceShader: object; + materialAdaptiveLum: ShaderMaterial; + materialToneMap: ShaderMaterial; + fsQuad: object; + + reset(): void; + setAdaptive( adaptive: boolean ): void; + setAdaptionRate( rate: number ): void; + setMinLuminance( minLum: number ): void; + setMaxLuminance( maxLum: number ): void; + setAverageLuminance( avgLum: number ): void; + setMiddleGrey( middleGrey: number ): void; + dispose(): void; + } diff --git a/examples/jsm/postprocessing/AfterimagePass.d.ts b/examples/jsm/postprocessing/AfterimagePass.d.ts index 9679ed2891806594e6dbe38b4ff49e520b5ab58f..e7ce2c295eb570aa6ae2f8677073e0f4a787a314 100644 --- a/examples/jsm/postprocessing/AfterimagePass.d.ts +++ b/examples/jsm/postprocessing/AfterimagePass.d.ts @@ -1,17 +1,19 @@ import { - WebGLRenderTarget, - ShaderMaterial + WebGLRenderTarget, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class AfterimagePass extends Pass { - constructor(damp?: number); - shader: object; - uniforms: object; - textureComp: WebGLRenderTarget; - textureOld: WebGLRenderTarget; - shaderMaterial: ShaderMaterial; - compFsQuad: object; - copyFsQuad: object; + + constructor( damp?: number ); + shader: object; + uniforms: object; + textureComp: WebGLRenderTarget; + textureOld: WebGLRenderTarget; + shaderMaterial: ShaderMaterial; + compFsQuad: object; + copyFsQuad: object; + } diff --git a/examples/jsm/postprocessing/BloomPass.d.ts b/examples/jsm/postprocessing/BloomPass.d.ts index 7a21f46ff566ada80c8c270089a0c55a57920c13..be7dc39389cd60fef4aa548b626ab7b3bf4094d7 100644 --- a/examples/jsm/postprocessing/BloomPass.d.ts +++ b/examples/jsm/postprocessing/BloomPass.d.ts @@ -1,17 +1,19 @@ import { - WebGLRenderTarget, - ShaderMaterial + WebGLRenderTarget, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class BloomPass extends Pass { - constructor(strength?: number, kernelSize?: number, sigma?: number, resolution?: number); - renderTargetX: WebGLRenderTarget; - renderTargetY: WebGLRenderTarget; - copyUniforms: object; - materialCopy: ShaderMaterial; - convolutionUniforms: object; - materialConvolution: ShaderMaterial; - fsQuad: object; + + constructor( strength?: number, kernelSize?: number, sigma?: number, resolution?: number ); + renderTargetX: WebGLRenderTarget; + renderTargetY: WebGLRenderTarget; + copyUniforms: object; + materialCopy: ShaderMaterial; + convolutionUniforms: object; + materialConvolution: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/BokehPass.d.ts b/examples/jsm/postprocessing/BokehPass.d.ts index 197aa29a851e62709593d743343539a721cf512f..31c4341ba295436179130457fee4791bc2e47dfc 100644 --- a/examples/jsm/postprocessing/BokehPass.d.ts +++ b/examples/jsm/postprocessing/BokehPass.d.ts @@ -1,32 +1,34 @@ import { - Scene, - Camera, - ShaderMaterial, - WebGLRenderTarget, - MeshDepthMaterial, - Color + Scene, + Camera, + ShaderMaterial, + WebGLRenderTarget, + MeshDepthMaterial, + Color } from '../../../src/Three'; import { Pass } from './Pass'; export interface BokehPassParamters { - focus?: number; - aspect?: number; - aperture?: number; - maxblur?: number; - width?: number; - height?: number; + focus?: number; + aspect?: number; + aperture?: number; + maxblur?: number; + width?: number; + height?: number; } export class BokehPass extends Pass { - constructor(scene: Scene, camera: Camera, params: BokehPassParamters); - scene: Scene; - camera: Camera; - renderTargetColor: WebGLRenderTarget; - renderTargetDepth: WebGLRenderTarget; - materialDepth: MeshDepthMaterial; - materialBokeh: ShaderMaterial; - uniforms: object; - fsQuad: object; - oldClearColor: Color; + + constructor( scene: Scene, camera: Camera, params: BokehPassParamters ); + scene: Scene; + camera: Camera; + renderTargetColor: WebGLRenderTarget; + renderTargetDepth: WebGLRenderTarget; + materialDepth: MeshDepthMaterial; + materialBokeh: ShaderMaterial; + uniforms: object; + fsQuad: object; + oldClearColor: Color; + } diff --git a/examples/jsm/postprocessing/ClearPass.d.ts b/examples/jsm/postprocessing/ClearPass.d.ts index 384c65ee42e434056aa0e469d1a90631593b4f2b..2306651d56693769eda811d96e6639109246c8e9 100644 --- a/examples/jsm/postprocessing/ClearPass.d.ts +++ b/examples/jsm/postprocessing/ClearPass.d.ts @@ -1,11 +1,13 @@ import { - Color + Color } from '../../../src/Three'; import { Pass } from './Pass'; export class ClearPass extends Pass { - constructor(clearColor?: Color | string | number, clearAlpha?: number); - clearColor: Color | string | number; - clearAlpha: number; + + constructor( clearColor?: Color | string | number, clearAlpha?: number ); + clearColor: Color | string | number; + clearAlpha: number; + } diff --git a/examples/jsm/postprocessing/CubeTexturePass.d.ts b/examples/jsm/postprocessing/CubeTexturePass.d.ts index e0feedbd62b3af8dad2d6239dc0c57ad1ffc8741..c8ba8fc53093358f9a619b5297dcda054e2c7615 100644 --- a/examples/jsm/postprocessing/CubeTexturePass.d.ts +++ b/examples/jsm/postprocessing/CubeTexturePass.d.ts @@ -1,19 +1,21 @@ import { - PerspectiveCamera, - CubeTexture, - Mesh, - Scene + PerspectiveCamera, + CubeTexture, + Mesh, + Scene } from '../../../src/Three'; import { Pass } from './Pass'; export class CubeTexturePass extends Pass { - constructor(camera: PerspectiveCamera, envMap?: CubeTexture, opacity?: number); - camera: PerspectiveCamera; - cubeShader: object; - cubeMesh: Mesh; - envMap: CubeTexture; - opacity: number; - cubeScene: Scene; - cubeCamera: PerspectiveCamera; + + constructor( camera: PerspectiveCamera, envMap?: CubeTexture, opacity?: number ); + camera: PerspectiveCamera; + cubeShader: object; + cubeMesh: Mesh; + envMap: CubeTexture; + opacity: number; + cubeScene: Scene; + cubeCamera: PerspectiveCamera; + } diff --git a/examples/jsm/postprocessing/DotScreenPass.d.ts b/examples/jsm/postprocessing/DotScreenPass.d.ts index b92d778f1d679a2f02dcf0db61969d58873297fc..2129cc45944a40c9d73abafa510ac6f75275306f 100644 --- a/examples/jsm/postprocessing/DotScreenPass.d.ts +++ b/examples/jsm/postprocessing/DotScreenPass.d.ts @@ -1,13 +1,15 @@ import { - Vector2, - ShaderMaterial + Vector2, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class DotScreenPass extends Pass { - constructor(center?: Vector2, angle?: number, scale?: number); - uniforms: object; - material: ShaderMaterial; - fsQuad: object; + + constructor( center?: Vector2, angle?: number, scale?: number ); + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/EffectComposer.d.ts b/examples/jsm/postprocessing/EffectComposer.d.ts index f2ea8df0d8d3b13d6c26415005e4eb41d864b0c3..dc911f2146f411bbc364f13b1fc02b587cf00e72 100644 --- a/examples/jsm/postprocessing/EffectComposer.d.ts +++ b/examples/jsm/postprocessing/EffectComposer.d.ts @@ -1,29 +1,31 @@ import { Clock, - WebGLRenderer, - WebGLRenderTarget, + WebGLRenderer, + WebGLRenderTarget, } from '../../../src/Three'; import { Pass } from './Pass'; import { ShaderPass } from './ShaderPass'; export class EffectComposer { - constructor(renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget); - renderer: WebGLRenderer; - renderTarget1: WebGLRenderTarget; - renderTarget2: WebGLRenderTarget; - writeBuffer: WebGLRenderTarget; - readBuffer: WebGLRenderTarget; - passes: Pass[]; - copyPass: ShaderPass; - clock: Clock; - swapBuffers(): void; - addPass(pass: Pass): void; - insertPass(pass: Pass, index: number): void; - isLastEnabledPass(passIndex: number): boolean; - render(deltaTime?: number): void; - reset(renderTarget?: WebGLRenderTarget): void; - setSize(width: number, height: number): void; - setPixelRatio(pixelRatio: number): void; + constructor( renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget ); + renderer: WebGLRenderer; + renderTarget1: WebGLRenderTarget; + renderTarget2: WebGLRenderTarget; + writeBuffer: WebGLRenderTarget; + readBuffer: WebGLRenderTarget; + passes: Pass[]; + copyPass: ShaderPass; + clock: Clock; + + swapBuffers(): void; + addPass( pass: Pass ): void; + insertPass( pass: Pass, index: number ): void; + isLastEnabledPass( passIndex: number ): boolean; + render( deltaTime?: number ): void; + reset( renderTarget?: WebGLRenderTarget ): void; + setSize( width: number, height: number ): void; + setPixelRatio( pixelRatio: number ): void; + } diff --git a/examples/jsm/postprocessing/FilmPass.d.ts b/examples/jsm/postprocessing/FilmPass.d.ts index ce86419822717a79060c930411e1f2d17cedba78..0b5577a888db7db783e829e98bb8ee24ffe58ae7 100644 --- a/examples/jsm/postprocessing/FilmPass.d.ts +++ b/examples/jsm/postprocessing/FilmPass.d.ts @@ -1,13 +1,15 @@ import { - Vector2, - ShaderMaterial + Vector2, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class FilmPass extends Pass { - constructor(noiseIntensity?: number, scanlinesIntensity?: number, scanlinesCount?: number, grayscale?: number); - uniforms: object; - material: ShaderMaterial; - fsQuad: object; + + constructor( noiseIntensity?: number, scanlinesIntensity?: number, scanlinesCount?: number, grayscale?: number ); + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/GlitchPass.d.ts b/examples/jsm/postprocessing/GlitchPass.d.ts index ced98b198d15d422f9bfcbdc33e115301066703e..42e8a6e3a54cda546e9cf4cbc8e913e58172b024 100644 --- a/examples/jsm/postprocessing/GlitchPass.d.ts +++ b/examples/jsm/postprocessing/GlitchPass.d.ts @@ -1,19 +1,21 @@ import { - ShaderMaterial, - DataTexture + ShaderMaterial, + DataTexture } from '../../../src/Three'; import { Pass } from './Pass'; export class GlitchPass extends Pass { - constructor(dt_size?: number); - uniforms: object; - material: ShaderMaterial; - fsQuad: object; - goWild: boolean; - curF: number; - randX: number; - generateTrigger(): void; - generateHeightmap(dt_size: number): DataTexture; + constructor( dt_size?: number ); + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + goWild: boolean; + curF: number; + randX: number; + + generateTrigger(): void; + generateHeightmap( dt_size: number ): DataTexture; + } diff --git a/examples/jsm/postprocessing/HalftonePass.d.ts b/examples/jsm/postprocessing/HalftonePass.d.ts index 2f431a7e1c067f92c2d87f0809c632c5246d9a87..4ef0a0708dd8195b1023c89249871b320ef8f32b 100644 --- a/examples/jsm/postprocessing/HalftonePass.d.ts +++ b/examples/jsm/postprocessing/HalftonePass.d.ts @@ -1,25 +1,27 @@ import { - ShaderMaterial, + ShaderMaterial, } from '../../../src/Three'; import { Pass } from './Pass'; export interface HalftonePassParameters { - shape?: number; - radius?: number; - rotateR?: number; - rotateB?: number; - rotateG?: number; - scatter?: number; - blending?: number; - blendingMode?: number; - greyscale?: boolean; - disable?: boolean; + shape?: number; + radius?: number; + rotateR?: number; + rotateB?: number; + rotateG?: number; + scatter?: number; + blending?: number; + blendingMode?: number; + greyscale?: boolean; + disable?: boolean; } export class HalftonePass extends Pass { - constructor(width: number, height: number, params: HalftonePassParameters); - uniforms: object; - material: ShaderMaterial; - fsQuad: object; + + constructor( width: number, height: number, params: HalftonePassParameters ); + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/MaskPass.d.ts b/examples/jsm/postprocessing/MaskPass.d.ts index c60163875b5ffba1c8d0c50f8b3257cac9e43756..65dce1f012eb88f140e48b93629147034fff704d 100644 --- a/examples/jsm/postprocessing/MaskPass.d.ts +++ b/examples/jsm/postprocessing/MaskPass.d.ts @@ -1,17 +1,21 @@ import { - Scene, - Camera, + Scene, + Camera, } from '../../../src/Three'; import { Pass } from './Pass'; export class MaskPass extends Pass { - constructor(scene: Scene, camera: Camera); - scene: Scene; - camera: Camera; - inverse: boolean; + + constructor( scene: Scene, camera: Camera ); + scene: Scene; + camera: Camera; + inverse: boolean; + } export class ClearMaskPass extends Pass { - constructor(); + + constructor(); + } diff --git a/examples/jsm/postprocessing/OutlinePass.d.ts b/examples/jsm/postprocessing/OutlinePass.d.ts index f4c6d150d2a6b00f01478b0a7d001781d2bd619e..aa32b16790bb3783687bffaa0c3ee4cafa194974 100644 --- a/examples/jsm/postprocessing/OutlinePass.d.ts +++ b/examples/jsm/postprocessing/OutlinePass.d.ts @@ -1,62 +1,64 @@ import { - Vector2, - Scene, - Camera, - Object3D, - Color, - Matrix4, - MeshBasicMaterial, - MeshDepthMaterial, - ShaderMaterial, - WebGLRenderTarget + Vector2, + Scene, + Camera, + Object3D, + Color, + Matrix4, + MeshBasicMaterial, + MeshDepthMaterial, + ShaderMaterial, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class OutlinePass extends Pass { - constructor(resolution: Vector2, scene: Scene, camera: Camera, selectedObjects?: Object3D[]); - renderScene: Scene; - renderCamera: Camera; - selectedObjects: Object3D[]; - visibleEdgeColor: Color; - hiddenEdgeColor: Color; - edgeGlow: number; - usePatternTexture: boolean; - edgeThickness: number; - edgeStrength: number; - downSampleRatio: number; - pulsePeriod: number; - resolution: Vector2; - maskBufferMaterial: MeshBasicMaterial; - renderTargetMaskBuffer: WebGLRenderTarget; - depthMaterial: MeshDepthMaterial; - prepareMaskMaterial: ShaderMaterial; - renderTargetDepthBuffer: WebGLRenderTarget; - renderTargetMaskDownSampleBuffer: WebGLRenderTarget; - renderTargetBlurBuffer1: WebGLRenderTarget; - renderTargetBlurBuffer2: WebGLRenderTarget; - edgeDetectionMaterial: ShaderMaterial; - renderTargetEdgeBuffer1: WebGLRenderTarget; - renderTargetEdgeBuffer2: WebGLRenderTarget; - separableBlurMaterial1: ShaderMaterial; - separableBlurMaterial2: ShaderMaterial; - overlayMaterial: ShaderMaterial; - copyUniforms: object; - materialCopy: ShaderMaterial; - oldClearColor: Color; - oldClearAlpha: number; - fsQuad: object; - tempPulseColor1: Color; - tempPulseColor2: Color; - textureMatrix: Matrix4; + constructor( resolution: Vector2, scene: Scene, camera: Camera, selectedObjects?: Object3D[] ); + renderScene: Scene; + renderCamera: Camera; + selectedObjects: Object3D[]; + visibleEdgeColor: Color; + hiddenEdgeColor: Color; + edgeGlow: number; + usePatternTexture: boolean; + edgeThickness: number; + edgeStrength: number; + downSampleRatio: number; + pulsePeriod: number; + resolution: Vector2; + + maskBufferMaterial: MeshBasicMaterial; + renderTargetMaskBuffer: WebGLRenderTarget; + depthMaterial: MeshDepthMaterial; + prepareMaskMaterial: ShaderMaterial; + renderTargetDepthBuffer: WebGLRenderTarget; + renderTargetMaskDownSampleBuffer: WebGLRenderTarget; + renderTargetBlurBuffer1: WebGLRenderTarget; + renderTargetBlurBuffer2: WebGLRenderTarget; + edgeDetectionMaterial: ShaderMaterial; + renderTargetEdgeBuffer1: WebGLRenderTarget; + renderTargetEdgeBuffer2: WebGLRenderTarget; + separableBlurMaterial1: ShaderMaterial; + separableBlurMaterial2: ShaderMaterial; + overlayMaterial: ShaderMaterial; + copyUniforms: object; + materialCopy: ShaderMaterial; + oldClearColor: Color; + oldClearAlpha: number; + fsQuad: object; + tempPulseColor1: Color; + tempPulseColor2: Color; + textureMatrix: Matrix4; + + dispose(): void; + changeVisibilityOfSelectedObjects( bVisible: boolean ): void; + changeVisibilityOfNonSelectedObjects( bVisible: boolean ): void; + updateTextureMatrix(): void; + getPrepareMaskMaterial(): ShaderMaterial; + getEdgeDetectionMaterial(): ShaderMaterial; + getSeperableBlurMaterial(): ShaderMaterial; + getOverlayMaterial(): ShaderMaterial; - dispose(): void; - changeVisibilityOfSelectedObjects(bVisible: boolean): void; - changeVisibilityOfNonSelectedObjects(bVisible: boolean): void; - updateTextureMatrix(): void; - getPrepareMaskMaterial(): ShaderMaterial; - getEdgeDetectionMaterial(): ShaderMaterial; - getSeperableBlurMaterial(): ShaderMaterial; - getOverlayMaterial(): ShaderMaterial; } diff --git a/examples/jsm/postprocessing/Pass.d.ts b/examples/jsm/postprocessing/Pass.d.ts index d0deb98c765c64655ba7b8fe54e27662545a13fb..ea765f5428c352b869092240cbb8f84d1792e31d 100644 --- a/examples/jsm/postprocessing/Pass.d.ts +++ b/examples/jsm/postprocessing/Pass.d.ts @@ -1,26 +1,30 @@ import { - Material, - WebGLRenderer, - WebGLRenderTarget + Material, + WebGLRenderer, + WebGLRenderTarget } from '../../../src/Three'; export class Pass { - constructor(); - enabled: boolean; - needsSwap: boolean; - clear: boolean; - renderToScreen: boolean; - - setSize(width: number, height: number): void; - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; + + constructor(); + enabled: boolean; + needsSwap: boolean; + clear: boolean; + renderToScreen: boolean; + + setSize( width: number, height: number ): void; + render( renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean ): void; + } export namespace Pass { class FullScreenQuad { + constructor( material?: Material ); render( renderer: WebGLRenderer ): void; material: Material; + } } diff --git a/examples/jsm/postprocessing/RenderPass.d.ts b/examples/jsm/postprocessing/RenderPass.d.ts index 1960c9c80c4924db2a513dd048401d5485c410ff..97223fdf89e00349d907008e1c4098a43eb805f9 100644 --- a/examples/jsm/postprocessing/RenderPass.d.ts +++ b/examples/jsm/postprocessing/RenderPass.d.ts @@ -1,18 +1,20 @@ import { - Scene, - Camera, - Material, - Color + Scene, + Camera, + Material, + Color } from '../../../src/Three'; import { Pass } from './Pass'; export class RenderPass extends Pass { - constructor(scene: Scene, camera: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha?: number); - scene: Scene; - camera: Camera; - overrideMaterial: Material; - clearColor: Color; - clearAlpha: number; - clearDepth: boolean; + + constructor( scene: Scene, camera: Camera, overrideMaterial?: Material, clearColor?: Color, clearAlpha?: number ); + scene: Scene; + camera: Camera; + overrideMaterial: Material; + clearColor: Color; + clearAlpha: number; + clearDepth: boolean; + } diff --git a/examples/jsm/postprocessing/SAOPass.d.ts b/examples/jsm/postprocessing/SAOPass.d.ts index 1e96decd71367ac1bc6ae5670809f0743031c675..ec30ab714339927a30466f4c28ff5476fa6b0cbc 100644 --- a/examples/jsm/postprocessing/SAOPass.d.ts +++ b/examples/jsm/postprocessing/SAOPass.d.ts @@ -1,68 +1,70 @@ import { - Scene, - Camera, - Material, - MeshDepthMaterial, - MeshNormalMaterial, - ShaderMaterial, - Color, - Vector2, - WebGLRenderer, - WebGLRenderTarget + Scene, + Camera, + Material, + MeshDepthMaterial, + MeshNormalMaterial, + ShaderMaterial, + Color, + Vector2, + WebGLRenderer, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; interface SAOPassParams { - output: SAOPass.OUTPUT; - saoBias: number; - saoIntensity: number; - saoScale: number; - saoKernelRadius: number; - saoMinResolution: number; - saoBlur: number; - saoBlurRadius: number; - saoBlurStdDev: number; - saoBlurDepthCutoff: number; + output: SAOPass.OUTPUT; + saoBias: number; + saoIntensity: number; + saoScale: number; + saoKernelRadius: number; + saoMinResolution: number; + saoBlur: number; + saoBlurRadius: number; + saoBlurStdDev: number; + saoBlurDepthCutoff: number; } export namespace SAOPass { - enum OUTPUT { - Default, - Beauty, - SAO, - Depth, - Normal - } + enum OUTPUT { + Default, + Beauty, + SAO, + Depth, + Normal + } } export class SAOPass extends Pass { - constructor(scene: Scene, camera: Camera, depthTexture?: boolean, useNormals?: boolean, resolution?: Vector2); - scene: Scene; - camera: Camera; - supportsDepthTextureExtension: boolean; - supportsNormalTexture: boolean; - originalClearColor: Color; - oldClearColor: Color; - oldClearAlpha: number; - resolution: Vector2; - saoRenderTarget: WebGLRenderTarget; - blurIntermediateRenderTarget: WebGLRenderTarget; - beautyRenderTarget: WebGLRenderTarget; - normalRenderTarget: WebGLRenderTarget; - depthRenderTarget: WebGLRenderTarget; - depthMaterial: MeshDepthMaterial; - normalMaterial: MeshNormalMaterial; - saoMaterial: ShaderMaterial; - vBlurMaterial: ShaderMaterial; - hBlurMaterial: ShaderMaterial; - materialCopy: ShaderMaterial; - depthCopy: ShaderMaterial; - fsQuad: object; - params: SAOPassParams; - renderPass(renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number): void; - renderPass(renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number): void; - renderOverride(renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number): void; - renderOverride(renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number): void; + constructor( scene: Scene, camera: Camera, depthTexture?: boolean, useNormals?: boolean, resolution?: Vector2 ); + scene: Scene; + camera: Camera; + supportsDepthTextureExtension: boolean; + supportsNormalTexture: boolean; + originalClearColor: Color; + oldClearColor: Color; + oldClearAlpha: number; + resolution: Vector2; + saoRenderTarget: WebGLRenderTarget; + blurIntermediateRenderTarget: WebGLRenderTarget; + beautyRenderTarget: WebGLRenderTarget; + normalRenderTarget: WebGLRenderTarget; + depthRenderTarget: WebGLRenderTarget; + depthMaterial: MeshDepthMaterial; + normalMaterial: MeshNormalMaterial; + saoMaterial: ShaderMaterial; + vBlurMaterial: ShaderMaterial; + hBlurMaterial: ShaderMaterial; + materialCopy: ShaderMaterial; + depthCopy: ShaderMaterial; + fsQuad: object; + params: SAOPassParams; + + renderPass( renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number ): void; + renderPass( renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number ): void; + renderOverride( renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number ): void; + renderOverride( renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number ): void; + } diff --git a/examples/jsm/postprocessing/SMAAPass.d.ts b/examples/jsm/postprocessing/SMAAPass.d.ts index 2b4eda3e772e5a7cfc43d996136fa93f67871424..d881e14da6d1c6a51eb58ad28166d84b6adfc97b 100644 --- a/examples/jsm/postprocessing/SMAAPass.d.ts +++ b/examples/jsm/postprocessing/SMAAPass.d.ts @@ -1,25 +1,27 @@ import { - ShaderMaterial, - Texture, - WebGLRenderTarget + ShaderMaterial, + Texture, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class SMAAPass extends Pass { - constructor(width: number, height: number); - edgesRT: WebGLRenderTarget; - weightsRT: WebGLRenderTarget; - areaTexture: Texture; - searchTexture: Texture; - uniformsEdges: object; - materialEdges: ShaderMaterial; - uniformsWeights: object; - materialWeights: ShaderMaterial; - uniformsBlend: object; - materialBlend: ShaderMaterial; - fsQuad: object; - getAreaTexture(): string; - getSearchTexture(): string; + constructor( width: number, height: number ); + edgesRT: WebGLRenderTarget; + weightsRT: WebGLRenderTarget; + areaTexture: Texture; + searchTexture: Texture; + uniformsEdges: object; + materialEdges: ShaderMaterial; + uniformsWeights: object; + materialWeights: ShaderMaterial; + uniformsBlend: object; + materialBlend: ShaderMaterial; + fsQuad: object; + + getAreaTexture(): string; + getSearchTexture(): string; + } diff --git a/examples/jsm/postprocessing/SSAARenderPass.d.ts b/examples/jsm/postprocessing/SSAARenderPass.d.ts index 7eca2a9ed70a02a1c35ed5dea63921ae55701508..22ad52612f74700610156f4e9e1d96b6496e4d95 100644 --- a/examples/jsm/postprocessing/SSAARenderPass.d.ts +++ b/examples/jsm/postprocessing/SSAARenderPass.d.ts @@ -1,21 +1,23 @@ import { - Scene, - Camera, - Color, - ShaderMaterial + Scene, + Camera, + Color, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class SSAARenderPass extends Pass { - constructor(scene: Scene, camera: Camera, clearColor: Color | string | number, clearAlpha: number); - scene: Scene; - camera: Camera; - sampleLevel: number; - unbiased: boolean; - clearColor: Color | string | number; - clearAlpha: number; - copyUniforms: object; - copyMaterial: ShaderMaterial; - fsQuad: object; + + constructor( scene: Scene, camera: Camera, clearColor: Color | string | number, clearAlpha: number ); + scene: Scene; + camera: Camera; + sampleLevel: number; + unbiased: boolean; + clearColor: Color | string | number; + clearAlpha: number; + copyUniforms: object; + copyMaterial: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/SSAOPass.d.ts b/examples/jsm/postprocessing/SSAOPass.d.ts index 81c384eaf087e37db5224b9e093edff596cd5866..71192135a9667307bab5dcb19bffa6a16b77cd6c 100644 --- a/examples/jsm/postprocessing/SSAOPass.d.ts +++ b/examples/jsm/postprocessing/SSAOPass.d.ts @@ -1,58 +1,60 @@ import { - Camera, - Color, - DataTexture, - Material, - MeshNormalMaterial, - Scene, - ShaderMaterial, - Vector3, - WebGLRenderer, - WebGLRenderTarget + Camera, + Color, + DataTexture, + Material, + MeshNormalMaterial, + Scene, + ShaderMaterial, + Vector3, + WebGLRenderer, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class SSAOPass extends Pass { - constructor(scene: Scene, camera: Camera, width?: number, height?: number); - scene: Scene; - camera: Camera; - width: number; - height: boolean; - clear: boolean; - kernelRadius: boolean; - kernelSize: boolean; - kernel: Vector3[]; - noiseTexture: DataTexture; - output: number; - minDistance: number; - maxDistance: number; - beautyRenderTarget: WebGLRenderTarget; - normalRenderTarget: WebGLRenderTarget; - ssaoRenderTarget: WebGLRenderTarget; - blurRenderTarget: WebGLRenderTarget; - ssaoMaterial: ShaderMaterial; - normalMaterial: MeshNormalMaterial; - blurMaterial: ShaderMaterial; - depthRenderMaterial: ShaderMaterial; - copyMaterial: ShaderMaterial; - fsQuad: object; - originalClearColor: Color; - static OUTPUT: { - Default: number; - SSAO: number; - Blur: number; - Beauty: number; - Depth: number; - Normal: number; - }; + constructor( scene: Scene, camera: Camera, width?: number, height?: number ); + scene: Scene; + camera: Camera; + width: number; + height: boolean; + clear: boolean; + kernelRadius: boolean; + kernelSize: boolean; + kernel: Vector3[]; + noiseTexture: DataTexture; + output: number; + minDistance: number; + maxDistance: number; + beautyRenderTarget: WebGLRenderTarget; + normalRenderTarget: WebGLRenderTarget; + ssaoRenderTarget: WebGLRenderTarget; + blurRenderTarget: WebGLRenderTarget; + ssaoMaterial: ShaderMaterial; + normalMaterial: MeshNormalMaterial; + blurMaterial: ShaderMaterial; + depthRenderMaterial: ShaderMaterial; + copyMaterial: ShaderMaterial; + fsQuad: object; + originalClearColor: Color; + + static OUTPUT: { + Default: number; + SSAO: number; + Blur: number; + Beauty: number; + Depth: number; + Normal: number; + }; + + dipose(): void; + generateSampleKernel(): Vector3[]; + generateRandomKernelRotations(): void; + renderPass( renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number ): void; + renderPass( renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number ): void; + renderOverride( renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number ): void; + renderOverride( renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number ): void; - dipose(): void; - generateSampleKernel(): Vector3[]; - generateRandomKernelRotations(): void; - renderPass(renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number): void; - renderPass(renderer: WebGLRenderer, passMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number): void; - renderOverride(renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: Color, clearAlpha?: number): void; - renderOverride(renderer: WebGLRenderer, overrideMaterial: Material, renderTarget: WebGLRenderTarget, clearColor?: number, clearAlpha?: number): void; } diff --git a/examples/jsm/postprocessing/SavePass.d.ts b/examples/jsm/postprocessing/SavePass.d.ts index 207f55cb9452334fca4edd47b791abd1f668af8f..c1501196d7fadc9788ca0dd516ac68f9b2fd9c62 100644 --- a/examples/jsm/postprocessing/SavePass.d.ts +++ b/examples/jsm/postprocessing/SavePass.d.ts @@ -1,15 +1,17 @@ import { - ShaderMaterial, - WebGLRenderTarget + ShaderMaterial, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class SavePass extends Pass { - constructor(renderTarget: WebGLRenderTarget); - textureID: string; - renderTarget: WebGLRenderTarget; - uniforms: object; - material: ShaderMaterial; - fsQuad: object; + + constructor( renderTarget: WebGLRenderTarget ); + textureID: string; + renderTarget: WebGLRenderTarget; + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/ShaderPass.d.ts b/examples/jsm/postprocessing/ShaderPass.d.ts index eac783ae2486391e97eee86c0d3febb0f7d3794e..12687ab8076c7fac58d0086a1a319d38bdf8b253 100644 --- a/examples/jsm/postprocessing/ShaderPass.d.ts +++ b/examples/jsm/postprocessing/ShaderPass.d.ts @@ -1,13 +1,15 @@ import { - Material + Material } from '../../../src/Three'; import { Pass } from './Pass'; export class ShaderPass extends Pass { - constructor(shader: object, textureID?: string); - textureID: string; - uniforms: object; - material: Material; - fsQuad: object; + + constructor( shader: object, textureID?: string ); + textureID: string; + uniforms: object; + material: Material; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/TAARenderPass.d.ts b/examples/jsm/postprocessing/TAARenderPass.d.ts index 28fda0e5d658cd4e908fcde277445598ee6a2a3e..afc544909aab3bc99b9303a6ddaf8e4c7819e327 100644 --- a/examples/jsm/postprocessing/TAARenderPass.d.ts +++ b/examples/jsm/postprocessing/TAARenderPass.d.ts @@ -1,12 +1,14 @@ import { - Scene, - Camera, - Color + Scene, + Camera, + Color } from '../../../src/Three'; import { SSAARenderPass } from './SSAARenderPass'; export class TAARenderPass extends SSAARenderPass { - constructor(scene: Scene, camera: Camera, clearColor: Color | string | number, clearAlpha: number); - accumulate: boolean; + + constructor( scene: Scene, camera: Camera, clearColor: Color | string | number, clearAlpha: number ); + accumulate: boolean; + } diff --git a/examples/jsm/postprocessing/TexturePass.d.ts b/examples/jsm/postprocessing/TexturePass.d.ts index dbaf2010a7a11e844fd6a956443dcbe66de9c0ea..9acfe63f6044af6e7c6da02b940aa64935825307 100644 --- a/examples/jsm/postprocessing/TexturePass.d.ts +++ b/examples/jsm/postprocessing/TexturePass.d.ts @@ -1,15 +1,17 @@ import { - Texture, - ShaderMaterial + Texture, + ShaderMaterial } from '../../../src/Three'; import { Pass } from './Pass'; export class TexturePass extends Pass { - constructor(map: Texture, opacity?: number); - map: Texture; - opacity: number; - uniforms: object; - material: ShaderMaterial; - fsQuad: object; + + constructor( map: Texture, opacity?: number ); + map: Texture; + opacity: number; + uniforms: object; + material: ShaderMaterial; + fsQuad: object; + } diff --git a/examples/jsm/postprocessing/UnrealBloomPass.d.ts b/examples/jsm/postprocessing/UnrealBloomPass.d.ts index c505314902ec9e921347aa04e4a39628c4af0906..c817e3a2993f928171ec2c7da21638d603e424b7 100644 --- a/examples/jsm/postprocessing/UnrealBloomPass.d.ts +++ b/examples/jsm/postprocessing/UnrealBloomPass.d.ts @@ -1,38 +1,40 @@ import { - Color, - MeshBasicMaterial, - ShaderMaterial, - Vector2, - Vector3, - WebGLRenderTarget + Color, + MeshBasicMaterial, + ShaderMaterial, + Vector2, + Vector3, + WebGLRenderTarget } from '../../../src/Three'; import { Pass } from './Pass'; export class UnrealBloomPass extends Pass { - constructor(resolution: Vector2, strength: number, radius: number, threshold: number); - resolution: Vector2; - strength: number; - radius: number; - threshold: number; - clearColor: Color; - renderTargetsHorizontal: WebGLRenderTarget[]; - renderTargetsVertical: WebGLRenderTarget[]; - nMips: number; - renderTargetBright: WebGLRenderTarget; - highPassUniforms: object; - materialHighPassFilter: ShaderMaterial; - separableBlurMaterials: ShaderMaterial[]; - compositeMaterial: ShaderMaterial; - bloomTintColors: Vector3[]; - copyUniforms: object; - materialCopy: ShaderMaterial; - oldClearColor: Color; - oldClearAlpha: number; - basic: MeshBasicMaterial; - fsQuad: object; - dispose(): void; - getSeperableBlurMaterial(): ShaderMaterial; - getCompositeMaterial(): ShaderMaterial; + constructor( resolution: Vector2, strength: number, radius: number, threshold: number ); + resolution: Vector2; + strength: number; + radius: number; + threshold: number; + clearColor: Color; + renderTargetsHorizontal: WebGLRenderTarget[]; + renderTargetsVertical: WebGLRenderTarget[]; + nMips: number; + renderTargetBright: WebGLRenderTarget; + highPassUniforms: object; + materialHighPassFilter: ShaderMaterial; + separableBlurMaterials: ShaderMaterial[]; + compositeMaterial: ShaderMaterial; + bloomTintColors: Vector3[]; + copyUniforms: object; + materialCopy: ShaderMaterial; + oldClearColor: Color; + oldClearAlpha: number; + basic: MeshBasicMaterial; + fsQuad: object; + + dispose(): void; + getSeperableBlurMaterial(): ShaderMaterial; + getCompositeMaterial(): ShaderMaterial; + } diff --git a/examples/jsm/renderers/CSS2DRenderer.d.ts b/examples/jsm/renderers/CSS2DRenderer.d.ts index 36bba53e17f5ad2c427a1dc8ad30a8d1072fd2c8..3b089628ab478aee174137f627d053e4edf2040a 100644 --- a/examples/jsm/renderers/CSS2DRenderer.d.ts +++ b/examples/jsm/renderers/CSS2DRenderer.d.ts @@ -1,19 +1,23 @@ import { - Object3D, - Scene, - Camera + Object3D, + Scene, + Camera } from '../../../src/Three'; export class CSS2DObject extends Object3D { - constructor(element: HTMLElement); - element: HTMLElement; + + constructor( element: HTMLElement ); + element: HTMLElement; + } export class CSS2DRenderer { - constructor(); - domElement: HTMLElement; - getSize(): {width: number, height: number}; - setSize(width: number, height: number): void; - render(scene: Scene, camera: Camera): void; + constructor(); + domElement: HTMLElement; + + getSize(): {width: number, height: number}; + setSize( width: number, height: number ): void; + render( scene: Scene, camera: Camera ): void; + } diff --git a/examples/jsm/renderers/CSS3DRenderer.d.ts b/examples/jsm/renderers/CSS3DRenderer.d.ts index 001059291e31855b44b99ed4b6287c083c14b255..03440f57512c2ad8a74f1870c688942f3445d286 100644 --- a/examples/jsm/renderers/CSS3DRenderer.d.ts +++ b/examples/jsm/renderers/CSS3DRenderer.d.ts @@ -1,23 +1,29 @@ import { - Object3D, - Scene, - Camera + Object3D, + Scene, + Camera } from '../../../src/Three'; export class CSS3DObject extends Object3D { - constructor(element: HTMLElement); - element: HTMLElement; + + constructor( element: HTMLElement ); + element: HTMLElement; + } export class CSS3DSprite extends CSS3DObject { - constructor(element: HTMLElement); + + constructor( element: HTMLElement ); + } export class CSS3DRenderer { - constructor(); - domElement: HTMLElement; - getSize(): {width: number, height: number}; - setSize(width: number, height: number): void; - render(scene: Scene, camera: Camera): void; + constructor(); + domElement: HTMLElement; + + getSize(): {width: number, height: number}; + setSize( width: number, height: number ): void; + render( scene: Scene, camera: Camera ): void; + } diff --git a/examples/jsm/renderers/Projector.d.ts b/examples/jsm/renderers/Projector.d.ts index 1a82ec156a635aaa9000062de39639fa709f361f..e73b0a2fe3f5e5bc04fa47e1f9aa99dc98c93325 100644 --- a/examples/jsm/renderers/Projector.d.ts +++ b/examples/jsm/renderers/Projector.d.ts @@ -1,69 +1,81 @@ import { - Object3D, - Scene, - Camera, - Vector2, - Vector3, - Vector4, - Color, - Material + Object3D, + Scene, + Camera, + Vector2, + Vector3, + Vector4, + Color, + Material } from '../../../src/Three'; export class RenderableObject { - id: number; - object: Object3D; - z: number; - renderOrder: number; + + id: number; + object: Object3D; + z: number; + renderOrder: number; + } export class RenderableFace { - id: number; - v1: RenderableVertex; - v2: RenderableVertex; - v3: RenderableVertex; - normalModel: Vector3; - vertexNormalsModel: Vector3[]; - vertexNormalsLength: number; - color: Color; - material: Material; - uvs: Vector2[]; - z: number; - renderOrder: number; + + id: number; + v1: RenderableVertex; + v2: RenderableVertex; + v3: RenderableVertex; + normalModel: Vector3; + vertexNormalsModel: Vector3[]; + vertexNormalsLength: number; + color: Color; + material: Material; + uvs: Vector2[]; + z: number; + renderOrder: number; + } export class RenderableVertex { - position: Vector3; - positionWorld: Vector3; - positionScreen: Vector4; - visible: boolean; - copy(vertex: RenderableVertex): void; + position: Vector3; + positionWorld: Vector3; + positionScreen: Vector4; + visible: boolean; + + copy( vertex: RenderableVertex ): void; + } export class RenderableLine { - id: number; - v1: RenderableVertex; - v2: RenderableVertex; - vertexColors: Color[]; - material: Material; - z: number; - renderOrder: number; + + id: number; + v1: RenderableVertex; + v2: RenderableVertex; + vertexColors: Color[]; + material: Material; + z: number; + renderOrder: number; + } export class RenderableSprite { - id: number; - object: Object3D; - x: number; - y: number; - z: number; - rotation: number; - scale: Vector2; - material: Material; - renderOrder: number; + + id: number; + object: Object3D; + x: number; + y: number; + z: number; + rotation: number; + scale: Vector2; + material: Material; + renderOrder: number; + } export class Projector { - constructor(); - projectScene(scene: Scene, camera: Camera, sortObjects: boolean, sortElements: boolean); + constructor(); + + projectScene( scene: Scene, camera: Camera, sortObjects: boolean, sortElements: boolean ); + } diff --git a/examples/jsm/renderers/RaytracingRenderer.d.ts b/examples/jsm/renderers/RaytracingRenderer.d.ts index e86226dafcca03b8ca45fe2ba2fe6a6a1fd50093..cd3f23d8653f066d8352cfef52427c5c036fb78d 100644 --- a/examples/jsm/renderers/RaytracingRenderer.d.ts +++ b/examples/jsm/renderers/RaytracingRenderer.d.ts @@ -1,28 +1,30 @@ import { - EventDispatcher, - Color, - Scene, - Camera + EventDispatcher, + Color, + Scene, + Camera } from '../../../src/Three'; export interface RaytracingRendererParameters { - alpha?: boolean; - blockSize?: number; - randomize: boolean; - workerPath: string; - workers: number; + alpha?: boolean; + blockSize?: number; + randomize: boolean; + workerPath: string; + workers: number; } export class RaytracingRenderer extends EventDispatcher { - constructor(parameters: RaytracingRendererParameters); - domElement: HTMLElement; - autoClear: boolean; - randomize: boolean; - setWorkers(w: number): void; - setClearColor(color: Color, alpha: number): void; - setPixelRatio(): void; - setSize(width: number, height: number): void; - clear(): void; - render(scene: Scene, camera: Camera): void; + constructor( parameters: RaytracingRendererParameters ); + domElement: HTMLElement; + autoClear: boolean; + randomize: boolean; + + setWorkers( w: number ): void; + setClearColor( color: Color, alpha: number ): void; + setPixelRatio(): void; + setSize( width: number, height: number ): void; + clear(): void; + render( scene: Scene, camera: Camera ): void; + } diff --git a/examples/jsm/renderers/SVGRenderer.d.ts b/examples/jsm/renderers/SVGRenderer.d.ts index 187b296b91787a37f9fbb8bf4028cfbeade8d063..8d1c47e10b995a853085f5761dc7163823ec4ac8 100644 --- a/examples/jsm/renderers/SVGRenderer.d.ts +++ b/examples/jsm/renderers/SVGRenderer.d.ts @@ -1,29 +1,33 @@ import { - Object3D, - Color, - Scene, - Camera + Object3D, + Color, + Scene, + Camera } from '../../../src/Three'; export class SVGObject extends Object3D { - constructor(node: SVGElement); - node: SVGElement; + + constructor( node: SVGElement ); + node: SVGElement; + } export class SVGRenderer { - constructor(); - domElement: SVGElement; - autoClear: boolean; - sortObjects: boolean; - sortElements: boolean; - overdraw: number; - info: {render: {vertices: number, faces: number}}; - setQuality(quality: string): void; - setClearColor(color: Color, alpha: number): void; - setPixelRatio(): void; - setSize(width: number, height: number): void; - setPrecision(precision: number): void; - clear(): void; - render(scene: Scene, camera: Camera): void; + constructor(); + domElement: SVGElement; + autoClear: boolean; + sortObjects: boolean; + sortElements: boolean; + overdraw: number; + info: {render: {vertices: number, faces: number}}; + + setQuality( quality: string ): void; + setClearColor( color: Color, alpha: number ): void; + setPixelRatio(): void; + setSize( width: number, height: number ): void; + setPrecision( precision: number ): void; + clear(): void; + render( scene: Scene, camera: Camera ): void; + } diff --git a/examples/jsm/renderers/SoftwareRenderer.d.ts b/examples/jsm/renderers/SoftwareRenderer.d.ts index 36f9dbb18cf6b46d5f29db8d0c44d1677c415e19..d049a74dc17b5b716f93318dcd02fee46986fb58 100644 --- a/examples/jsm/renderers/SoftwareRenderer.d.ts +++ b/examples/jsm/renderers/SoftwareRenderer.d.ts @@ -1,17 +1,19 @@ import { - Color, - Scene, - Camera + Color, + Scene, + Camera } from '../../../src/Three'; export class SoftwareRenderer { - constructor(); - domElement: HTMLElement; - autoClear: boolean; - setClearColor(color: Color, alpha: number): void; - setPixelRatio(): void; - setSize(width: number, height: number): void; - clear(): void; - render(scene: Scene, camera: Camera): void; + constructor(); + domElement: HTMLElement; + autoClear: boolean; + + setClearColor( color: Color, alpha: number ): void; + setPixelRatio(): void; + setSize( width: number, height: number ): void; + clear(): void; + render( scene: Scene, camera: Camera ): void; + } diff --git a/examples/jsm/renderers/WebGLDeferredRenderer.d.ts b/examples/jsm/renderers/WebGLDeferredRenderer.d.ts index 76b5463e7266ef0de49dab12c1fe64154cf03cea..2b547c10239d19f9b5c5046735f07e5d3fadcff6 100644 --- a/examples/jsm/renderers/WebGLDeferredRenderer.d.ts +++ b/examples/jsm/renderers/WebGLDeferredRenderer.d.ts @@ -1,26 +1,28 @@ import { - Camera, - Scene, - Vector2, - WebGLRenderer + Camera, + Scene, + Vector2, + WebGLRenderer } from '../../../src/Three'; export interface WebGLDeferredRendererParameters { - antialias?: boolean; - cacheKeepAlive?: boolean; - height?: number; - renderer?: WebGLRenderer; - width?: number; + antialias?: boolean; + cacheKeepAlive?: boolean; + height?: number; + renderer?: WebGLRenderer; + width?: number; } export class WebGLDeferredRenderer { - constructor(parameters: WebGLDeferredRendererParameters); - domElement: HTMLElement; - forwardRendering: boolean; - renderer: WebGLRenderer; - enableLightPrePass(enabled: boolean): void; - render(scene: Scene, camera: Camera): void; - setAntialias(enabled: boolean): void; - setSize(width: number, height: number): void; + constructor( parameters: WebGLDeferredRendererParameters ); + domElement: HTMLElement; + forwardRendering: boolean; + renderer: WebGLRenderer; + + enableLightPrePass( enabled: boolean ): void; + render( scene: Scene, camera: Camera ): void; + setAntialias( enabled: boolean ): void; + setSize( width: number, height: number ): void; + } diff --git a/examples/jsm/shaders/AfterimageShader.d.ts b/examples/jsm/shaders/AfterimageShader.d.ts index 07c569d9f827c5f7875ddb1df2e9817db870b9d1..475c9f365d7627ef27289b75547e27f15c4e4e80 100644 --- a/examples/jsm/shaders/AfterimageShader.d.ts +++ b/examples/jsm/shaders/AfterimageShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const AfterimageShader: { - uniforms: { - damp: Uniform; - tOld: Uniform; - tNew: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + damp: Uniform; + tOld: Uniform; + tNew: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BasicShader.d.ts b/examples/jsm/shaders/BasicShader.d.ts index 38577ff0db6f0b0e70798a1a5dc0f6d88970a867..e241d7d83f36f9dec1872718e143cf5ec374b04e 100644 --- a/examples/jsm/shaders/BasicShader.d.ts +++ b/examples/jsm/shaders/BasicShader.d.ts @@ -1,9 +1,9 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BasicShader: { - uniforms: {}; - vertexShader: string; - fragmentShader: string; + uniforms: {}; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BleachBypassShader.d.ts b/examples/jsm/shaders/BleachBypassShader.d.ts index 868dc222e53c9c648a4bcb5c04b53bf2c4bbb0b5..81783346cfbf7e8e6c0e721748fa6ec3bce457fb 100644 --- a/examples/jsm/shaders/BleachBypassShader.d.ts +++ b/examples/jsm/shaders/BleachBypassShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BleachBypassShader: { - uniforms: { - tDiffuse: Uniform; - opacity: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + opacity: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BlendShader.d.ts b/examples/jsm/shaders/BlendShader.d.ts index e5d9a197983430fd34f245ccb294b17ec441b16c..bdbbe20151bce9e1414545730cedc88bb6a2fe2a 100644 --- a/examples/jsm/shaders/BlendShader.d.ts +++ b/examples/jsm/shaders/BlendShader.d.ts @@ -1,14 +1,14 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BlendShader: { - uniforms: { - tDiffuse1: Uniform; - tDiffuse2: Uniform; - mixRatio: Uniform; - opacity: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse1: Uniform; + tDiffuse2: Uniform; + mixRatio: Uniform; + opacity: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BokehShader.d.ts b/examples/jsm/shaders/BokehShader.d.ts index e2a87b56465a8e9d8982ea93f2cec8760f04b167..c68ca08db0952b7a0333d9e077d8a0603de72c2f 100644 --- a/examples/jsm/shaders/BokehShader.d.ts +++ b/examples/jsm/shaders/BokehShader.d.ts @@ -1,22 +1,22 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BokehShader: { - defines: { - DEPTH_PACKING: number; - PERSPECTIVE_CAMERA: number; - } - uniforms: { - tColor: Uniform; - tDepth: Uniform; - focus: Uniform; - aspect: Uniform; - aperture: Uniform; - maxblur: Uniform; - nearClip: Uniform; - farClip: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + DEPTH_PACKING: number; + PERSPECTIVE_CAMERA: number; + } + uniforms: { + tColor: Uniform; + tDepth: Uniform; + focus: Uniform; + aspect: Uniform; + aperture: Uniform; + maxblur: Uniform; + nearClip: Uniform; + farClip: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BokehShader2.d.ts b/examples/jsm/shaders/BokehShader2.d.ts index ce79da664bca6bf7aca44e374088e415b2cc2a34..958180ce194213f78746be57d12f9c725a25816b 100644 --- a/examples/jsm/shaders/BokehShader2.d.ts +++ b/examples/jsm/shaders/BokehShader2.d.ts @@ -1,42 +1,42 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BokehShader: { - uniforms: { - textureWidth: Uniform; - textureHeight: Uniform; - focalDepth: Uniform; - focalLength: Uniform; - fstop: Uniform; - tColor: Uniform; - tDepth: Uniform; - maxblur: Uniform; - showFocus: Uniform; - manualdof: Uniform; - vignetting: Uniform; - depthblur: Uniform; - threshold: Uniform; - gain: Uniform; - bias: Uniform; - fringe: Uniform; - znear: Uniform; - zfar: Uniform; - noise: Uniform; - dithering: Uniform; - pentagon: Uniform; - shaderFocus: Uniform; - focusCoords: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + textureWidth: Uniform; + textureHeight: Uniform; + focalDepth: Uniform; + focalLength: Uniform; + fstop: Uniform; + tColor: Uniform; + tDepth: Uniform; + maxblur: Uniform; + showFocus: Uniform; + manualdof: Uniform; + vignetting: Uniform; + depthblur: Uniform; + threshold: Uniform; + gain: Uniform; + bias: Uniform; + fringe: Uniform; + znear: Uniform; + zfar: Uniform; + noise: Uniform; + dithering: Uniform; + pentagon: Uniform; + shaderFocus: Uniform; + focusCoords: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const BokehDepthShader: { - uniforms: { - mNear: Uniform; - mFar: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + mNear: Uniform; + mFar: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/BrightnessContrastShader.d.ts b/examples/jsm/shaders/BrightnessContrastShader.d.ts index 9b3c25ea25d8d524b7e80c44c1d1f7e3d2244916..630bdf21bfcb549d92099a8e3f90412951055e26 100644 --- a/examples/jsm/shaders/BrightnessContrastShader.d.ts +++ b/examples/jsm/shaders/BrightnessContrastShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const BrightnessContrastShader: { - uniforms: { - tDiffuse: Uniform; - brightness: Uniform; - contrast: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + brightness: Uniform; + contrast: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/ColorCorrectionShader.d.ts b/examples/jsm/shaders/ColorCorrectionShader.d.ts index 2488e34312114ce212ca270c5236d8320de02422..86aeb07dc6c999164a6c546712aa91113c8cb407 100644 --- a/examples/jsm/shaders/ColorCorrectionShader.d.ts +++ b/examples/jsm/shaders/ColorCorrectionShader.d.ts @@ -1,14 +1,14 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ColorCorrectionShader: { - uniforms: { - tDiffuse: Uniform; - powRGB: Uniform; - mulRGB: Uniform; - addRGB: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + powRGB: Uniform; + mulRGB: Uniform; + addRGB: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/ColorifyShader.d.ts b/examples/jsm/shaders/ColorifyShader.d.ts index ecc2cd446952020d95b649a4d5f60458753c59e0..c2cdec237e7d98f1e838210723b0ffe17b5f1b29 100644 --- a/examples/jsm/shaders/ColorifyShader.d.ts +++ b/examples/jsm/shaders/ColorifyShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ColorifyShader: { - uniforms: { - tDiffuse: Uniform; - color: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + color: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/ConvolutionShader.d.ts b/examples/jsm/shaders/ConvolutionShader.d.ts index 53ba95bca5fdc912d84bfa5e15412c2c0509d9a1..69e9bb5cce018f3b603a9d2a7c7c9b560b7e8a58 100644 --- a/examples/jsm/shaders/ConvolutionShader.d.ts +++ b/examples/jsm/shaders/ConvolutionShader.d.ts @@ -1,19 +1,19 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ConvolutionShader: { - defines: { - KERNEL_SIZE_FLOAT: string; - KERNEL_SIZE_INT: string; - }, - uniforms: { - tDiffuse: Uniform; - uImageIncrement: Uniform; - cKernel: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + KERNEL_SIZE_FLOAT: string; + KERNEL_SIZE_INT: string; + }, + uniforms: { + tDiffuse: Uniform; + uImageIncrement: Uniform; + cKernel: Uniform; + }; + vertexShader: string; + fragmentShader: string; - buildKernel(sigma: number): number[]; + buildKernel( sigma: number ): number[]; }; diff --git a/examples/jsm/shaders/CopyShader.d.ts b/examples/jsm/shaders/CopyShader.d.ts index 33436574e97b9fa6b10fbe8a26f4616453d00b4b..6d6a6e6e3abea4e8235c68b78b254fdf40ac8766 100644 --- a/examples/jsm/shaders/CopyShader.d.ts +++ b/examples/jsm/shaders/CopyShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const CopyShader: { - uniforms: { - tDiffuse: Uniform; - opacity: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + opacity: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/CopyShader.js b/examples/jsm/shaders/CopyShader.js index 20eb93b0cf9b6db625314b5d5be8317729947907..f88b8da6f428e18548f13e4a236b97a996131c5f 100644 --- a/examples/jsm/shaders/CopyShader.js +++ b/examples/jsm/shaders/CopyShader.js @@ -11,7 +11,7 @@ var CopyShader = { uniforms: { "tDiffuse": { value: null }, - "opacity": { value: 1.0 } + "opacity": { value: 1.0 } }, diff --git a/examples/jsm/shaders/DOFMipMapShader.d.ts b/examples/jsm/shaders/DOFMipMapShader.d.ts index 9ac3b33fe0c216d79e071b6fd72fd05066055099..f8e2cd4ccff463c0139130a96f71407b375aa3d0 100644 --- a/examples/jsm/shaders/DOFMipMapShader.d.ts +++ b/examples/jsm/shaders/DOFMipMapShader.d.ts @@ -1,14 +1,14 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const DOFMipMapShader: { - uniforms: { - tColor: Uniform; - tDepth: Uniform; - focus: Uniform; - maxblur: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tColor: Uniform; + tDepth: Uniform; + focus: Uniform; + maxblur: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/DepthLimitedBlurShader.d.ts b/examples/jsm/shaders/DepthLimitedBlurShader.d.ts index 11997751cd5073f23534c5306043ed62cea376f6..64e941b28ea3d53bc46b7b954b8eaed2ceff4190 100644 --- a/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +++ b/examples/jsm/shaders/DepthLimitedBlurShader.d.ts @@ -1,31 +1,31 @@ import { - Uniform, - Vector2, + Uniform, + Vector2, Material } from '../../../src/Three'; export const DepthLimitedBlurShader: { - defines: { - KERNEL_RADIUS: number; - DEPTH_PACKING: number; - PERSPECTIVE_CAMERA: number; - }; - uniforms: { - tDiffuse: Uniform; - size: Uniform; - sampleUvOffsets: Uniform; - sampleWeights: Uniform; - tDepth: Uniform; - cameraNear: Uniform; - cameraFar: Uniform; - depthCutoff: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + KERNEL_RADIUS: number; + DEPTH_PACKING: number; + PERSPECTIVE_CAMERA: number; + }; + uniforms: { + tDiffuse: Uniform; + size: Uniform; + sampleUvOffsets: Uniform; + sampleWeights: Uniform; + tDepth: Uniform; + cameraNear: Uniform; + cameraFar: Uniform; + depthCutoff: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export interface BlurShaderUtils { - createSampleWeights(kernelRadius: number, stdDev: number): number[]; - createSampleOffsets(kernelRadius: number, uvIncrement: Vector2): Vector2[]; - configure(configure: Material, kernelRadius: number, stdDev: number, uvIncrement: Vector2): void; + createSampleWeights( kernelRadius: number, stdDev: number ): number[]; + createSampleOffsets( kernelRadius: number, uvIncrement: Vector2 ): Vector2[]; + configure( configure: Material, kernelRadius: number, stdDev: number, uvIncrement: Vector2 ): void; } diff --git a/examples/jsm/shaders/DepthLimitedBlurShader.js b/examples/jsm/shaders/DepthLimitedBlurShader.js index 23cbff3735ef15437c9167292c41243bd78aafcb..b0059c36ea29af2e09d174003c60e58599857495 100644 --- a/examples/jsm/shaders/DepthLimitedBlurShader.js +++ b/examples/jsm/shaders/DepthLimitedBlurShader.js @@ -8,19 +8,19 @@ import { var DepthLimitedBlurShader = { defines: { - 'KERNEL_RADIUS': 4, - 'DEPTH_PACKING': 1, - 'PERSPECTIVE_CAMERA': 1 + "KERNEL_RADIUS": 4, + "DEPTH_PACKING": 1, + "PERSPECTIVE_CAMERA": 1 }, uniforms: { - 'tDiffuse': { value: null }, - 'size': { value: new Vector2( 512, 512 ) }, - 'sampleUvOffsets': { value: [ new Vector2( 0, 0 ) ] }, - 'sampleWeights': { value: [ 1.0 ] }, - 'tDepth': { value: null }, - 'cameraNear': { value: 10 }, - 'cameraFar': { value: 1000 }, - 'depthCutoff': { value: 10 }, + "tDiffuse": { value: null }, + "size": { value: new Vector2( 512, 512 ) }, + "sampleUvOffsets": { value: [ new Vector2( 0, 0 ) ] }, + "sampleWeights": { value: [ 1.0 ] }, + "tDepth": { value: null }, + "cameraNear": { value: 10 }, + "cameraFar": { value: 1000 }, + "depthCutoff": { value: 10 }, }, vertexShader: [ "#include ", @@ -153,9 +153,9 @@ var BlurShaderUtils = { configure: function ( material, kernelRadius, stdDev, uvIncrement ) { - material.defines[ 'KERNEL_RADIUS' ] = kernelRadius; - material.uniforms[ 'sampleUvOffsets' ].value = BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement ); - material.uniforms[ 'sampleWeights' ].value = BlurShaderUtils.createSampleWeights( kernelRadius, stdDev ); + material.defines[ "KERNEL_RADIUS" ] = kernelRadius; + material.uniforms[ "sampleUvOffsets" ].value = BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement ); + material.uniforms[ "sampleWeights" ].value = BlurShaderUtils.createSampleWeights( kernelRadius, stdDev ); material.needsUpdate = true; } diff --git a/examples/jsm/shaders/DigitalGlitch.d.ts b/examples/jsm/shaders/DigitalGlitch.d.ts index 5a246bce0b622538a821621cc746c5ceb04de5ab..2d0d6cf6550b797832f3e3ad24d917bcaa5c9c50 100644 --- a/examples/jsm/shaders/DigitalGlitch.d.ts +++ b/examples/jsm/shaders/DigitalGlitch.d.ts @@ -1,21 +1,21 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const DigitalGlitch: { - uniforms: { - tDiffuse: Uniform; - tDisp: Uniform; - byp: Uniform; - amount: Uniform; - angle: Uniform; - seed: Uniform; - seed_x: Uniform; - seed_y: Uniform; - distortion_x: Uniform; - distortion_y: Uniform; - col_s: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + tDisp: Uniform; + byp: Uniform; + amount: Uniform; + angle: Uniform; + seed: Uniform; + seed_x: Uniform; + seed_y: Uniform; + distortion_x: Uniform; + distortion_y: Uniform; + col_s: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/DigitalGlitch.js b/examples/jsm/shaders/DigitalGlitch.js index ab662ea0e3afaaf00a93b6b3eeaef087fb165caa..3a9f56105ac74c391acc287f48af1cc97466b87f 100644 --- a/examples/jsm/shaders/DigitalGlitch.js +++ b/examples/jsm/shaders/DigitalGlitch.js @@ -39,7 +39,7 @@ var DigitalGlitch = { ].join( "\n" ), fragmentShader: [ - "uniform int byp;",//should we apply the glitch ? + "uniform int byp;", //should we apply the glitch ? "uniform sampler2D tDiffuse;", "uniform sampler2D tDisp;", diff --git a/examples/jsm/shaders/DotScreenShader.d.ts b/examples/jsm/shaders/DotScreenShader.d.ts index fdd3dfb78005d8a929f357f73d0429f72fc54f55..f863a06d6d0863f2c517bd3798bb68187bae68b7 100644 --- a/examples/jsm/shaders/DotScreenShader.d.ts +++ b/examples/jsm/shaders/DotScreenShader.d.ts @@ -1,15 +1,15 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const DotScreenShader: { - uniforms: { - tDiffuse: Uniform; - tSize: Uniform; - center: Uniform; - angle: Uniform; - scale: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + tSize: Uniform; + center: Uniform; + angle: Uniform; + scale: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/DotScreenShader.js b/examples/jsm/shaders/DotScreenShader.js index 86c9a850e8cdc6e342be33887c2bb8344a221719..ac19e223fca60721dbc5e5e0a0776c4e7edda829 100644 --- a/examples/jsm/shaders/DotScreenShader.js +++ b/examples/jsm/shaders/DotScreenShader.js @@ -15,10 +15,10 @@ var DotScreenShader = { uniforms: { "tDiffuse": { value: null }, - "tSize": { value: new Vector2( 256, 256 ) }, - "center": { value: new Vector2( 0.5, 0.5 ) }, - "angle": { value: 1.57 }, - "scale": { value: 1.0 } + "tSize": { value: new Vector2( 256, 256 ) }, + "center": { value: new Vector2( 0.5, 0.5 ) }, + "angle": { value: 1.57 }, + "scale": { value: 1.0 } }, diff --git a/examples/jsm/shaders/FXAAShader.d.ts b/examples/jsm/shaders/FXAAShader.d.ts index 95efaee6a511b03d6a3b37245339e4e0df661585..b3d61fe7417c03f76325f3f8c1a87a7ebedb6b16 100644 --- a/examples/jsm/shaders/FXAAShader.d.ts +++ b/examples/jsm/shaders/FXAAShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const FXAAShader: { - uniforms: { - tDiffuse: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/FXAAShader.js b/examples/jsm/shaders/FXAAShader.js index 8b7d41a5a6f786a75445de339b4085288a0d7929..369b184730ff42a4d97aabc6ab3fa9b57b33c682 100644 --- a/examples/jsm/shaders/FXAAShader.js +++ b/examples/jsm/shaders/FXAAShader.js @@ -35,1086 +35,1086 @@ var FXAAShader = { ].join( "\n" ), fragmentShader: [ - "precision highp float;", - "", - "uniform sampler2D tDiffuse;", - "", - "uniform vec2 resolution;", - "", - "varying vec2 vUv;", - "", - "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", - "", - "//----------------------------------------------------------------------------------", - "// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag", - "// SDK Version: v3.00", - "// Email: gameworks@nvidia.com", - "// Site: http://developer.nvidia.com/", - "//", - "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", - "//", - "// Redistribution and use in source and binary forms, with or without", - "// modification, are permitted provided that the following conditions", - "// are met:", - "// * Redistributions of source code must retain the above copyright", - "// notice, this list of conditions and the following disclaimer.", - "// * Redistributions in binary form must reproduce the above copyright", - "// notice, this list of conditions and the following disclaimer in the", - "// documentation and/or other materials provided with the distribution.", - "// * Neither the name of NVIDIA CORPORATION nor the names of its", - "// contributors may be used to endorse or promote products derived", - "// from this software without specific prior written permission.", - "//", - "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", - "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", - "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", - "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR", - "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", - "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", - "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", - "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", - "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", - "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", - "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", - "//", - "//----------------------------------------------------------------------------------", - "", - "#define FXAA_PC 1", - "#define FXAA_GLSL_100 1", - "#define FXAA_QUALITY_PRESET 12", - "", - "#define FXAA_GREEN_AS_LUMA 1", - "", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_PC_CONSOLE", - " //", - " // The console algorithm for PC is included", - " // for developers targeting really low spec machines.", - " // Likely better to just run FXAA_PC, and use a really low preset.", - " //", - " #define FXAA_PC_CONSOLE 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GLSL_120", - " #define FXAA_GLSL_120 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GLSL_130", - " #define FXAA_GLSL_130 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_3", - " #define FXAA_HLSL_3 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_4", - " #define FXAA_HLSL_4 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_HLSL_5", - " #define FXAA_HLSL_5 0", - "#endif", - "/*==========================================================================*/", - "#ifndef FXAA_GREEN_AS_LUMA", - " //", - " // For those using non-linear color,", - " // and either not able to get luma in alpha, or not wanting to,", - " // this enables FXAA to run using green as a proxy for luma.", - " // So with this enabled, no need to pack luma in alpha.", - " //", - " // This will turn off AA on anything which lacks some amount of green.", - " // Pure red and blue or combination of only R and B, will get no AA.", - " //", - " // Might want to lower the settings for both,", - " // fxaaConsoleEdgeThresholdMin", - " // fxaaQualityEdgeThresholdMin", - " // In order to insure AA does not get turned off on colors", - " // which contain a minor amount of green.", - " //", - " // 1 = On.", - " // 0 = Off.", - " //", - " #define FXAA_GREEN_AS_LUMA 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_EARLY_EXIT", - " //", - " // Controls algorithm's early exit path.", - " // On PS3 turning this ON adds 2 cycles to the shader.", - " // On 360 turning this OFF adds 10ths of a millisecond to the shader.", - " // Turning this off on console will result in a more blurry image.", - " // So this defaults to on.", - " //", - " // 1 = On.", - " // 0 = Off.", - " //", - " #define FXAA_EARLY_EXIT 1", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_DISCARD", - " //", - " // Only valid for PC OpenGL currently.", - " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", - " //", - " // 1 = Use discard on pixels which don't need AA.", - " // For APIs which enable concurrent TEX+ROP from same surface.", - " // 0 = Return unchanged color on pixels which don't need AA.", - " //", - " #define FXAA_DISCARD 0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_FAST_PIXEL_OFFSET", - " //", - " // Used for GLSL 120 only.", - " //", - " // 1 = GL API supports fast pixel offsets", - " // 0 = do not use fast pixel offsets", - " //", - " #ifdef GL_EXT_gpu_shader4", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifdef GL_NV_gpu_shader5", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifdef GL_ARB_gpu_shader5", - " #define FXAA_FAST_PIXEL_OFFSET 1", - " #endif", - " #ifndef FXAA_FAST_PIXEL_OFFSET", - " #define FXAA_FAST_PIXEL_OFFSET 0", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#ifndef FXAA_GATHER4_ALPHA", - " //", - " // 1 = API supports gather4 on alpha channel.", - " // 0 = API does not support gather4 on alpha channel.", - " //", - " #if (FXAA_HLSL_5 == 1)", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifdef GL_ARB_gpu_shader5", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifdef GL_NV_gpu_shader5", - " #define FXAA_GATHER4_ALPHA 1", - " #endif", - " #ifndef FXAA_GATHER4_ALPHA", - " #define FXAA_GATHER4_ALPHA 0", - " #endif", - "#endif", - "", - "", - "/*============================================================================", - " FXAA QUALITY - TUNING KNOBS", - "------------------------------------------------------------------------------", - "NOTE the other tuning knobs are now in the shader function inputs!", - "============================================================================*/", - "#ifndef FXAA_QUALITY_PRESET", - " //", - " // Choose the quality preset.", - " // This needs to be compiled into the shader as it effects code.", - " // Best option to include multiple presets is to", - " // in each shader define the preset, then include this file.", - " //", - " // OPTIONS", - " // -----------------------------------------------------------------------", - " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", - " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", - " // 39 - no dither, very expensive", - " //", - " // NOTES", - " // -----------------------------------------------------------------------", - " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", - " // 13 = about same speed as FXAA 3.9 and better than 12", - " // 23 = closest to FXAA 3.9 visually and performance wise", - " // _ = the lowest digit is directly related to performance", - " // _ = the highest digit is directly related to style", - " //", - " #define FXAA_QUALITY_PRESET 12", - "#endif", - "", - "", - "/*============================================================================", - "", - " FXAA QUALITY - PRESETS", - "", - "============================================================================*/", - "", - "/*============================================================================", - " FXAA QUALITY - MEDIUM DITHER PRESETS", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 10)", - " #define FXAA_QUALITY_PS 3", - " #define FXAA_QUALITY_P0 1.5", - " #define FXAA_QUALITY_P1 3.0", - " #define FXAA_QUALITY_P2 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 11)", - " #define FXAA_QUALITY_PS 4", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 3.0", - " #define FXAA_QUALITY_P3 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 12)", - " #define FXAA_QUALITY_PS 5", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 4.0", - " #define FXAA_QUALITY_P4 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 13)", - " #define FXAA_QUALITY_PS 6", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 4.0", - " #define FXAA_QUALITY_P5 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 14)", - " #define FXAA_QUALITY_PS 7", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 4.0", - " #define FXAA_QUALITY_P6 12.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 15)", - " #define FXAA_QUALITY_PS 8", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 4.0", - " #define FXAA_QUALITY_P7 12.0", - "#endif", - "", - "/*============================================================================", - " FXAA QUALITY - LOW DITHER PRESETS", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 20)", - " #define FXAA_QUALITY_PS 3", - " #define FXAA_QUALITY_P0 1.5", - " #define FXAA_QUALITY_P1 2.0", - " #define FXAA_QUALITY_P2 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 21)", - " #define FXAA_QUALITY_PS 4", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 22)", - " #define FXAA_QUALITY_PS 5", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 23)", - " #define FXAA_QUALITY_PS 6", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 24)", - " #define FXAA_QUALITY_PS 7", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 3.0", - " #define FXAA_QUALITY_P6 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 25)", - " #define FXAA_QUALITY_PS 8", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 4.0", - " #define FXAA_QUALITY_P7 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 26)", - " #define FXAA_QUALITY_PS 9", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 4.0", - " #define FXAA_QUALITY_P8 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 27)", - " #define FXAA_QUALITY_PS 10", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 4.0", - " #define FXAA_QUALITY_P9 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 28)", - " #define FXAA_QUALITY_PS 11", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 4.0", - " #define FXAA_QUALITY_P10 8.0", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_QUALITY_PRESET == 29)", - " #define FXAA_QUALITY_PS 12", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.5", - " #define FXAA_QUALITY_P2 2.0", - " #define FXAA_QUALITY_P3 2.0", - " #define FXAA_QUALITY_P4 2.0", - " #define FXAA_QUALITY_P5 2.0", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 2.0", - " #define FXAA_QUALITY_P10 4.0", - " #define FXAA_QUALITY_P11 8.0", - "#endif", - "", - "/*============================================================================", - " FXAA QUALITY - EXTREME QUALITY", - "============================================================================*/", - "#if (FXAA_QUALITY_PRESET == 39)", - " #define FXAA_QUALITY_PS 12", - " #define FXAA_QUALITY_P0 1.0", - " #define FXAA_QUALITY_P1 1.0", - " #define FXAA_QUALITY_P2 1.0", - " #define FXAA_QUALITY_P3 1.0", - " #define FXAA_QUALITY_P4 1.0", - " #define FXAA_QUALITY_P5 1.5", - " #define FXAA_QUALITY_P6 2.0", - " #define FXAA_QUALITY_P7 2.0", - " #define FXAA_QUALITY_P8 2.0", - " #define FXAA_QUALITY_P9 2.0", - " #define FXAA_QUALITY_P10 4.0", - " #define FXAA_QUALITY_P11 8.0", - "#endif", - "", - "", - "", - "/*============================================================================", - "", - " API PORTING", - "", - "============================================================================*/", - "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", - " #define FxaaBool bool", - " #define FxaaDiscard discard", - " #define FxaaFloat float", - " #define FxaaFloat2 vec2", - " #define FxaaFloat3 vec3", - " #define FxaaFloat4 vec4", - " #define FxaaHalf float", - " #define FxaaHalf2 vec2", - " #define FxaaHalf3 vec3", - " #define FxaaHalf4 vec4", - " #define FxaaInt2 ivec2", - " #define FxaaSat(x) clamp(x, 0.0, 1.0)", - " #define FxaaTex sampler2D", - "#else", - " #define FxaaBool bool", - " #define FxaaDiscard clip(-1)", - " #define FxaaFloat float", - " #define FxaaFloat2 float2", - " #define FxaaFloat3 float3", - " #define FxaaFloat4 float4", - " #define FxaaHalf half", - " #define FxaaHalf2 half2", - " #define FxaaHalf3 half3", - " #define FxaaHalf4 half4", - " #define FxaaSat(x) saturate(x)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_100 == 1)", - " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_120 == 1)", - " // Requires,", - " // #version 120", - " // And at least,", - " // #extension GL_EXT_gpu_shader4 : enable", - " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", - " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", - " #if (FXAA_FAST_PIXEL_OFFSET == 1)", - " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", - " #else", - " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", - " #endif", - " #if (FXAA_GATHER4_ALPHA == 1)", - " // use #extension GL_ARB_gpu_shader5 : enable", - " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", - " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", - " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", - " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_GLSL_130 == 1)", - " // Requires \"#version 130\" or better", - " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", - " #if (FXAA_GATHER4_ALPHA == 1)", - " // use #extension GL_ARB_gpu_shader5 : enable", - " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", - " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", - " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", - " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", - " #endif", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_3 == 1)", - " #define FxaaInt2 float2", - " #define FxaaTex sampler2D", - " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", - " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_4 == 1)", - " #define FxaaInt2 int2", - " struct FxaaTex { SamplerState smpl; Texture2D tex; };", - " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", - "#endif", - "/*--------------------------------------------------------------------------*/", - "#if (FXAA_HLSL_5 == 1)", - " #define FxaaInt2 int2", - " struct FxaaTex { SamplerState smpl; Texture2D tex; };", - " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", - " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", - " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", - " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", - " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", - " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", - "#endif", - "", - "", - "/*============================================================================", - " GREEN AS LUMA OPTION SUPPORT FUNCTION", - "============================================================================*/", - "#if (FXAA_GREEN_AS_LUMA == 0)", - " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", - "#else", - " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", - "#endif", - "", - "", - "", - "", - "/*============================================================================", - "", - " FXAA3 QUALITY - PC", - "", - "============================================================================*/", - "#if (FXAA_PC == 1)", - "/*--------------------------------------------------------------------------*/", - "FxaaFloat4 FxaaPixelShader(", - " //", - " // Use noperspective interpolation here (turn off perspective interpolation).", - " // {xy} = center of pixel", - " FxaaFloat2 pos,", - " //", - " // Used only for FXAA Console, and not used on the 360 version.", - " // Use noperspective interpolation here (turn off perspective interpolation).", - " // {xy_} = upper left of pixel", - " // {_zw} = lower right of pixel", - " FxaaFloat4 fxaaConsolePosPos,", - " //", - " // Input color texture.", - " // {rgb_} = color in linear or perceptual color space", - " // if (FXAA_GREEN_AS_LUMA == 0)", - " // {__a} = luma in perceptual color space (not linear)", - " FxaaTex tex,", - " //", - " // Only used on the optimized 360 version of FXAA Console.", - " // For everything but 360, just use the same input here as for \"tex\".", - " // For 360, same texture, just alias with a 2nd sampler.", - " // This sampler needs to have an exponent bias of -1.", - " FxaaTex fxaaConsole360TexExpBiasNegOne,", - " //", - " // Only used on the optimized 360 version of FXAA Console.", - " // For everything but 360, just use the same input here as for \"tex\".", - " // For 360, same texture, just alias with a 3nd sampler.", - " // This sampler needs to have an exponent bias of -2.", - " FxaaTex fxaaConsole360TexExpBiasNegTwo,", - " //", - " // Only used on FXAA Quality.", - " // This must be from a constant/uniform.", - " // {x_} = 1.0/screenWidthInPixels", - " // {_y} = 1.0/screenHeightInPixels", - " FxaaFloat2 fxaaQualityRcpFrame,", - " //", - " // Only used on FXAA Console.", - " // This must be from a constant/uniform.", - " // This effects sub-pixel AA quality and inversely sharpness.", - " // Where N ranges between,", - " // N = 0.50 (default)", - " // N = 0.33 (sharper)", - " // {x__} = -N/screenWidthInPixels", - " // {_y_} = -N/screenHeightInPixels", - " // {_z_} = N/screenWidthInPixels", - " // {__w} = N/screenHeightInPixels", - " FxaaFloat4 fxaaConsoleRcpFrameOpt,", - " //", - " // Only used on FXAA Console.", - " // Not used on 360, but used on PS3 and PC.", - " // This must be from a constant/uniform.", - " // {x__} = -2.0/screenWidthInPixels", - " // {_y_} = -2.0/screenHeightInPixels", - " // {_z_} = 2.0/screenWidthInPixels", - " // {__w} = 2.0/screenHeightInPixels", - " FxaaFloat4 fxaaConsoleRcpFrameOpt2,", - " //", - " // Only used on FXAA Console.", - " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", - " // This must be from a constant/uniform.", - " // {x__} = 8.0/screenWidthInPixels", - " // {_y_} = 8.0/screenHeightInPixels", - " // {_z_} = -4.0/screenWidthInPixels", - " // {__w} = -4.0/screenHeightInPixels", - " FxaaFloat4 fxaaConsole360RcpFrameOpt2,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_SUBPIX define.", - " // It is here now to allow easier tuning.", - " // Choose the amount of sub-pixel aliasing removal.", - " // This can effect sharpness.", - " // 1.00 - upper limit (softer)", - " // 0.75 - default amount of filtering", - " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)", - " // 0.25 - almost off", - " // 0.00 - completely off", - " FxaaFloat fxaaQualitySubpix,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", - " // It is here now to allow easier tuning.", - " // The minimum amount of local contrast required to apply algorithm.", - " // 0.333 - too little (faster)", - " // 0.250 - low quality", - " // 0.166 - default", - " // 0.125 - high quality", - " // 0.063 - overkill (slower)", - " FxaaFloat fxaaQualityEdgeThreshold,", - " //", - " // Only used on FXAA Quality.", - " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", - " // It is here now to allow easier tuning.", - " // Trims the algorithm from processing darks.", - " // 0.0833 - upper limit (default, the start of visible unfiltered edges)", - " // 0.0625 - high quality (faster)", - " // 0.0312 - visible limit (slower)", - " // Special notes when using FXAA_GREEN_AS_LUMA,", - " // Likely want to set this to zero.", - " // As colors that are mostly not-green", - " // will appear very dark in the green channel!", - " // Tune by looking at mostly non-green content,", - " // then start at zero and increase until aliasing is a problem.", - " FxaaFloat fxaaQualityEdgeThresholdMin,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", - " // It is here now to allow easier tuning.", - " // This does not effect PS3, as this needs to be compiled in.", - " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", - " // Due to the PS3 being ALU bound,", - " // there are only three safe values here: 2 and 4 and 8.", - " // These options use the shaders ability to a free *|/ by 2|4|8.", - " // For all other platforms can be a non-power of two.", - " // 8.0 is sharper (default!!!)", - " // 4.0 is softer", - " // 2.0 is really soft (good only for vector graphics inputs)", - " FxaaFloat fxaaConsoleEdgeSharpness,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", - " // It is here now to allow easier tuning.", - " // This does not effect PS3, as this needs to be compiled in.", - " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", - " // Due to the PS3 being ALU bound,", - " // there are only two safe values here: 1/4 and 1/8.", - " // These options use the shaders ability to a free *|/ by 2|4|8.", - " // The console setting has a different mapping than the quality setting.", - " // Other platforms can use other values.", - " // 0.125 leaves less aliasing, but is softer (default!!!)", - " // 0.25 leaves more aliasing, and is sharper", - " FxaaFloat fxaaConsoleEdgeThreshold,", - " //", - " // Only used on FXAA Console.", - " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", - " // It is here now to allow easier tuning.", - " // Trims the algorithm from processing darks.", - " // The console setting has a different mapping than the quality setting.", - " // This only applies when FXAA_EARLY_EXIT is 1.", - " // This does not apply to PS3,", - " // PS3 was simplified to avoid more shader instructions.", - " // 0.06 - faster but more aliasing in darks", - " // 0.05 - default", - " // 0.04 - slower and less aliasing in darks", - " // Special notes when using FXAA_GREEN_AS_LUMA,", - " // Likely want to set this to zero.", - " // As colors that are mostly not-green", - " // will appear very dark in the green channel!", - " // Tune by looking at mostly non-green content,", - " // then start at zero and increase until aliasing is a problem.", - " FxaaFloat fxaaConsoleEdgeThresholdMin,", - " //", - " // Extra constants for 360 FXAA Console only.", - " // Use zeros or anything else for other platforms.", - " // These must be in physical constant registers and NOT immediates.", - " // Immediates will result in compiler un-optimizing.", - " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", - " FxaaFloat4 fxaaConsole360ConstDir", - ") {", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posM;", - " posM.x = pos.x;", - " posM.y = pos.y;", - " #if (FXAA_GATHER4_ALPHA == 1)", - " #if (FXAA_DISCARD == 0)", - " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " #define lumaM rgbyM.w", - " #else", - " #define lumaM rgbyM.y", - " #endif", - " #endif", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", - " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", - " #else", - " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", - " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", - " #endif", - " #if (FXAA_DISCARD == 1)", - " #define lumaM luma4A.w", - " #endif", - " #define lumaE luma4A.z", - " #define lumaS luma4A.x", - " #define lumaSE luma4A.y", - " #define lumaNW luma4B.w", - " #define lumaN luma4B.z", - " #define lumaW luma4B.x", - " #else", - " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", - " #if (FXAA_GREEN_AS_LUMA == 0)", - " #define lumaM rgbyM.w", - " #else", - " #define lumaM rgbyM.y", - " #endif", - " #if (FXAA_GLSL_100 == 1)", - " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", - " #else", - " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", - " #endif", - " #endif", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat maxSM = max(lumaS, lumaM);", - " FxaaFloat minSM = min(lumaS, lumaM);", - " FxaaFloat maxESM = max(lumaE, maxSM);", - " FxaaFloat minESM = min(lumaE, minSM);", - " FxaaFloat maxWN = max(lumaN, lumaW);", - " FxaaFloat minWN = min(lumaN, lumaW);", - " FxaaFloat rangeMax = max(maxWN, maxESM);", - " FxaaFloat rangeMin = min(minWN, minESM);", - " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", - " FxaaFloat range = rangeMax - rangeMin;", - " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", - " FxaaBool earlyExit = range < rangeMaxClamped;", - "/*--------------------------------------------------------------------------*/", - " if(earlyExit)", - " #if (FXAA_DISCARD == 1)", - " FxaaDiscard;", - " #else", - " return rgbyM;", - " #endif", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_GATHER4_ALPHA == 0)", - " #if (FXAA_GLSL_100 == 1)", - " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", - " #else", - " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", - " #endif", - " #else", - " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", - " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", - " #endif", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNS = lumaN + lumaS;", - " FxaaFloat lumaWE = lumaW + lumaE;", - " FxaaFloat subpixRcpRange = 1.0/range;", - " FxaaFloat subpixNSWE = lumaNS + lumaWE;", - " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", - " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNESE = lumaNE + lumaSE;", - " FxaaFloat lumaNWNE = lumaNW + lumaNE;", - " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", - " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat lumaNWSW = lumaNW + lumaSW;", - " FxaaFloat lumaSWSE = lumaSW + lumaSE;", - " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", - " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", - " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", - " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", - " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", - " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", - " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", - " FxaaBool horzSpan = edgeHorz >= edgeVert;", - " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", - "/*--------------------------------------------------------------------------*/", - " if(!horzSpan) lumaN = lumaW;", - " if(!horzSpan) lumaS = lumaE;", - " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", - " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat gradientN = lumaN - lumaM;", - " FxaaFloat gradientS = lumaS - lumaM;", - " FxaaFloat lumaNN = lumaN + lumaM;", - " FxaaFloat lumaSS = lumaS + lumaM;", - " FxaaBool pairN = abs(gradientN) >= abs(gradientS);", - " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", - " if(pairN) lengthSign = -lengthSign;", - " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posB;", - " posB.x = posM.x;", - " posB.y = posM.y;", - " FxaaFloat2 offNP;", - " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", - " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", - " if(!horzSpan) posB.x += lengthSign * 0.5;", - " if( horzSpan) posB.y += lengthSign * 0.5;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat2 posN;", - " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", - " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", - " FxaaFloat2 posP;", - " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", - " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", - " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", - " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", - " FxaaFloat subpixE = subpixC * subpixC;", - " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", - "/*--------------------------------------------------------------------------*/", - " if(!pairN) lumaNN = lumaSS;", - " FxaaFloat gradientScaled = gradient * 1.0/4.0;", - " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", - " FxaaFloat subpixF = subpixD * subpixE;", - " FxaaBool lumaMLTZero = lumaMM < 0.0;", - "/*--------------------------------------------------------------------------*/", - " lumaEndN -= lumaNN * 0.5;", - " lumaEndP -= lumaNN * 0.5;", - " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", - " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", - " FxaaBool doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", - "/*--------------------------------------------------------------------------*/", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 3)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 4)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 5)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 6)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 7)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 8)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 9)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 10)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 11)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", - "/*--------------------------------------------------------------------------*/", - " #if (FXAA_QUALITY_PS > 12)", - " if(doneNP) {", - " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", - " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", - " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", - " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", - " doneN = abs(lumaEndN) >= gradientScaled;", - " doneP = abs(lumaEndP) >= gradientScaled;", - " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", - " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", - " doneNP = (!doneN) || (!doneP);", - " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", - " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - " #endif", - "/*--------------------------------------------------------------------------*/", - " }", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat dstN = posM.x - posN.x;", - " FxaaFloat dstP = posP.x - posM.x;", - " if(!horzSpan) dstN = posM.y - posN.y;", - " if(!horzSpan) dstP = posP.y - posM.y;", - "/*--------------------------------------------------------------------------*/", - " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", - " FxaaFloat spanLength = (dstP + dstN);", - " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", - " FxaaFloat spanLengthRcp = 1.0/spanLength;", - "/*--------------------------------------------------------------------------*/", - " FxaaBool directionN = dstN < dstP;", - " FxaaFloat dst = min(dstN, dstP);", - " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", - " FxaaFloat subpixG = subpixF * subpixF;", - " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", - " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", - "/*--------------------------------------------------------------------------*/", - " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", - " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", - " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", - " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", - " #if (FXAA_DISCARD == 1)", - " return FxaaTexTop(tex, posM);", - " #else", - " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", - " #endif", - "}", - "/*==========================================================================*/", - "#endif", - "", - "void main() {", - " gl_FragColor = FxaaPixelShader(", - " vUv,", - " vec4(0.0),", - " tDiffuse,", - " tDiffuse,", - " tDiffuse,", - " resolution,", - " vec4(0.0),", - " vec4(0.0),", - " vec4(0.0),", - " 0.75,", - " 0.166,", - " 0.0833,", - " 0.0,", - " 0.0,", - " 0.0,", - " vec4(0.0)", - " );", - "", - " // TODO avoid querying texture twice for same texel", - " gl_FragColor.a = texture2D(tDiffuse, vUv).a;", - "}" - ].join("\n") + "precision highp float;", + "", + "uniform sampler2D tDiffuse;", + "", + "uniform vec2 resolution;", + "", + "varying vec2 vUv;", + "", + "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", + "", + "//----------------------------------------------------------------------------------", + "// File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag", + "// SDK Version: v3.00", + "// Email: gameworks@nvidia.com", + "// Site: http://developer.nvidia.com/", + "//", + "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", + "//", + "// Redistribution and use in source and binary forms, with or without", + "// modification, are permitted provided that the following conditions", + "// are met:", + "// * Redistributions of source code must retain the above copyright", + "// notice, this list of conditions and the following disclaimer.", + "// * Redistributions in binary form must reproduce the above copyright", + "// notice, this list of conditions and the following disclaimer in the", + "// documentation and/or other materials provided with the distribution.", + "// * Neither the name of NVIDIA CORPORATION nor the names of its", + "// contributors may be used to endorse or promote products derived", + "// from this software without specific prior written permission.", + "//", + "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", + "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", + "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", + "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR", + "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", + "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", + "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", + "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", + "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", + "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", + "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", + "//", + "//----------------------------------------------------------------------------------", + "", + "#define FXAA_PC 1", + "#define FXAA_GLSL_100 1", + "#define FXAA_QUALITY_PRESET 12", + "", + "#define FXAA_GREEN_AS_LUMA 1", + "", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_PC_CONSOLE", + " //", + " // The console algorithm for PC is included", + " // for developers targeting really low spec machines.", + " // Likely better to just run FXAA_PC, and use a really low preset.", + " //", + " #define FXAA_PC_CONSOLE 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GLSL_120", + " #define FXAA_GLSL_120 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GLSL_130", + " #define FXAA_GLSL_130 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_3", + " #define FXAA_HLSL_3 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_4", + " #define FXAA_HLSL_4 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_HLSL_5", + " #define FXAA_HLSL_5 0", + "#endif", + "/*==========================================================================*/", + "#ifndef FXAA_GREEN_AS_LUMA", + " //", + " // For those using non-linear color,", + " // and either not able to get luma in alpha, or not wanting to,", + " // this enables FXAA to run using green as a proxy for luma.", + " // So with this enabled, no need to pack luma in alpha.", + " //", + " // This will turn off AA on anything which lacks some amount of green.", + " // Pure red and blue or combination of only R and B, will get no AA.", + " //", + " // Might want to lower the settings for both,", + " // fxaaConsoleEdgeThresholdMin", + " // fxaaQualityEdgeThresholdMin", + " // In order to insure AA does not get turned off on colors", + " // which contain a minor amount of green.", + " //", + " // 1 = On.", + " // 0 = Off.", + " //", + " #define FXAA_GREEN_AS_LUMA 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_EARLY_EXIT", + " //", + " // Controls algorithm's early exit path.", + " // On PS3 turning this ON adds 2 cycles to the shader.", + " // On 360 turning this OFF adds 10ths of a millisecond to the shader.", + " // Turning this off on console will result in a more blurry image.", + " // So this defaults to on.", + " //", + " // 1 = On.", + " // 0 = Off.", + " //", + " #define FXAA_EARLY_EXIT 1", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_DISCARD", + " //", + " // Only valid for PC OpenGL currently.", + " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", + " //", + " // 1 = Use discard on pixels which don't need AA.", + " // For APIs which enable concurrent TEX+ROP from same surface.", + " // 0 = Return unchanged color on pixels which don't need AA.", + " //", + " #define FXAA_DISCARD 0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_FAST_PIXEL_OFFSET", + " //", + " // Used for GLSL 120 only.", + " //", + " // 1 = GL API supports fast pixel offsets", + " // 0 = do not use fast pixel offsets", + " //", + " #ifdef GL_EXT_gpu_shader4", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifdef GL_NV_gpu_shader5", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifdef GL_ARB_gpu_shader5", + " #define FXAA_FAST_PIXEL_OFFSET 1", + " #endif", + " #ifndef FXAA_FAST_PIXEL_OFFSET", + " #define FXAA_FAST_PIXEL_OFFSET 0", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#ifndef FXAA_GATHER4_ALPHA", + " //", + " // 1 = API supports gather4 on alpha channel.", + " // 0 = API does not support gather4 on alpha channel.", + " //", + " #if (FXAA_HLSL_5 == 1)", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifdef GL_ARB_gpu_shader5", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifdef GL_NV_gpu_shader5", + " #define FXAA_GATHER4_ALPHA 1", + " #endif", + " #ifndef FXAA_GATHER4_ALPHA", + " #define FXAA_GATHER4_ALPHA 0", + " #endif", + "#endif", + "", + "", + "/*============================================================================", + " FXAA QUALITY - TUNING KNOBS", + "------------------------------------------------------------------------------", + "NOTE the other tuning knobs are now in the shader function inputs!", + "============================================================================*/", + "#ifndef FXAA_QUALITY_PRESET", + " //", + " // Choose the quality preset.", + " // This needs to be compiled into the shader as it effects code.", + " // Best option to include multiple presets is to", + " // in each shader define the preset, then include this file.", + " //", + " // OPTIONS", + " // -----------------------------------------------------------------------", + " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", + " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", + " // 39 - no dither, very expensive", + " //", + " // NOTES", + " // -----------------------------------------------------------------------", + " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", + " // 13 = about same speed as FXAA 3.9 and better than 12", + " // 23 = closest to FXAA 3.9 visually and performance wise", + " // _ = the lowest digit is directly related to performance", + " // _ = the highest digit is directly related to style", + " //", + " #define FXAA_QUALITY_PRESET 12", + "#endif", + "", + "", + "/*============================================================================", + "", + " FXAA QUALITY - PRESETS", + "", + "============================================================================*/", + "", + "/*============================================================================", + " FXAA QUALITY - MEDIUM DITHER PRESETS", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 10)", + " #define FXAA_QUALITY_PS 3", + " #define FXAA_QUALITY_P0 1.5", + " #define FXAA_QUALITY_P1 3.0", + " #define FXAA_QUALITY_P2 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 11)", + " #define FXAA_QUALITY_PS 4", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 3.0", + " #define FXAA_QUALITY_P3 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 12)", + " #define FXAA_QUALITY_PS 5", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 4.0", + " #define FXAA_QUALITY_P4 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 13)", + " #define FXAA_QUALITY_PS 6", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 4.0", + " #define FXAA_QUALITY_P5 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 14)", + " #define FXAA_QUALITY_PS 7", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 4.0", + " #define FXAA_QUALITY_P6 12.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 15)", + " #define FXAA_QUALITY_PS 8", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 4.0", + " #define FXAA_QUALITY_P7 12.0", + "#endif", + "", + "/*============================================================================", + " FXAA QUALITY - LOW DITHER PRESETS", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 20)", + " #define FXAA_QUALITY_PS 3", + " #define FXAA_QUALITY_P0 1.5", + " #define FXAA_QUALITY_P1 2.0", + " #define FXAA_QUALITY_P2 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 21)", + " #define FXAA_QUALITY_PS 4", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 22)", + " #define FXAA_QUALITY_PS 5", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 23)", + " #define FXAA_QUALITY_PS 6", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 24)", + " #define FXAA_QUALITY_PS 7", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 3.0", + " #define FXAA_QUALITY_P6 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 25)", + " #define FXAA_QUALITY_PS 8", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 4.0", + " #define FXAA_QUALITY_P7 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 26)", + " #define FXAA_QUALITY_PS 9", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 4.0", + " #define FXAA_QUALITY_P8 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 27)", + " #define FXAA_QUALITY_PS 10", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 4.0", + " #define FXAA_QUALITY_P9 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 28)", + " #define FXAA_QUALITY_PS 11", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 4.0", + " #define FXAA_QUALITY_P10 8.0", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_QUALITY_PRESET == 29)", + " #define FXAA_QUALITY_PS 12", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.5", + " #define FXAA_QUALITY_P2 2.0", + " #define FXAA_QUALITY_P3 2.0", + " #define FXAA_QUALITY_P4 2.0", + " #define FXAA_QUALITY_P5 2.0", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 2.0", + " #define FXAA_QUALITY_P10 4.0", + " #define FXAA_QUALITY_P11 8.0", + "#endif", + "", + "/*============================================================================", + " FXAA QUALITY - EXTREME QUALITY", + "============================================================================*/", + "#if (FXAA_QUALITY_PRESET == 39)", + " #define FXAA_QUALITY_PS 12", + " #define FXAA_QUALITY_P0 1.0", + " #define FXAA_QUALITY_P1 1.0", + " #define FXAA_QUALITY_P2 1.0", + " #define FXAA_QUALITY_P3 1.0", + " #define FXAA_QUALITY_P4 1.0", + " #define FXAA_QUALITY_P5 1.5", + " #define FXAA_QUALITY_P6 2.0", + " #define FXAA_QUALITY_P7 2.0", + " #define FXAA_QUALITY_P8 2.0", + " #define FXAA_QUALITY_P9 2.0", + " #define FXAA_QUALITY_P10 4.0", + " #define FXAA_QUALITY_P11 8.0", + "#endif", + "", + "", + "", + "/*============================================================================", + "", + " API PORTING", + "", + "============================================================================*/", + "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", + " #define FxaaBool bool", + " #define FxaaDiscard discard", + " #define FxaaFloat float", + " #define FxaaFloat2 vec2", + " #define FxaaFloat3 vec3", + " #define FxaaFloat4 vec4", + " #define FxaaHalf float", + " #define FxaaHalf2 vec2", + " #define FxaaHalf3 vec3", + " #define FxaaHalf4 vec4", + " #define FxaaInt2 ivec2", + " #define FxaaSat(x) clamp(x, 0.0, 1.0)", + " #define FxaaTex sampler2D", + "#else", + " #define FxaaBool bool", + " #define FxaaDiscard clip(-1)", + " #define FxaaFloat float", + " #define FxaaFloat2 float2", + " #define FxaaFloat3 float3", + " #define FxaaFloat4 float4", + " #define FxaaHalf half", + " #define FxaaHalf2 half2", + " #define FxaaHalf3 half3", + " #define FxaaHalf4 half4", + " #define FxaaSat(x) saturate(x)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_100 == 1)", + " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_120 == 1)", + " // Requires,", + " // #version 120", + " // And at least,", + " // #extension GL_EXT_gpu_shader4 : enable", + " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", + " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", + " #if (FXAA_FAST_PIXEL_OFFSET == 1)", + " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", + " #else", + " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", + " #endif", + " #if (FXAA_GATHER4_ALPHA == 1)", + " // use #extension GL_ARB_gpu_shader5 : enable", + " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", + " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", + " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", + " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_GLSL_130 == 1)", + " // Requires \"#version 130\" or better", + " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", + " #if (FXAA_GATHER4_ALPHA == 1)", + " // use #extension GL_ARB_gpu_shader5 : enable", + " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", + " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", + " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", + " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", + " #endif", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_3 == 1)", + " #define FxaaInt2 float2", + " #define FxaaTex sampler2D", + " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", + " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_4 == 1)", + " #define FxaaInt2 int2", + " struct FxaaTex { SamplerState smpl; Texture2D tex; };", + " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", + "#endif", + "/*--------------------------------------------------------------------------*/", + "#if (FXAA_HLSL_5 == 1)", + " #define FxaaInt2 int2", + " struct FxaaTex { SamplerState smpl; Texture2D tex; };", + " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", + " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", + " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", + " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", + " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", + " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", + "#endif", + "", + "", + "/*============================================================================", + " GREEN AS LUMA OPTION SUPPORT FUNCTION", + "============================================================================*/", + "#if (FXAA_GREEN_AS_LUMA == 0)", + " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", + "#else", + " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", + "#endif", + "", + "", + "", + "", + "/*============================================================================", + "", + " FXAA3 QUALITY - PC", + "", + "============================================================================*/", + "#if (FXAA_PC == 1)", + "/*--------------------------------------------------------------------------*/", + "FxaaFloat4 FxaaPixelShader(", + " //", + " // Use noperspective interpolation here (turn off perspective interpolation).", + " // {xy} = center of pixel", + " FxaaFloat2 pos,", + " //", + " // Used only for FXAA Console, and not used on the 360 version.", + " // Use noperspective interpolation here (turn off perspective interpolation).", + " // {xy_} = upper left of pixel", + " // {_zw} = lower right of pixel", + " FxaaFloat4 fxaaConsolePosPos,", + " //", + " // Input color texture.", + " // {rgb_} = color in linear or perceptual color space", + " // if (FXAA_GREEN_AS_LUMA == 0)", + " // {__a} = luma in perceptual color space (not linear)", + " FxaaTex tex,", + " //", + " // Only used on the optimized 360 version of FXAA Console.", + " // For everything but 360, just use the same input here as for \"tex\".", + " // For 360, same texture, just alias with a 2nd sampler.", + " // This sampler needs to have an exponent bias of -1.", + " FxaaTex fxaaConsole360TexExpBiasNegOne,", + " //", + " // Only used on the optimized 360 version of FXAA Console.", + " // For everything but 360, just use the same input here as for \"tex\".", + " // For 360, same texture, just alias with a 3nd sampler.", + " // This sampler needs to have an exponent bias of -2.", + " FxaaTex fxaaConsole360TexExpBiasNegTwo,", + " //", + " // Only used on FXAA Quality.", + " // This must be from a constant/uniform.", + " // {x_} = 1.0/screenWidthInPixels", + " // {_y} = 1.0/screenHeightInPixels", + " FxaaFloat2 fxaaQualityRcpFrame,", + " //", + " // Only used on FXAA Console.", + " // This must be from a constant/uniform.", + " // This effects sub-pixel AA quality and inversely sharpness.", + " // Where N ranges between,", + " // N = 0.50 (default)", + " // N = 0.33 (sharper)", + " // {x__} = -N/screenWidthInPixels", + " // {_y_} = -N/screenHeightInPixels", + " // {_z_} = N/screenWidthInPixels", + " // {__w} = N/screenHeightInPixels", + " FxaaFloat4 fxaaConsoleRcpFrameOpt,", + " //", + " // Only used on FXAA Console.", + " // Not used on 360, but used on PS3 and PC.", + " // This must be from a constant/uniform.", + " // {x__} = -2.0/screenWidthInPixels", + " // {_y_} = -2.0/screenHeightInPixels", + " // {_z_} = 2.0/screenWidthInPixels", + " // {__w} = 2.0/screenHeightInPixels", + " FxaaFloat4 fxaaConsoleRcpFrameOpt2,", + " //", + " // Only used on FXAA Console.", + " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", + " // This must be from a constant/uniform.", + " // {x__} = 8.0/screenWidthInPixels", + " // {_y_} = 8.0/screenHeightInPixels", + " // {_z_} = -4.0/screenWidthInPixels", + " // {__w} = -4.0/screenHeightInPixels", + " FxaaFloat4 fxaaConsole360RcpFrameOpt2,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_SUBPIX define.", + " // It is here now to allow easier tuning.", + " // Choose the amount of sub-pixel aliasing removal.", + " // This can effect sharpness.", + " // 1.00 - upper limit (softer)", + " // 0.75 - default amount of filtering", + " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)", + " // 0.25 - almost off", + " // 0.00 - completely off", + " FxaaFloat fxaaQualitySubpix,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", + " // It is here now to allow easier tuning.", + " // The minimum amount of local contrast required to apply algorithm.", + " // 0.333 - too little (faster)", + " // 0.250 - low quality", + " // 0.166 - default", + " // 0.125 - high quality", + " // 0.063 - overkill (slower)", + " FxaaFloat fxaaQualityEdgeThreshold,", + " //", + " // Only used on FXAA Quality.", + " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", + " // It is here now to allow easier tuning.", + " // Trims the algorithm from processing darks.", + " // 0.0833 - upper limit (default, the start of visible unfiltered edges)", + " // 0.0625 - high quality (faster)", + " // 0.0312 - visible limit (slower)", + " // Special notes when using FXAA_GREEN_AS_LUMA,", + " // Likely want to set this to zero.", + " // As colors that are mostly not-green", + " // will appear very dark in the green channel!", + " // Tune by looking at mostly non-green content,", + " // then start at zero and increase until aliasing is a problem.", + " FxaaFloat fxaaQualityEdgeThresholdMin,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", + " // It is here now to allow easier tuning.", + " // This does not effect PS3, as this needs to be compiled in.", + " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", + " // Due to the PS3 being ALU bound,", + " // there are only three safe values here: 2 and 4 and 8.", + " // These options use the shaders ability to a free *|/ by 2|4|8.", + " // For all other platforms can be a non-power of two.", + " // 8.0 is sharper (default!!!)", + " // 4.0 is softer", + " // 2.0 is really soft (good only for vector graphics inputs)", + " FxaaFloat fxaaConsoleEdgeSharpness,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", + " // It is here now to allow easier tuning.", + " // This does not effect PS3, as this needs to be compiled in.", + " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", + " // Due to the PS3 being ALU bound,", + " // there are only two safe values here: 1/4 and 1/8.", + " // These options use the shaders ability to a free *|/ by 2|4|8.", + " // The console setting has a different mapping than the quality setting.", + " // Other platforms can use other values.", + " // 0.125 leaves less aliasing, but is softer (default!!!)", + " // 0.25 leaves more aliasing, and is sharper", + " FxaaFloat fxaaConsoleEdgeThreshold,", + " //", + " // Only used on FXAA Console.", + " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", + " // It is here now to allow easier tuning.", + " // Trims the algorithm from processing darks.", + " // The console setting has a different mapping than the quality setting.", + " // This only applies when FXAA_EARLY_EXIT is 1.", + " // This does not apply to PS3,", + " // PS3 was simplified to avoid more shader instructions.", + " // 0.06 - faster but more aliasing in darks", + " // 0.05 - default", + " // 0.04 - slower and less aliasing in darks", + " // Special notes when using FXAA_GREEN_AS_LUMA,", + " // Likely want to set this to zero.", + " // As colors that are mostly not-green", + " // will appear very dark in the green channel!", + " // Tune by looking at mostly non-green content,", + " // then start at zero and increase until aliasing is a problem.", + " FxaaFloat fxaaConsoleEdgeThresholdMin,", + " //", + " // Extra constants for 360 FXAA Console only.", + " // Use zeros or anything else for other platforms.", + " // These must be in physical constant registers and NOT immediates.", + " // Immediates will result in compiler un-optimizing.", + " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", + " FxaaFloat4 fxaaConsole360ConstDir", + ") {", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posM;", + " posM.x = pos.x;", + " posM.y = pos.y;", + " #if (FXAA_GATHER4_ALPHA == 1)", + " #if (FXAA_DISCARD == 0)", + " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " #define lumaM rgbyM.w", + " #else", + " #define lumaM rgbyM.y", + " #endif", + " #endif", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", + " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", + " #else", + " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", + " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", + " #endif", + " #if (FXAA_DISCARD == 1)", + " #define lumaM luma4A.w", + " #endif", + " #define lumaE luma4A.z", + " #define lumaS luma4A.x", + " #define lumaSE luma4A.y", + " #define lumaNW luma4B.w", + " #define lumaN luma4B.z", + " #define lumaW luma4B.x", + " #else", + " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", + " #if (FXAA_GREEN_AS_LUMA == 0)", + " #define lumaM rgbyM.w", + " #else", + " #define lumaM rgbyM.y", + " #endif", + " #if (FXAA_GLSL_100 == 1)", + " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", + " #else", + " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", + " #endif", + " #endif", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat maxSM = max(lumaS, lumaM);", + " FxaaFloat minSM = min(lumaS, lumaM);", + " FxaaFloat maxESM = max(lumaE, maxSM);", + " FxaaFloat minESM = min(lumaE, minSM);", + " FxaaFloat maxWN = max(lumaN, lumaW);", + " FxaaFloat minWN = min(lumaN, lumaW);", + " FxaaFloat rangeMax = max(maxWN, maxESM);", + " FxaaFloat rangeMin = min(minWN, minESM);", + " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", + " FxaaFloat range = rangeMax - rangeMin;", + " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", + " FxaaBool earlyExit = range < rangeMaxClamped;", + "/*--------------------------------------------------------------------------*/", + " if(earlyExit)", + " #if (FXAA_DISCARD == 1)", + " FxaaDiscard;", + " #else", + " return rgbyM;", + " #endif", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_GATHER4_ALPHA == 0)", + " #if (FXAA_GLSL_100 == 1)", + " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", + " #else", + " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", + " #endif", + " #else", + " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", + " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", + " #endif", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNS = lumaN + lumaS;", + " FxaaFloat lumaWE = lumaW + lumaE;", + " FxaaFloat subpixRcpRange = 1.0/range;", + " FxaaFloat subpixNSWE = lumaNS + lumaWE;", + " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", + " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNESE = lumaNE + lumaSE;", + " FxaaFloat lumaNWNE = lumaNW + lumaNE;", + " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", + " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat lumaNWSW = lumaNW + lumaSW;", + " FxaaFloat lumaSWSE = lumaSW + lumaSE;", + " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", + " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", + " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", + " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", + " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", + " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", + " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", + " FxaaBool horzSpan = edgeHorz >= edgeVert;", + " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", + "/*--------------------------------------------------------------------------*/", + " if(!horzSpan) lumaN = lumaW;", + " if(!horzSpan) lumaS = lumaE;", + " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", + " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat gradientN = lumaN - lumaM;", + " FxaaFloat gradientS = lumaS - lumaM;", + " FxaaFloat lumaNN = lumaN + lumaM;", + " FxaaFloat lumaSS = lumaS + lumaM;", + " FxaaBool pairN = abs(gradientN) >= abs(gradientS);", + " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", + " if(pairN) lengthSign = -lengthSign;", + " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posB;", + " posB.x = posM.x;", + " posB.y = posM.y;", + " FxaaFloat2 offNP;", + " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", + " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", + " if(!horzSpan) posB.x += lengthSign * 0.5;", + " if( horzSpan) posB.y += lengthSign * 0.5;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat2 posN;", + " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", + " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", + " FxaaFloat2 posP;", + " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", + " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", + " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", + " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", + " FxaaFloat subpixE = subpixC * subpixC;", + " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", + "/*--------------------------------------------------------------------------*/", + " if(!pairN) lumaNN = lumaSS;", + " FxaaFloat gradientScaled = gradient * 1.0/4.0;", + " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", + " FxaaFloat subpixF = subpixD * subpixE;", + " FxaaBool lumaMLTZero = lumaMM < 0.0;", + "/*--------------------------------------------------------------------------*/", + " lumaEndN -= lumaNN * 0.5;", + " lumaEndP -= lumaNN * 0.5;", + " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", + " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", + " FxaaBool doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", + "/*--------------------------------------------------------------------------*/", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 3)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 4)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 5)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 6)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 7)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 8)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 9)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 10)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 11)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", + "/*--------------------------------------------------------------------------*/", + " #if (FXAA_QUALITY_PS > 12)", + " if(doneNP) {", + " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", + " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", + " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", + " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", + " doneN = abs(lumaEndN) >= gradientScaled;", + " doneP = abs(lumaEndP) >= gradientScaled;", + " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", + " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", + " doneNP = (!doneN) || (!doneP);", + " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", + " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + " #endif", + "/*--------------------------------------------------------------------------*/", + " }", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat dstN = posM.x - posN.x;", + " FxaaFloat dstP = posP.x - posM.x;", + " if(!horzSpan) dstN = posM.y - posN.y;", + " if(!horzSpan) dstP = posP.y - posM.y;", + "/*--------------------------------------------------------------------------*/", + " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", + " FxaaFloat spanLength = (dstP + dstN);", + " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", + " FxaaFloat spanLengthRcp = 1.0/spanLength;", + "/*--------------------------------------------------------------------------*/", + " FxaaBool directionN = dstN < dstP;", + " FxaaFloat dst = min(dstN, dstP);", + " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", + " FxaaFloat subpixG = subpixF * subpixF;", + " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", + " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", + "/*--------------------------------------------------------------------------*/", + " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", + " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", + " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", + " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", + " #if (FXAA_DISCARD == 1)", + " return FxaaTexTop(tex, posM);", + " #else", + " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", + " #endif", + "}", + "/*==========================================================================*/", + "#endif", + "", + "void main() {", + " gl_FragColor = FxaaPixelShader(", + " vUv,", + " vec4(0.0),", + " tDiffuse,", + " tDiffuse,", + " tDiffuse,", + " resolution,", + " vec4(0.0),", + " vec4(0.0),", + " vec4(0.0),", + " 0.75,", + " 0.166,", + " 0.0833,", + " 0.0,", + " 0.0,", + " 0.0,", + " vec4(0.0)", + " );", + "", + " // TODO avoid querying texture twice for same texel", + " gl_FragColor.a = texture2D(tDiffuse, vUv).a;", + "}" + ].join( "\n" ) }; diff --git a/examples/jsm/shaders/FilmShader.d.ts b/examples/jsm/shaders/FilmShader.d.ts index 82bb1250a20c107bc96233249f09efab809f879c..733e638279fa36ab215db07541b1f079a8135513 100644 --- a/examples/jsm/shaders/FilmShader.d.ts +++ b/examples/jsm/shaders/FilmShader.d.ts @@ -1,16 +1,16 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const FilmShader: { - uniforms: { - tDiffuse: Uniform; - time: Uniform; - nIntensity: Uniform; - sIntensity: Uniform; - sCount: Uniform; - grayscale: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + time: Uniform; + nIntensity: Uniform; + sIntensity: Uniform; + sCount: Uniform; + grayscale: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/FilmShader.js b/examples/jsm/shaders/FilmShader.js index 28009147c6be783bf615ca4106e9ace29e4bf768..e4ffc177c08c050581fe75cc0f51cfae93ef8118 100644 --- a/examples/jsm/shaders/FilmShader.js +++ b/examples/jsm/shaders/FilmShader.js @@ -72,25 +72,25 @@ var FilmShader = { "void main() {", - // sample the source + // sample the source " vec4 cTextureScreen = texture2D( tDiffuse, vUv );", - // make some noise + // make some noise " float dx = rand( vUv + time );", - // add noise + // add noise " vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );", - // get us a sine and cosine + // get us a sine and cosine " vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );", - // add scanlines + // add scanlines " cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;", - // interpolate between source and result by intensity + // interpolate between source and result by intensity " cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );", - // convert to grayscale if desired + // convert to grayscale if desired " if( grayscale ) {", " cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );", diff --git a/examples/jsm/shaders/FocusShader.d.ts b/examples/jsm/shaders/FocusShader.d.ts index fbe4074f7dbfc3246d4757023596c7067541cb6d..2d72ddae8eaae4e072ad0614e5de33cf3703896c 100644 --- a/examples/jsm/shaders/FocusShader.d.ts +++ b/examples/jsm/shaders/FocusShader.d.ts @@ -1,15 +1,15 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const FocusShader: { - uniforms: { - tDiffuse: Uniform; - screenWidth: Uniform; - screenHeight: Uniform; - sampleDistance: Uniform; - waveFactor: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + screenWidth: Uniform; + screenHeight: Uniform; + sampleDistance: Uniform; + waveFactor: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/FreiChenShader.d.ts b/examples/jsm/shaders/FreiChenShader.d.ts index dbeda4f263c7e2c37676572452cd542fd3fc85e2..394b0046a268c4263a164d508a2b68162eb8b4a3 100644 --- a/examples/jsm/shaders/FreiChenShader.d.ts +++ b/examples/jsm/shaders/FreiChenShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const FreiChenShader: { - uniforms: { - tDiffuse: Uniform; - aspect: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + aspect: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/FresnelShader.d.ts b/examples/jsm/shaders/FresnelShader.d.ts index c530098824caab30ea75ebaaf2f487e34d7dfdc5..88447dfcad73bc5ad270871809c7c1131391c615 100644 --- a/examples/jsm/shaders/FresnelShader.d.ts +++ b/examples/jsm/shaders/FresnelShader.d.ts @@ -1,15 +1,15 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const FresnelShader: { - uniforms: { - mRefractionRatio: Uniform; - mFresnelBias: Uniform; - mFresnelPower: Uniform; - mFresnelScale: Uniform; - tCube: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + mRefractionRatio: Uniform; + mFresnelBias: Uniform; + mFresnelPower: Uniform; + mFresnelScale: Uniform; + tCube: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/GammaCorrectionShader.d.ts b/examples/jsm/shaders/GammaCorrectionShader.d.ts index 2f77189be75f8c72e7fd61bd0a1c32222c59fdc6..3108bca590f07c5815458e8368044bf847d31278 100644 --- a/examples/jsm/shaders/GammaCorrectionShader.d.ts +++ b/examples/jsm/shaders/GammaCorrectionShader.d.ts @@ -1,11 +1,11 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const GammaCorrectionShader: { - uniforms: { - tDiffuse: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/GodRaysShader.d.ts b/examples/jsm/shaders/GodRaysShader.d.ts index 9a6be33d8c10487ab276f900bddc3ac58db58572..018cec6233d6af3601eaaf61fb742b0f0d34af26 100644 --- a/examples/jsm/shaders/GodRaysShader.d.ts +++ b/examples/jsm/shaders/GodRaysShader.d.ts @@ -1,43 +1,43 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const GodRaysDepthMaskShader: { - uniforms: { - tInput: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tInput: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const GodRaysGenerateShader: { - uniforms: { - tInput: Uniform; - fStepSize: Uniform; - vSunPositionScreenSpace: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tInput: Uniform; + fStepSize: Uniform; + vSunPositionScreenSpace: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const GodRaysCombineShader: { - uniforms: { - tColors: Uniform; - tGodRays: Uniform; - fGodRayIntensity: Uniform; - vSunPositionScreenSpace: Uniform; - }; - vertexShader: string; - fragmentShader: string; -} + uniforms: { + tColors: Uniform; + tGodRays: Uniform; + fGodRayIntensity: Uniform; + vSunPositionScreenSpace: Uniform; + }; + vertexShader: string; + fragmentShader: string; +}; export const GodRaysFakeSunShader: { - uniforms: { - vSunPositionScreenSpace: Uniform; - fAspect: Uniform; - sunColor: Uniform; - bgColor: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + vSunPositionScreenSpace: Uniform; + fAspect: Uniform; + sunColor: Uniform; + bgColor: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/HalftoneShader.d.ts b/examples/jsm/shaders/HalftoneShader.d.ts index 69ee6e5e67834e920f3c3b9de40f56ba3ba9e784..f951612e164a0a3b5129a1210454e5c1369e7082 100644 --- a/examples/jsm/shaders/HalftoneShader.d.ts +++ b/examples/jsm/shaders/HalftoneShader.d.ts @@ -1,23 +1,23 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const HalftoneShader: { - uniforms: { - tDiffuse: Uniform; - shape: Uniform; - radius: Uniform; - rotateR: Uniform; - rotateG: Uniform; - rotateB: Uniform; - scatter: Uniform; - width: Uniform; - height: Uniform; - blending: Uniform; - blendingMode: Uniform; - greyscale: Uniform; - disable: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + shape: Uniform; + radius: Uniform; + rotateR: Uniform; + rotateG: Uniform; + rotateB: Uniform; + scatter: Uniform; + width: Uniform; + height: Uniform; + blending: Uniform; + blendingMode: Uniform; + greyscale: Uniform; + disable: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/HalftoneShader.js b/examples/jsm/shaders/HalftoneShader.js index e231efec65f0345335f83cb09511270aeb08c035..2fd008a3e857061991fb947629328824e41f795c 100644 --- a/examples/jsm/shaders/HalftoneShader.js +++ b/examples/jsm/shaders/HalftoneShader.js @@ -29,14 +29,14 @@ var HalftoneShader = { vertexShader: [ - "varying vec2 vUV;", + "varying vec2 vUV;", - "void main() {", + "void main() {", - "vUV = uv;", - "gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", + " vUV = uv;", + " gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", - "}" + "}" ].join( "\n" ), diff --git a/examples/jsm/shaders/HorizontalBlurShader.d.ts b/examples/jsm/shaders/HorizontalBlurShader.d.ts index d993c4ea6435a1d1ec0de642d2d478003e7c90a2..0b253779c7518d098f337e6e239f6ee837d91eb3 100644 --- a/examples/jsm/shaders/HorizontalBlurShader.d.ts +++ b/examples/jsm/shaders/HorizontalBlurShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const HorizontalBlurShader: { - uniforms: { - tDiffuse: Uniform; - h: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + h: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts b/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts index 70d1fbb9c2e7d84ab89763ff24f3df6f8222556d..e22ce4035361133cac18d562d665a1907058911d 100644 --- a/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +++ b/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const HorizontalTiltShiftShader: { - uniforms: { - tDiffuse: Uniform; - h: Uniform; - r: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + h: Uniform; + r: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/HueSaturationShader.d.ts b/examples/jsm/shaders/HueSaturationShader.d.ts index 612646e3df1e1eb1165bf6487f929b1f8690e57e..7fbe0e69f4439ff68492aa09cdb776732997d363 100644 --- a/examples/jsm/shaders/HueSaturationShader.d.ts +++ b/examples/jsm/shaders/HueSaturationShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const HueSaturationShader: { - uniforms: { - tDiffuse: Uniform; - hue: Uniform; - saturation: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + hue: Uniform; + saturation: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/HueSaturationShader.js b/examples/jsm/shaders/HueSaturationShader.js index e93ccab6e03147a30a98daf6a1b9e042631cf29e..8fec8bd68278f6a3520f77d054514965a4eb16ed 100644 --- a/examples/jsm/shaders/HueSaturationShader.js +++ b/examples/jsm/shaders/HueSaturationShader.js @@ -45,7 +45,7 @@ var HueSaturationShader = { " gl_FragColor = texture2D( tDiffuse, vUv );", - // hue + // hue " float angle = hue * 3.14159265;", " float s = sin(angle), c = cos(angle);", " vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;", @@ -56,7 +56,7 @@ var HueSaturationShader = { " dot(gl_FragColor.rgb, weights.yzx)", " );", - // saturation + // saturation " float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;", " if (saturation > 0.0) {", " gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));", diff --git a/examples/jsm/shaders/KaleidoShader.d.ts b/examples/jsm/shaders/KaleidoShader.d.ts index 98ed38cd826ced08fec23b587562f5102f74fc31..44502e5d61b1857e2c9e4a8febd93ba2b5c84728 100644 --- a/examples/jsm/shaders/KaleidoShader.d.ts +++ b/examples/jsm/shaders/KaleidoShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const KaleidoShader: { - uniforms: { - tDiffuse: Uniform; - sides: Uniform; - angle: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + sides: Uniform; + angle: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/LuminosityHighPassShader.d.ts b/examples/jsm/shaders/LuminosityHighPassShader.d.ts index bdb6c0d1e8a309ebe801381f7ae2f276b589fce7..0d1667325c60452569c1efa9fc19308dcdf32471 100644 --- a/examples/jsm/shaders/LuminosityHighPassShader.d.ts +++ b/examples/jsm/shaders/LuminosityHighPassShader.d.ts @@ -1,16 +1,16 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const LuminosityHighPassShader: { - shaderID: string; - uniforms: { - tDiffuse: Uniform; - luminosityThreshold: Uniform; - smoothWidth: Uniform; - defaultColor: Uniform; - defaultOpacity: Uniform; - }; - vertexShader: string; - fragmentShader: string; + shaderID: string; + uniforms: { + tDiffuse: Uniform; + luminosityThreshold: Uniform; + smoothWidth: Uniform; + defaultColor: Uniform; + defaultOpacity: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/LuminosityHighPassShader.js b/examples/jsm/shaders/LuminosityHighPassShader.js index 8d9132d85a7b6e480373c2ae19e880913b94870d..647489b3a553ab5f22dcfa1f8d9628702f31eda6 100644 --- a/examples/jsm/shaders/LuminosityHighPassShader.js +++ b/examples/jsm/shaders/LuminosityHighPassShader.js @@ -35,7 +35,7 @@ var LuminosityHighPassShader = { "}" - ].join("\n"), + ].join( "\n" ), fragmentShader: [ @@ -63,7 +63,7 @@ var LuminosityHighPassShader = { "}" - ].join("\n") + ].join( "\n" ) }; diff --git a/examples/jsm/shaders/LuminosityShader.d.ts b/examples/jsm/shaders/LuminosityShader.d.ts index 1bfbd843c1d7188443128e0e9fa1812a1a970b81..5f9b16c9fc9313ae11566e5926bcb5073e78711d 100644 --- a/examples/jsm/shaders/LuminosityShader.d.ts +++ b/examples/jsm/shaders/LuminosityShader.d.ts @@ -1,11 +1,11 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const LuminosityShader: { - uniforms: { - tDiffuse: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/MirrorShader.d.ts b/examples/jsm/shaders/MirrorShader.d.ts index 7cccabae6d94983613a60439bf64e6e634fb371a..243045527c75a263f22af9a7ef4e3934f1a9d370 100644 --- a/examples/jsm/shaders/MirrorShader.d.ts +++ b/examples/jsm/shaders/MirrorShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const MirrorShader: { - uniforms: { - tDiffuse: Uniform; - side: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + side: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/NormalMapShader.d.ts b/examples/jsm/shaders/NormalMapShader.d.ts index a414d71cb5d5cb2fa550b6abeb4887bd6a534796..398d735e51c31c37b6d8fe1f161812280a5ee1ac 100644 --- a/examples/jsm/shaders/NormalMapShader.d.ts +++ b/examples/jsm/shaders/NormalMapShader.d.ts @@ -1,14 +1,14 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const NormalMapShader: { - uniforms: { - heightMap: Uniform; - resolution: Uniform; - scale: Uniform; - height: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + heightMap: Uniform; + resolution: Uniform; + scale: Uniform; + height: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/OceanShaders.d.ts b/examples/jsm/shaders/OceanShaders.d.ts index 40badf45624d1301dbb299f70a0df7f07b512f9f..2f68d508db2a96cbb9d0dfaf249f643f70b1f25c 100644 --- a/examples/jsm/shaders/OceanShaders.d.ts +++ b/examples/jsm/shaders/OceanShaders.d.ts @@ -1,75 +1,75 @@ import { - Texture, - Uniform, - Vector2, + Texture, + Uniform, + Vector2, } from '../../../src/Three'; export const OceanShaders: { - ocean_sim_vertex: { - vertexShader: string; - } - ocean_subtransform: { - uniforms: { - u_input: Uniform, - u_transformSize: Uniform, - u_subtransformSize: Uniform, - }, - fragmentShader: string; - } - ocean_initial_spectrum: { - uniforms: { - u_wind: Uniform, - u_resolution: Uniform, - u_size: Uniform, - }, - vertexShader: string; - fragmentShader: string; - } - ocean_phase: { - uniforms: { - u_phases: Uniform, - u_deltaTime: Uniform, - u_resolution: Uniform, - u_size: Uniform, - }, - vertexShader: string; - fragmentShader: string; - } - ocean_spectrum: { - uniforms: { - u_size: Uniform, - u_resolution: Uniform, - u_choppiness: Uniform, - u_phases: Uniform, - u_initialSpectrum: Uniform, - }, - fragmentShader: string; - } - ocean_normals: { - uniforms: { - u_displacementMap: Uniform, - u_resolution: Uniform, - u_size: Uniform, - }, - fragmentShader: string; - } - ocean_main: { - uniforms: { - u_displacementMap: Uniform, - u_normalMap: Uniform, - u_geometrySize: Uniform, - u_size: Uniform, - u_projectionMatrix: Uniform, - u_viewMatrix: Uniform, - u_cameraPosition: Uniform, - u_skyColor: Uniform, - u_oceanColor: Uniform, - u_sunDirection: Uniform, - u_exposure: Uniform, - }, - vertexShader: string; - fragmentShader: string; - } + ocean_sim_vertex: { + vertexShader: string; + } + ocean_subtransform: { + uniforms: { + u_input: Uniform, + u_transformSize: Uniform, + u_subtransformSize: Uniform, + }, + fragmentShader: string; + } + ocean_initial_spectrum: { + uniforms: { + u_wind: Uniform, + u_resolution: Uniform, + u_size: Uniform, + }, + vertexShader: string; + fragmentShader: string; + } + ocean_phase: { + uniforms: { + u_phases: Uniform, + u_deltaTime: Uniform, + u_resolution: Uniform, + u_size: Uniform, + }, + vertexShader: string; + fragmentShader: string; + } + ocean_spectrum: { + uniforms: { + u_size: Uniform, + u_resolution: Uniform, + u_choppiness: Uniform, + u_phases: Uniform, + u_initialSpectrum: Uniform, + }, + fragmentShader: string; + } + ocean_normals: { + uniforms: { + u_displacementMap: Uniform, + u_resolution: Uniform, + u_size: Uniform, + }, + fragmentShader: string; + } + ocean_main: { + uniforms: { + u_displacementMap: Uniform, + u_normalMap: Uniform, + u_geometrySize: Uniform, + u_size: Uniform, + u_projectionMatrix: Uniform, + u_viewMatrix: Uniform, + u_cameraPosition: Uniform, + u_skyColor: Uniform, + u_oceanColor: Uniform, + u_sunDirection: Uniform, + u_exposure: Uniform, + }, + vertexShader: string; + fragmentShader: string; + } }; diff --git a/examples/jsm/shaders/OceanShaders.js b/examples/jsm/shaders/OceanShaders.js index 51ac1c8d021b8502260d487bad0b29a522bfdf45..804b445af9b0e7d1a0b2a011c35b9f7fd0aec897 100644 --- a/examples/jsm/shaders/OceanShaders.js +++ b/examples/jsm/shaders/OceanShaders.js @@ -26,18 +26,18 @@ import { Vector2 } from "../../../build/three.module.js"; -var OceanShaders = {} -OceanShaders[ 'ocean_sim_vertex' ] = { +var OceanShaders = {}; +OceanShaders[ "ocean_sim_vertex" ] = { vertexShader: [ - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'void main (void) {', - 'vUV = position.xy * 0.5 + 0.5;', - 'gl_Position = vec4(position, 1.0 );', - '}' - ].join( '\n' ) + "void main (void) {", + " vUV = position.xy * 0.5 + 0.5;", + " gl_Position = vec4(position, 1.0 );", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_subtransform' ] = { +OceanShaders[ "ocean_subtransform" ] = { uniforms: { "u_input": { value: null }, "u_transformSize": { value: 512.0 }, @@ -46,131 +46,131 @@ OceanShaders[ 'ocean_subtransform' ] = { fragmentShader: [ //GPU FFT using a Stockham formulation - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'uniform sampler2D u_input;', - 'uniform float u_transformSize;', - 'uniform float u_subtransformSize;', + "uniform sampler2D u_input;", + "uniform float u_transformSize;", + "uniform float u_subtransformSize;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'vec2 multiplyComplex (vec2 a, vec2 b) {', - 'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);', - '}', + "vec2 multiplyComplex (vec2 a, vec2 b) {", + " return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);", + "}", - 'void main (void) {', - '#ifdef HORIZONTAL', - 'float index = vUV.x * u_transformSize - 0.5;', - '#else', - 'float index = vUV.y * u_transformSize - 0.5;', - '#endif', + "void main (void) {", + " #ifdef HORIZONTAL", + " float index = vUV.x * u_transformSize - 0.5;", + " #else", + " float index = vUV.y * u_transformSize - 0.5;", + " #endif", - 'float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);', + " float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);", - //transform two complex sequences simultaneously - '#ifdef HORIZONTAL', - 'vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;', - 'vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;', - '#else', - 'vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;', - 'vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;', - '#endif', + //transform two complex sequences simultaneously + " #ifdef HORIZONTAL", + " vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;", + " vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;", + " #else", + " vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;", + " vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;", + " #endif", - 'float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);', - 'vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));', + " float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);", + " vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));", - 'vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);', - 'vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);', + " vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);", + " vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);", - 'gl_FragColor = vec4(outputA, outputB);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(outputA, outputB);", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_initial_spectrum' ] = { +OceanShaders[ "ocean_initial_spectrum" ] = { uniforms: { "u_wind": { value: new Vector2( 10.0, 10.0 ) }, "u_resolution": { value: 512.0 }, "u_size": { value: 250.0 } }, vertexShader: [ - 'void main (void) {', - 'gl_Position = vec4(position, 1.0);', - '}' - ].join( '\n' ), + "void main (void) {", + " gl_Position = vec4(position, 1.0);", + "}" + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', - 'const float CM = 0.23;', + "const float G = 9.81;", + "const float KM = 370.0;", + "const float CM = 0.23;", - 'uniform vec2 u_wind;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform vec2 u_wind;", + "uniform float u_resolution;", + "uniform float u_size;", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + pow2(k / KM)));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + pow2(k / KM)));", + "}", - '#if __VERSION__ == 100', - 'float tanh (float x) {', - 'return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));', - '}', - '#endif', + "#if __VERSION__ == 100", + "float tanh (float x) {", + " return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));", + "}", + "#endif", - 'void main (void) {', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', + "void main (void) {", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", - 'vec2 K = (2.0 * PI * vec2(n, m)) / u_size;', - 'float k = length(K);', + " vec2 K = (2.0 * PI * vec2(n, m)) / u_size;", + " float k = length(K);", - 'float l_wind = length(u_wind);', + " float l_wind = length(u_wind);", - 'float Omega = 0.84;', - 'float kp = G * pow2(Omega / l_wind);', + " float Omega = 0.84;", + " float kp = G * pow2(Omega / l_wind);", - 'float c = omega(k) / k;', - 'float cp = omega(kp) / kp;', + " float c = omega(k) / k;", + " float cp = omega(kp) / kp;", - 'float Lpm = exp(-1.25 * pow2(kp / k));', - 'float gamma = 1.7;', - 'float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));', - 'float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));', - 'float Jp = pow(gamma, Gamma);', - 'float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));', - 'float alphap = 0.006 * sqrt(Omega);', - 'float Bl = 0.5 * alphap * cp / c * Fp;', + " float Lpm = exp(-1.25 * pow2(kp / k));", + " float gamma = 1.7;", + " float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));", + " float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));", + " float Jp = pow(gamma, Gamma);", + " float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));", + " float alphap = 0.006 * sqrt(Omega);", + " float Bl = 0.5 * alphap * cp / c * Fp;", - 'float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);', - 'float uStar = 0.41 * l_wind / log(10.0 / z0);', - 'float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));', - 'float Fm = exp(-0.25 * pow2(k / KM - 1.0));', - 'float Bh = 0.5 * alpham * CM / c * Fm * Lpm;', + " float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);", + " float uStar = 0.41 * l_wind / log(10.0 / z0);", + " float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));", + " float Fm = exp(-0.25 * pow2(k / KM - 1.0));", + " float Bh = 0.5 * alpham * CM / c * Fm * Lpm;", - 'float a0 = log(2.0) / 4.0;', - 'float am = 0.13 * uStar / CM;', - 'float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));', + " float a0 = log(2.0) / 4.0;", + " float am = 0.13 * uStar / CM;", + " float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));", - 'float cosPhi = dot(normalize(u_wind), normalize(K));', + " float cosPhi = dot(normalize(u_wind), normalize(K));", - 'float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));', + " float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));", - 'float dk = 2.0 * PI / u_size;', - 'float h = sqrt(S / 2.0) * dk;', + " float dk = 2.0 * PI / u_size;", + " float h = sqrt(S / 2.0) * dk;", - 'if (K.x == 0.0 && K.y == 0.0) {', - 'h = 0.0;', //no DC term - '}', - 'gl_FragColor = vec4(h, 0.0, 0.0, 0.0);', - '}' - ].join( '\n' ) + " if (K.x == 0.0 && K.y == 0.0) {", + " h = 0.0;", //no DC term + " }", + " gl_FragColor = vec4(h, 0.0, 0.0, 0.0);", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_phase' ] = { +OceanShaders[ "ocean_phase" ] = { uniforms: { "u_phases": { value: null }, "u_deltaTime": { value: null }, @@ -178,39 +178,39 @@ OceanShaders[ 'ocean_phase' ] = { "u_size": { value: null } }, fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', + "const float G = 9.81;", + "const float KM = 370.0;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform sampler2D u_phases;', - 'uniform float u_deltaTime;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform sampler2D u_phases;", + "uniform float u_deltaTime;", + "uniform float u_resolution;", + "uniform float u_size;", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + k * k / KM * KM));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + k * k / KM * KM));", + "}", - 'void main (void) {', - 'float deltaTime = 1.0 / 60.0;', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', - 'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;', + "void main (void) {", + " float deltaTime = 1.0 / 60.0;", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", + " vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;", - 'float phase = texture2D(u_phases, vUV).r;', - 'float deltaPhase = omega(length(waveVector)) * u_deltaTime;', - 'phase = mod(phase + deltaPhase, 2.0 * PI);', + " float phase = texture2D(u_phases, vUV).r;", + " float deltaPhase = omega(length(waveVector)) * u_deltaTime;", + " phase = mod(phase + deltaPhase, 2.0 * PI);", - 'gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_spectrum' ] = { +OceanShaders[ "ocean_spectrum" ] = { uniforms: { "u_size": { value: null }, "u_resolution": { value: null }, @@ -219,96 +219,96 @@ OceanShaders[ 'ocean_spectrum' ] = { "u_initialSpectrum": { value: null } }, fragmentShader: [ - 'precision highp float;', - '#include ', + "precision highp float;", + "#include ", - 'const float G = 9.81;', - 'const float KM = 370.0;', + "const float G = 9.81;", + "const float KM = 370.0;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform float u_size;', - 'uniform float u_resolution;', - 'uniform float u_choppiness;', - 'uniform sampler2D u_phases;', - 'uniform sampler2D u_initialSpectrum;', + "uniform float u_size;", + "uniform float u_resolution;", + "uniform float u_choppiness;", + "uniform sampler2D u_phases;", + "uniform sampler2D u_initialSpectrum;", - 'vec2 multiplyComplex (vec2 a, vec2 b) {', - 'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);', - '}', + "vec2 multiplyComplex (vec2 a, vec2 b) {", + " return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);", + "}", - 'vec2 multiplyByI (vec2 z) {', - 'return vec2(-z[1], z[0]);', - '}', + "vec2 multiplyByI (vec2 z) {", + " return vec2(-z[1], z[0]);", + "}", - 'float omega (float k) {', - 'return sqrt(G * k * (1.0 + k * k / KM * KM));', - '}', + "float omega (float k) {", + " return sqrt(G * k * (1.0 + k * k / KM * KM));", + "}", - 'void main (void) {', - 'vec2 coordinates = gl_FragCoord.xy - 0.5;', - 'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;', - 'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;', - 'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;', + "void main (void) {", + " vec2 coordinates = gl_FragCoord.xy - 0.5;", + " float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;", + " float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;", + " vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;", - 'float phase = texture2D(u_phases, vUV).r;', - 'vec2 phaseVector = vec2(cos(phase), sin(phase));', + " float phase = texture2D(u_phases, vUV).r;", + " vec2 phaseVector = vec2(cos(phase), sin(phase));", - 'vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;', - 'vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;', - 'h0Star.y *= -1.0;', + " vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;", + " vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;", + " h0Star.y *= -1.0;", - 'vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));', + " vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));", - 'vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;', - 'vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;', + " vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;", + " vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;", - //no DC term - 'if (waveVector.x == 0.0 && waveVector.y == 0.0) {', - 'h = vec2(0.0);', - 'hX = vec2(0.0);', - 'hZ = vec2(0.0);', - '}', + //no DC term + " if (waveVector.x == 0.0 && waveVector.y == 0.0) {", + " h = vec2(0.0);", + " hX = vec2(0.0);", + " hZ = vec2(0.0);", + " }", - 'gl_FragColor = vec4(hX + multiplyByI(h), hZ);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(hX + multiplyByI(h), hZ);", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_normals' ] = { +OceanShaders[ "ocean_normals" ] = { uniforms: { "u_displacementMap": { value: null }, "u_resolution": { value: null }, "u_size": { value: null } }, fragmentShader: [ - 'precision highp float;', + "precision highp float;", - 'varying vec2 vUV;', + "varying vec2 vUV;", - 'uniform sampler2D u_displacementMap;', - 'uniform float u_resolution;', - 'uniform float u_size;', + "uniform sampler2D u_displacementMap;", + "uniform float u_resolution;", + "uniform float u_size;", - 'void main (void) {', - 'float texel = 1.0 / u_resolution;', - 'float texelSize = u_size / u_resolution;', + "void main (void) {", + " float texel = 1.0 / u_resolution;", + " float texelSize = u_size / u_resolution;", - 'vec3 center = texture2D(u_displacementMap, vUV).rgb;', - 'vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;', - 'vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;', - 'vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;', - 'vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;', + " vec3 center = texture2D(u_displacementMap, vUV).rgb;", + " vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;", + " vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;", + " vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;", + " vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;", - 'vec3 topRight = cross(right, top);', - 'vec3 topLeft = cross(top, left);', - 'vec3 bottomLeft = cross(left, bottom);', - 'vec3 bottomRight = cross(bottom, right);', + " vec3 topRight = cross(right, top);", + " vec3 topLeft = cross(top, left);", + " vec3 bottomLeft = cross(left, bottom);", + " vec3 bottomRight = cross(bottom, right);", - 'gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);", + "}" + ].join( "\n" ) }; -OceanShaders[ 'ocean_main' ] = { +OceanShaders[ "ocean_main" ] = { uniforms: { "u_displacementMap": { value: null }, "u_normalMap": { value: null }, @@ -323,57 +323,57 @@ OceanShaders[ 'ocean_main' ] = { "u_exposure": { value: null } }, vertexShader: [ - 'precision highp float;', - - 'varying vec3 vPos;', - 'varying vec2 vUV;', - - 'uniform mat4 u_projectionMatrix;', - 'uniform mat4 u_viewMatrix;', - 'uniform float u_size;', - 'uniform float u_geometrySize;', - 'uniform sampler2D u_displacementMap;', - - 'void main (void) {', - 'vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);', - 'vPos = newPos;', - 'vUV = uv;', - 'gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);', - '}' - ].join( '\n' ), + "precision highp float;", + + "varying vec3 vPos;", + "varying vec2 vUV;", + + "uniform mat4 u_projectionMatrix;", + "uniform mat4 u_viewMatrix;", + "uniform float u_size;", + "uniform float u_geometrySize;", + "uniform sampler2D u_displacementMap;", + + "void main (void) {", + " vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);", + " vPos = newPos;", + " vUV = uv;", + " gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);", + "}" + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', + "precision highp float;", - 'varying vec3 vPos;', - 'varying vec2 vUV;', + "varying vec3 vPos;", + "varying vec2 vUV;", - 'uniform sampler2D u_displacementMap;', - 'uniform sampler2D u_normalMap;', - 'uniform vec3 u_cameraPosition;', - 'uniform vec3 u_oceanColor;', - 'uniform vec3 u_skyColor;', - 'uniform vec3 u_sunDirection;', - 'uniform float u_exposure;', + "uniform sampler2D u_displacementMap;", + "uniform sampler2D u_normalMap;", + "uniform vec3 u_cameraPosition;", + "uniform vec3 u_oceanColor;", + "uniform vec3 u_skyColor;", + "uniform vec3 u_sunDirection;", + "uniform float u_exposure;", - 'vec3 hdr (vec3 color, float exposure) {', - 'return 1.0 - exp(-color * exposure);', - '}', + "vec3 hdr (vec3 color, float exposure) {", + " return 1.0 - exp(-color * exposure);", + "}", - 'void main (void) {', - 'vec3 normal = texture2D(u_normalMap, vUV).rgb;', + "void main (void) {", + " vec3 normal = texture2D(u_normalMap, vUV).rgb;", - 'vec3 view = normalize(u_cameraPosition - vPos);', - 'float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);', - 'vec3 sky = fresnel * u_skyColor;', + " vec3 view = normalize(u_cameraPosition - vPos);", + " float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);", + " vec3 sky = fresnel * u_skyColor;", - 'float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);', - 'vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;', + " float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);", + " vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;", - 'vec3 color = sky + water;', + " vec3 color = sky + water;", - 'gl_FragColor = vec4(hdr(color, u_exposure), 1.0);', - '}' - ].join( '\n' ) + " gl_FragColor = vec4(hdr(color, u_exposure), 1.0);", + "}" + ].join( "\n" ) }; export { OceanShaders }; diff --git a/examples/jsm/shaders/ParallaxShader.d.ts b/examples/jsm/shaders/ParallaxShader.d.ts index fdc0b4c41e49364fd39eb81b581469df7f74e131..cad87e8be4fe1ab7293a79201a442a3a4a746bbb 100644 --- a/examples/jsm/shaders/ParallaxShader.d.ts +++ b/examples/jsm/shaders/ParallaxShader.d.ts @@ -1,22 +1,22 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ParallaxShader: { - modes: { - none: string; - basic: string; - steep: string; - occlusion: string; - relief: string; - }; - uniforms: { - bumpMap: Uniform; - map: Uniform; - parallaxScale: Uniform; - parallaxMinLayers: Uniform; - parallaxMaxLayers: Uniform; - }; - vertexShader: string; - fragmentShader: string; + modes: { + none: string; + basic: string; + steep: string; + occlusion: string; + relief: string; + }; + uniforms: { + bumpMap: Uniform; + map: Uniform; + parallaxScale: Uniform; + parallaxMinLayers: Uniform; + parallaxMaxLayers: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/ParallaxShader.js b/examples/jsm/shaders/ParallaxShader.js index 48c8f409e024327e0e0395011c7db2d2e6de032c..907b96a5475c134f6a979e859cdb83af7ea6304c 100644 --- a/examples/jsm/shaders/ParallaxShader.js +++ b/examples/jsm/shaders/ParallaxShader.js @@ -6,11 +6,11 @@ var ParallaxShader = { // Ordered from fastest to best quality. modes: { - none: 'NO_PARALLAX', - basic: 'USE_BASIC_PARALLAX', - steep: 'USE_STEEP_PARALLAX', - occlusion: 'USE_OCLUSION_PARALLAX', // a.k.a. POM - relief: 'USE_RELIEF_PARALLAX' + none: "NO_PARALLAX", + basic: "USE_BASIC_PARALLAX", + steep: "USE_STEEP_PARALLAX", + occlusion: "USE_OCLUSION_PARALLAX", // a.k.a. POM + relief: "USE_RELIEF_PARALLAX" }, uniforms: { @@ -36,7 +36,7 @@ var ParallaxShader = { "}" - ].join( "\n" ), + ].join( "\n" ), fragmentShader: [ "uniform sampler2D bumpMap;", @@ -56,10 +56,10 @@ var ParallaxShader = { " float initialHeight = texture2D( bumpMap, vUv ).r;", - // No Offset Limitting: messy, floating output at grazing angles. - //"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;", + // No Offset Limitting: messy, floating output at grazing angles. + //"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;", - // Offset Limiting + // Offset Limiting " vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;", " return vUv - texCoordOffset;", @@ -69,27 +69,27 @@ var ParallaxShader = { " vec2 parallaxMap( in vec3 V ) {", - // Determine number of layers from angle between V and N + // Determine number of layers from angle between V and N " float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );", " float layerHeight = 1.0 / numLayers;", " float currentLayerHeight = 0.0;", - // Shift of texture coordinates for each iteration + // Shift of texture coordinates for each iteration " vec2 dtex = parallaxScale * V.xy / V.z / numLayers;", " vec2 currentTextureCoords = vUv;", " float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", - // while ( heightFromTexture > currentLayerHeight ) - // Infinite loops are not well supported. Do a "large" finite - // loop, but not too large, as it slows down some compilers. + // while ( heightFromTexture > currentLayerHeight ) + // Infinite loops are not well supported. Do a "large" finite + // loop, but not too large, as it slows down some compilers. " for ( int i = 0; i < 30; i += 1 ) {", " if ( heightFromTexture <= currentLayerHeight ) {", " break;", " }", " currentLayerHeight += layerHeight;", - // Shift texture coordinates along vector V + // Shift texture coordinates along vector V " currentTextureCoords -= dtex;", " heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", " }", @@ -103,18 +103,18 @@ var ParallaxShader = { " vec2 deltaTexCoord = dtex / 2.0;", " float deltaHeight = layerHeight / 2.0;", - // Return to the mid point of previous layer + // Return to the mid point of previous layer " currentTextureCoords += deltaTexCoord;", " currentLayerHeight -= deltaHeight;", - // Binary search to increase precision of Steep Parallax Mapping + // Binary search to increase precision of Steep Parallax Mapping " const int numSearches = 5;", " for ( int i = 0; i < numSearches; i += 1 ) {", " deltaTexCoord /= 2.0;", " deltaHeight /= 2.0;", " heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;", - // Shift along or against vector V + // Shift along or against vector V " if( heightFromTexture > currentLayerHeight ) {", // Below the surface " currentTextureCoords -= deltaTexCoord;", @@ -134,14 +134,14 @@ var ParallaxShader = { " vec2 prevTCoords = currentTextureCoords + dtex;", - // Heights for linear interpolation + // Heights for linear interpolation " float nextH = heightFromTexture - currentLayerHeight;", " float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;", - // Proportions for linear interpolation + // Proportions for linear interpolation " float weight = nextH / ( nextH - prevH );", - // Interpolation of texture coordinates + // Interpolation of texture coordinates " return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );", " #else", // NO_PARALLAX @@ -179,7 +179,7 @@ var ParallaxShader = { "}" - ].join( "\n" ) + ].join( "\n" ) }; diff --git a/examples/jsm/shaders/PixelShader.d.ts b/examples/jsm/shaders/PixelShader.d.ts index 0eba68f26438caec53c74fa993f1861226aa8da6..4374577fc2e5e80719c82863559b8696105fa8f7 100644 --- a/examples/jsm/shaders/PixelShader.d.ts +++ b/examples/jsm/shaders/PixelShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const PixelShader: { - uniforms: { - tDiffuse: Uniform; - resolution: Uniform; - pixelSize: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + resolution: Uniform; + pixelSize: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/RGBShiftShader.d.ts b/examples/jsm/shaders/RGBShiftShader.d.ts index a45893d911a70f7bb4079ddaedbe955df02de37a..7da0b1bb4e4339f6f53a01df58aad84ab97f7e48 100644 --- a/examples/jsm/shaders/RGBShiftShader.d.ts +++ b/examples/jsm/shaders/RGBShiftShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const RGBShiftShader: { - uniforms: { - tDiffuse: Uniform; - amount: Uniform; - angle: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + amount: Uniform; + angle: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SAOShader.d.ts b/examples/jsm/shaders/SAOShader.d.ts index 86fbf665cfeb15ce0281bfb08d66c540158be3f8..bdeb287a13d8914dbc482059cf80b673e07b7fc5 100644 --- a/examples/jsm/shaders/SAOShader.d.ts +++ b/examples/jsm/shaders/SAOShader.d.ts @@ -1,32 +1,32 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SAOShader: { - defines: { - NUM_SAMPLES: number; - NUM_RINGS: number; - NORMAL_TEXTURE: number; - DIFFUSE_TEXTURE: number; - DEPTH_PACKING: number; - PERSPECTIVE_CAMERA: number; - }; - uniforms: { - tDepth: Uniform; - tDiffuse: Uniform; - tNormal: Uniform; - size: Uniform; - cameraNear: Uniform; - cameraFar: Uniform; - cameraProjectionMatrix: Uniform; - cameraInverseProjectionMatrix: Uniform; - scale: Uniform; - intensity: Uniform; - bias: Uniform; - minResolution: Uniform; - kernelRadius: Uniform; - randomSeed: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + NUM_SAMPLES: number; + NUM_RINGS: number; + NORMAL_TEXTURE: number; + DIFFUSE_TEXTURE: number; + DEPTH_PACKING: number; + PERSPECTIVE_CAMERA: number; + }; + uniforms: { + tDepth: Uniform; + tDiffuse: Uniform; + tNormal: Uniform; + size: Uniform; + cameraNear: Uniform; + cameraFar: Uniform; + cameraProjectionMatrix: Uniform; + cameraInverseProjectionMatrix: Uniform; + scale: Uniform; + intensity: Uniform; + bias: Uniform; + minResolution: Uniform; + kernelRadius: Uniform; + randomSeed: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SAOShader.js b/examples/jsm/shaders/SAOShader.js index 9d103743e0d064ee1258085f5c7f57b0a05b07a1..585d6d2d7dc6753b216e8a6d107bd4985553b294 100644 --- a/examples/jsm/shaders/SAOShader.js +++ b/examples/jsm/shaders/SAOShader.js @@ -9,32 +9,32 @@ import { var SAOShader = { defines: { - 'NUM_SAMPLES': 7, - 'NUM_RINGS': 4, - 'NORMAL_TEXTURE': 0, - 'DIFFUSE_TEXTURE': 0, - 'DEPTH_PACKING': 1, - 'PERSPECTIVE_CAMERA': 1 + "NUM_SAMPLES": 7, + "NUM_RINGS": 4, + "NORMAL_TEXTURE": 0, + "DIFFUSE_TEXTURE": 0, + "DEPTH_PACKING": 1, + "PERSPECTIVE_CAMERA": 1 }, uniforms: { - 'tDepth': { value: null }, - 'tDiffuse': { value: null }, - 'tNormal': { value: null }, - 'size': { value: new Vector2( 512, 512 ) }, + "tDepth": { value: null }, + "tDiffuse": { value: null }, + "tNormal": { value: null }, + "size": { value: new Vector2( 512, 512 ) }, - 'cameraNear': { value: 1 }, - 'cameraFar': { value: 100 }, - 'cameraProjectionMatrix': { value: new Matrix4() }, - 'cameraInverseProjectionMatrix': { value: new Matrix4() }, + "cameraNear": { value: 1 }, + "cameraFar": { value: 100 }, + "cameraProjectionMatrix": { value: new Matrix4() }, + "cameraInverseProjectionMatrix": { value: new Matrix4() }, - 'scale': { value: 1.0 }, - 'intensity': { value: 0.1 }, - 'bias': { value: 0.5 }, + "scale": { value: 1.0 }, + "intensity": { value: 0.1 }, + "bias": { value: 0.5 }, - 'minResolution': { value: 0.0 }, - 'kernelRadius': { value: 100.0 }, - 'randomSeed': { value: 0.0 } + "minResolution": { value: 0.0 }, + "kernelRadius": { value: 100.0 }, + "randomSeed": { value: 0.0 } }, vertexShader: [ "varying vec2 vUv;", diff --git a/examples/jsm/shaders/SMAAShader.d.ts b/examples/jsm/shaders/SMAAShader.d.ts index 861fc16f11f91add29a39e18738e223141d2573f..969637124708d4c50799fbbd203d02f26e422dfa 100644 --- a/examples/jsm/shaders/SMAAShader.d.ts +++ b/examples/jsm/shaders/SMAAShader.d.ts @@ -1,42 +1,42 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SMAAEdgesShader: { - defines: { - SMAA_THRESHOLD: string; - }, - uniforms: { - tDiffuse: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + SMAA_THRESHOLD: string; + }, + uniforms: { + tDiffuse: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SMAAWeightsShader: { - defines: { - SMAA_MAX_SEARCH_STEPS: string; - SMAA_AREATEX_MAX_DISTANCE: string; - SMAA_AREATEX_PIXEL_SIZE: string; - SMAA_AREATEX_SUBTEX_SIZE: string; - }, - uniforms: { - tDiffuse: Uniform; - tArea: Uniform; - tSearch: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + SMAA_MAX_SEARCH_STEPS: string; + SMAA_AREATEX_MAX_DISTANCE: string; + SMAA_AREATEX_PIXEL_SIZE: string; + SMAA_AREATEX_SUBTEX_SIZE: string; + }, + uniforms: { + tDiffuse: Uniform; + tArea: Uniform; + tSearch: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SMAABlendShader: { - uniforms: { - tDiffuse: Uniform; - tColor: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + tColor: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SMAAShader.js b/examples/jsm/shaders/SMAAShader.js index e97617ee811ad01c443860d7717bb9b9b988ff2c..ddc695c3753f9a8473205db511c6f4c951bb1c8a 100644 --- a/examples/jsm/shaders/SMAAShader.js +++ b/examples/jsm/shaders/SMAAShader.js @@ -33,18 +33,18 @@ var SMAAEdgesShader = { "varying vec4 vOffset[ 3 ];", "void SMAAEdgeDetectionVS( vec2 texcoord ) {", - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );", // WebGL port note: Changed sign in W component "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAAEdgeDetectionVS( vUv );", + " SMAAEdgeDetectionVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -58,60 +58,60 @@ var SMAAEdgesShader = { "varying vec4 vOffset[ 3 ];", "vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {", - "vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );", + " vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );", - // Calculate color deltas: - "vec4 delta;", - "vec3 C = texture2D( colorTex, texcoord ).rgb;", + // Calculate color deltas: + " vec4 delta;", + " vec3 C = texture2D( colorTex, texcoord ).rgb;", - "vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;", - "vec3 t = abs( C - Cleft );", - "delta.x = max( max( t.r, t.g ), t.b );", + " vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;", + " vec3 t = abs( C - Cleft );", + " delta.x = max( max( t.r, t.g ), t.b );", - "vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;", - "t = abs( C - Ctop );", - "delta.y = max( max( t.r, t.g ), t.b );", + " vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;", + " t = abs( C - Ctop );", + " delta.y = max( max( t.r, t.g ), t.b );", - // We do the usual threshold: - "vec2 edges = step( threshold, delta.xy );", + // We do the usual threshold: + " vec2 edges = step( threshold, delta.xy );", - // Then discard if there is no edge: - "if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )", - "discard;", + // Then discard if there is no edge: + " if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )", + " discard;", - // Calculate right and bottom deltas: - "vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;", - "t = abs( C - Cright );", - "delta.z = max( max( t.r, t.g ), t.b );", + // Calculate right and bottom deltas: + " vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;", + " t = abs( C - Cright );", + " delta.z = max( max( t.r, t.g ), t.b );", - "vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;", - "t = abs( C - Cbottom );", - "delta.w = max( max( t.r, t.g ), t.b );", + " vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;", + " t = abs( C - Cbottom );", + " delta.w = max( max( t.r, t.g ), t.b );", - // Calculate the maximum delta in the direct neighborhood: - "float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );", + // Calculate the maximum delta in the direct neighborhood: + " float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );", - // Calculate left-left and top-top deltas: - "vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;", - "t = abs( C - Cleftleft );", - "delta.z = max( max( t.r, t.g ), t.b );", + // Calculate left-left and top-top deltas: + " vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;", + " t = abs( C - Cleftleft );", + " delta.z = max( max( t.r, t.g ), t.b );", - "vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;", - "t = abs( C - Ctoptop );", - "delta.w = max( max( t.r, t.g ), t.b );", + " vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;", + " t = abs( C - Ctoptop );", + " delta.w = max( max( t.r, t.g ), t.b );", - // Calculate the final maximum delta: - "maxDelta = max( max( maxDelta, delta.z ), delta.w );", + // Calculate the final maximum delta: + " maxDelta = max( max( maxDelta, delta.z ), delta.w );", - // Local contrast adaptation in action: - "edges.xy *= step( 0.5 * maxDelta, delta.xy );", + // Local contrast adaptation in action: + " edges.xy *= step( 0.5 * maxDelta, delta.xy );", - "return vec4( edges, 0.0, 0.0 );", + " return vec4( edges, 0.0, 0.0 );", "}", "void main() {", - "gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );", + " gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );", "}" @@ -148,24 +148,24 @@ var SMAAWeightsShader = { "varying vec2 vPixcoord;", "void SMAABlendingWeightCalculationVS( vec2 texcoord ) {", - "vPixcoord = texcoord / resolution;", + " vPixcoord = texcoord / resolution;", - // We will use these offsets for the searches later on (see @PSEUDO_GATHER4): - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components + // We will use these offsets for the searches later on (see @PSEUDO_GATHER4): + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components - // And these for the searches, they indicate the ends of the loops: - "vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );", + // And these for the searches, they indicate the ends of the loops: + " vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );", "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAABlendingWeightCalculationVS( vUv );", + " SMAABlendingWeightCalculationVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -186,190 +186,190 @@ var SMAAWeightsShader = { "#if __VERSION__ == 100", "vec2 round( vec2 x ) {", - "return sign( x ) * floor( abs( x ) + 0.5 );", + " return sign( x ) * floor( abs( x ) + 0.5 );", "}", "#endif", "float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {", - // Not required if searchTex accesses are set to point: - // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0); - // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + - // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; - "e.r = bias + e.r * scale;", - "return 255.0 * texture2D( searchTex, e, 0.0 ).r;", + // Not required if searchTex accesses are set to point: + // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0); + // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + + // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; + " e.r = bias + e.r * scale;", + " return 255.0 * texture2D( searchTex, e, 0.0 ).r;", "}", "float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - /** + /** * @PSEUDO_GATHER4 * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to * sample between edge, thus fetching four edges in a row. * Sampling with different offsets in each direction allows to disambiguate * which edges are active from the four fetched ones. */ - "vec2 e = vec2( 0.0, 1.0 );", + " vec2 e = vec2( 0.0, 1.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord -= vec2( 2.0, 0.0 ) * resolution;", - "if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord -= vec2( 2.0, 0.0 ) * resolution;", + " if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;", + " }", - // We correct the previous (-0.25, -0.125) offset we applied: - "texcoord.x += 0.25 * resolution.x;", + // We correct the previous (-0.25, -0.125) offset we applied: + " texcoord.x += 0.25 * resolution.x;", - // The searches are bias by 1, so adjust the coords accordingly: - "texcoord.x += resolution.x;", + // The searches are bias by 1, so adjust the coords accordingly: + " texcoord.x += resolution.x;", - // Disambiguate the length added by the last step: - "texcoord.x += 2.0 * resolution.x;", // Undo last step - "texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);", + // Disambiguate the length added by the last step: + " texcoord.x += 2.0 * resolution.x;", // Undo last step + " texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);", - "return texcoord.x;", + " return texcoord.x;", "}", "float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 0.0, 1.0 );", + " vec2 e = vec2( 0.0, 1.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord += vec2( 2.0, 0.0 ) * resolution;", - "if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord += vec2( 2.0, 0.0 ) * resolution;", + " if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;", + " }", - "texcoord.x -= 0.25 * resolution.x;", - "texcoord.x -= resolution.x;", - "texcoord.x -= 2.0 * resolution.x;", - "texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );", + " texcoord.x -= 0.25 * resolution.x;", + " texcoord.x -= resolution.x;", + " texcoord.x -= 2.0 * resolution.x;", + " texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );", - "return texcoord.x;", + " return texcoord.x;", "}", "float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 1.0, 0.0 );", + " vec2 e = vec2( 1.0, 0.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign - "if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign + " if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;", + " }", - "texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign + " texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign - "return texcoord.y;", + " return texcoord.y;", "}", "float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {", - "vec2 e = vec2( 1.0, 0.0 );", + " vec2 e = vec2( 1.0, 0.0 );", - "for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for - "e = texture2D( edgesTex, texcoord, 0.0 ).rg;", - "texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign - "if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;", - "}", + " for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for + " e = texture2D( edgesTex, texcoord, 0.0 ).rg;", + " texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign + " if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;", + " }", - "texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y += resolution.y;", // WebGL port note: Changed sign - "texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign - "texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign + " texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y += resolution.y;", // WebGL port note: Changed sign + " texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign + " texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign - "return texcoord.y;", + " return texcoord.y;", "}", "vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {", - // Rounding prevents precision errors of bilinear filtering: - "vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;", + // Rounding prevents precision errors of bilinear filtering: + " vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;", - // We do a scale and bias for mapping to texel space: - "texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );", + // We do a scale and bias for mapping to texel space: + " texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );", - // Move to proper place, according to the subpixel offset: - "texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;", + // Move to proper place, according to the subpixel offset: + " texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;", - "return texture2D( areaTex, texcoord, 0.0 ).rg;", + " return texture2D( areaTex, texcoord, 0.0 ).rg;", "}", "vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {", - "vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );", + " vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );", - "vec2 e = texture2D( edgesTex, texcoord ).rg;", + " vec2 e = texture2D( edgesTex, texcoord ).rg;", - "if ( e.g > 0.0 ) {", // Edge at north - "vec2 d;", + " if ( e.g > 0.0 ) {", // Edge at north + " vec2 d;", - // Find the distance to the left: - "vec2 coords;", - "coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );", - "coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET) - "d.x = coords.x;", + // Find the distance to the left: + " vec2 coords;", + " coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );", + " coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET) + " d.x = coords.x;", - // Now fetch the left crossing edges, two at a time using bilinear - // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to - // discern what value each edge has: - "float e1 = texture2D( edgesTex, coords, 0.0 ).r;", + // Now fetch the left crossing edges, two at a time using bilinear + // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to + // discern what value each edge has: + " float e1 = texture2D( edgesTex, coords, 0.0 ).r;", - // Find the distance to the right: - "coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );", - "d.y = coords.x;", + // Find the distance to the right: + " coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );", + " d.y = coords.x;", - // We want the distances to be in pixel units (doing this here allow to - // better interleave arithmetic and memory accesses): - "d = d / resolution.x - pixcoord.x;", + // We want the distances to be in pixel units (doing this here allow to + // better interleave arithmetic and memory accesses): + " d = d / resolution.x - pixcoord.x;", - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - "vec2 sqrt_d = sqrt( abs( d ) );", + // SMAAArea below needs a sqrt, as the areas texture is compressed + // quadratically: + " vec2 sqrt_d = sqrt( abs( d ) );", - // Fetch the right crossing edges: - "coords.y -= 1.0 * resolution.y;", // WebGL port note: Added - "float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;", + // Fetch the right crossing edges: + " coords.y -= 1.0 * resolution.y;", // WebGL port note: Added + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;", - // Ok, we know how this pattern looks like, now it is time for getting - // the actual area: - "weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );", - "}", + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + " weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );", + " }", - "if ( e.r > 0.0 ) {", // Edge at west - "vec2 d;", + " if ( e.r > 0.0 ) {", // Edge at west + " vec2 d;", - // Find the distance to the top: - "vec2 coords;", + // Find the distance to the top: + " vec2 coords;", - "coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );", - "coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x; - "d.x = coords.y;", + " coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );", + " coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x; + " d.x = coords.y;", - // Fetch the top crossing edges: - "float e1 = texture2D( edgesTex, coords, 0.0 ).g;", + // Fetch the top crossing edges: + " float e1 = texture2D( edgesTex, coords, 0.0 ).g;", - // Find the distance to the bottom: - "coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );", - "d.y = coords.y;", + // Find the distance to the bottom: + " coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );", + " d.y = coords.y;", - // We want the distances to be in pixel units: - "d = d / resolution.y - pixcoord.y;", + // We want the distances to be in pixel units: + " d = d / resolution.y - pixcoord.y;", - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - "vec2 sqrt_d = sqrt( abs( d ) );", + // SMAAArea below needs a sqrt, as the areas texture is compressed + // quadratically: + " vec2 sqrt_d = sqrt( abs( d ) );", - // Fetch the bottom crossing edges: - "coords.y -= 1.0 * resolution.y;", // WebGL port note: Added - "float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;", + // Fetch the bottom crossing edges: + " coords.y -= 1.0 * resolution.y;", // WebGL port note: Added + " float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;", - // Get the area for this direction: - "weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );", - "}", + // Get the area for this direction: + " weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );", + " }", - "return weights;", + " return weights;", "}", "void main() {", - "gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );", + " gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );", "}" @@ -395,17 +395,17 @@ var SMAABlendShader = { "varying vec4 vOffset[ 2 ];", "void SMAANeighborhoodBlendingVS( vec2 texcoord ) {", - "vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component - "vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component + " vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component "}", "void main() {", - "vUv = uv;", + " vUv = uv;", - "SMAANeighborhoodBlendingVS( vUv );", + " SMAANeighborhoodBlendingVS( vUv );", - "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}" @@ -421,49 +421,49 @@ var SMAABlendShader = { "varying vec4 vOffset[ 2 ];", "vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {", - // Fetch the blending weights for current pixel: - "vec4 a;", - "a.xz = texture2D( blendTex, texcoord ).xz;", - "a.y = texture2D( blendTex, offset[ 1 ].zw ).g;", - "a.w = texture2D( blendTex, offset[ 1 ].xy ).a;", - - // Is there any blending weight with a value greater than 0.0? - "if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {", - "return texture2D( colorTex, texcoord, 0.0 );", - "} else {", - // Up to 4 lines can be crossing a pixel (one through each edge). We - // favor blending by choosing the line with the maximum weight for each - // direction: - "vec2 offset;", - "offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right - "offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs - - // Then we go in the direction that has the maximum weight: - "if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical - "offset.y = 0.0;", - "} else {", - "offset.x = 0.0;", - "}", - - // Fetch the opposite color and lerp by hand: - "vec4 C = texture2D( colorTex, texcoord, 0.0 );", - "texcoord += sign( offset ) * resolution;", - "vec4 Cop = texture2D( colorTex, texcoord, 0.0 );", - "float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );", - - // WebGL port note: Added gamma correction - "C.xyz = pow(C.xyz, vec3(2.2));", - "Cop.xyz = pow(Cop.xyz, vec3(2.2));", - "vec4 mixed = mix(C, Cop, s);", - "mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));", - - "return mixed;", - "}", + // Fetch the blending weights for current pixel: + " vec4 a;", + " a.xz = texture2D( blendTex, texcoord ).xz;", + " a.y = texture2D( blendTex, offset[ 1 ].zw ).g;", + " a.w = texture2D( blendTex, offset[ 1 ].xy ).a;", + + // Is there any blending weight with a value greater than 0.0? + " if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {", + " return texture2D( colorTex, texcoord, 0.0 );", + " } else {", + // Up to 4 lines can be crossing a pixel (one through each edge). We + // favor blending by choosing the line with the maximum weight for each + // direction: + " vec2 offset;", + " offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right + " offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs + + // Then we go in the direction that has the maximum weight: + " if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical + " offset.y = 0.0;", + " } else {", + " offset.x = 0.0;", + " }", + + // Fetch the opposite color and lerp by hand: + " vec4 C = texture2D( colorTex, texcoord, 0.0 );", + " texcoord += sign( offset ) * resolution;", + " vec4 Cop = texture2D( colorTex, texcoord, 0.0 );", + " float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );", + + // WebGL port note: Added gamma correction + " C.xyz = pow(C.xyz, vec3(2.2));", + " Cop.xyz = pow(Cop.xyz, vec3(2.2));", + " vec4 mixed = mix(C, Cop, s);", + " mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));", + + " return mixed;", + " }", "}", "void main() {", - "gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );", + " gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );", "}" diff --git a/examples/jsm/shaders/SSAOShader.d.ts b/examples/jsm/shaders/SSAOShader.d.ts index 56130a5f1e5ceab83f81787ec4f089e8ffba7ddc..817d8f9821e5fdf1b2dd366de0c0bc9d6a009eab 100644 --- a/examples/jsm/shaders/SSAOShader.d.ts +++ b/examples/jsm/shaders/SSAOShader.d.ts @@ -1,49 +1,49 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SSAOShader: { - defines: { - PERSPECTIVE_CAMERA: number; - KERNEL_SIZE: number; - }; - uniforms: { - tDiffuse: Uniform; - tNormal: Uniform; - tDepth: Uniform; - tNoise: Uniform; - kernel: Uniform; - cameraNear: Uniform; - cameraFar: Uniform; - resolution: Uniform; - cameraProjectionMatrix: Uniform; - cameraInverseProjectionMatrix: Uniform; - kernelRadius: Uniform; - minDistance: Uniform; - maxDistance: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + PERSPECTIVE_CAMERA: number; + KERNEL_SIZE: number; + }; + uniforms: { + tDiffuse: Uniform; + tNormal: Uniform; + tDepth: Uniform; + tNoise: Uniform; + kernel: Uniform; + cameraNear: Uniform; + cameraFar: Uniform; + resolution: Uniform; + cameraProjectionMatrix: Uniform; + cameraInverseProjectionMatrix: Uniform; + kernelRadius: Uniform; + minDistance: Uniform; + maxDistance: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SSAODepthShader: { - defines: { - PERSPECTIVE_CAMERA: number; - }; - uniforms: { - tDepth: Uniform; - cameraNear: Uniform; - cameraFar: Uniform; - }; - vertexShader: string; - fragmentShader: string; + defines: { + PERSPECTIVE_CAMERA: number; + }; + uniforms: { + tDepth: Uniform; + cameraNear: Uniform; + cameraFar: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SSAOBlurShader: { - uniforms: { - tDiffuse: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SepiaShader.d.ts b/examples/jsm/shaders/SepiaShader.d.ts index 56bc8ca2d38fcf509ba616e0a88812cceaa0da82..23ed3598e4be0fbc90af3b73d2c886c3f19292cc 100644 --- a/examples/jsm/shaders/SepiaShader.d.ts +++ b/examples/jsm/shaders/SepiaShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SepiaShader: { - uniforms: { - tDiffuse: Uniform; - amount: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + amount: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SkinShader.d.ts b/examples/jsm/shaders/SkinShader.d.ts index 88144bbf37df30c64015a241adac9f3ae76f1c96..04c6a6fb9035b757379383cba1c6df875337141e 100644 --- a/examples/jsm/shaders/SkinShader.d.ts +++ b/examples/jsm/shaders/SkinShader.d.ts @@ -1,85 +1,85 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SkinShaderBasic: { - uniforms: { - ambientLightColor: Uniform; - bumpMap: Uniform; - bumpScale: Uniform; - diffuse: Uniform; - directionalLights: Uniform; - directionalShadowMap: Uniform; - directionalShadowMatrix: Uniform; - enableBump: Uniform; - enableSpecular: Uniform; - fogColor: Uniform; - fogDensity: Uniform; - fogFar: Uniform; - fogNear: Uniform; - hemisphereLights: Uniform; - lightProbe: Uniform; - offsetRepeat: Uniform; - opacity: Uniform; - pointLights: Uniform; - pointShadowMap: Uniform; - pointShadowMatrix: Uniform; - rectAreaLights: Uniform; - specular: Uniform; - specularMap: Uniform; - spotLights: Uniform; - spotShadowMap: Uniform; - spotShadowMatrix: Uniform; - tBeckmann: Uniform; - tDiffuse: Uniform; - uRoughness: Uniform; - uSpecularBrightness: Uniform; - uWrapRGB: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + ambientLightColor: Uniform; + bumpMap: Uniform; + bumpScale: Uniform; + diffuse: Uniform; + directionalLights: Uniform; + directionalShadowMap: Uniform; + directionalShadowMatrix: Uniform; + enableBump: Uniform; + enableSpecular: Uniform; + fogColor: Uniform; + fogDensity: Uniform; + fogFar: Uniform; + fogNear: Uniform; + hemisphereLights: Uniform; + lightProbe: Uniform; + offsetRepeat: Uniform; + opacity: Uniform; + pointLights: Uniform; + pointShadowMap: Uniform; + pointShadowMatrix: Uniform; + rectAreaLights: Uniform; + specular: Uniform; + specularMap: Uniform; + spotLights: Uniform; + spotShadowMap: Uniform; + spotShadowMatrix: Uniform; + tBeckmann: Uniform; + tDiffuse: Uniform; + uRoughness: Uniform; + uSpecularBrightness: Uniform; + uWrapRGB: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SkinShaderAdvanced: { - uniforms: { - ambientLightColor: Uniform; - diffuse: Uniform; - directionalLights: Uniform; - directionalShadowMap: Uniform; - directionalShadowMatrix: Uniform; - fogColor: Uniform; - fogDensity: Uniform; - fogFar: Uniform; - fogNear: Uniform; - hemisphereLights: Uniform; - lightProbe: Uniform; - opacity: Uniform; - passID: Uniform; - pointLights: Uniform; - pointShadowMap: Uniform; - pointShadowMatrix: Uniform; - rectAreaLights: Uniform; - specular: Uniform; - spotLights: Uniform; - spotShadowMap: Uniform; - spotShadowMatrix: Uniform; - tBeckmann: Uniform; - tBlur1: Uniform; - tBlur2: Uniform; - tBlur3: Uniform; - tBlur4: Uniform; - tDiffuse: Uniform; - tNormal: Uniform; - uNormalScale: Uniform; - uRoughness: Uniform; - uSpecularBrightness: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + ambientLightColor: Uniform; + diffuse: Uniform; + directionalLights: Uniform; + directionalShadowMap: Uniform; + directionalShadowMatrix: Uniform; + fogColor: Uniform; + fogDensity: Uniform; + fogFar: Uniform; + fogNear: Uniform; + hemisphereLights: Uniform; + lightProbe: Uniform; + opacity: Uniform; + passID: Uniform; + pointLights: Uniform; + pointShadowMap: Uniform; + pointShadowMatrix: Uniform; + rectAreaLights: Uniform; + specular: Uniform; + spotLights: Uniform; + spotShadowMap: Uniform; + spotShadowMatrix: Uniform; + tBeckmann: Uniform; + tBlur1: Uniform; + tBlur2: Uniform; + tBlur3: Uniform; + tBlur4: Uniform; + tDiffuse: Uniform; + tNormal: Uniform; + uNormalScale: Uniform; + uRoughness: Uniform; + uSpecularBrightness: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const SkinShaderBeckmann: { - uniforms: {}; - vertexShader: string; - fragmentShader: string; + uniforms: {}; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SobelOperatorShader.d.ts b/examples/jsm/shaders/SobelOperatorShader.d.ts index 19fa036be09c965bca48ad0c0384ffb5b8ef0d0e..7a20e8f2d14012f2a3fd38dd165beca1f51224c8 100644 --- a/examples/jsm/shaders/SobelOperatorShader.d.ts +++ b/examples/jsm/shaders/SobelOperatorShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const SobelOperatorShader: { - uniforms: { - tDiffuse: Uniform; - resolution: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + resolution: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/SobelOperatorShader.js b/examples/jsm/shaders/SobelOperatorShader.js index 94cc0861d164a0f19fcbd8fe92e47239c209df82..644adca20f2238b9705f560ad452aa2e07bb6326 100644 --- a/examples/jsm/shaders/SobelOperatorShader.js +++ b/examples/jsm/shaders/SobelOperatorShader.js @@ -44,44 +44,44 @@ var SobelOperatorShader = { " vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );", - // kernel definition (in glsl matrices are filled in column-major order) + // kernel definition (in glsl matrices are filled in column-major order) " const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel " const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel - // fetch the 3x3 neighbourhood of a fragment + // fetch the 3x3 neighbourhood of a fragment - // first column + // first column " float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;", " float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;", " float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;", - // second column + // second column " float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;", " float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;", " float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;", - // third column + // third column " float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;", " float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;", " float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;", - // gradient value in x direction + // gradient value in x direction " float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ", " Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ", " Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ", - // gradient value in y direction + // gradient value in y direction " float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ", " Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ", " Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ", - // magnitute of the total gradient + // magnitute of the total gradient " float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );", diff --git a/examples/jsm/shaders/TechnicolorShader.d.ts b/examples/jsm/shaders/TechnicolorShader.d.ts index da95ad326a43454aabd1628ce38df9e9c545be76..2b3cc5b0e268451db35562132e56362ab364b42e 100644 --- a/examples/jsm/shaders/TechnicolorShader.d.ts +++ b/examples/jsm/shaders/TechnicolorShader.d.ts @@ -1,11 +1,11 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const TechnicolorShader: { - uniforms: { - tDiffuse: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/TerrainShader.d.ts b/examples/jsm/shaders/TerrainShader.d.ts index 5db6fdd6803ad6b1919ef45e253e3c3b93d94845..0e5c529e68a3c54421bc59287993d0f07b60b626 100644 --- a/examples/jsm/shaders/TerrainShader.d.ts +++ b/examples/jsm/shaders/TerrainShader.d.ts @@ -1,47 +1,47 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const TerrainShader: { - uniforms: { - ambientLightColor: Uniform; - diffuse: Uniform; - directionalLights: Uniform; - directionalShadowMap: Uniform; - directionalShadowMatrix: Uniform; - enableDiffuse1: Uniform; - enableDiffuse2: Uniform; - enableReflection: Uniform; - enableSpecular: Uniform; - fogColor: Uniform; - fogDensity: Uniform; - fogFar: Uniform; - fogNear: Uniform; - hemisphereLights: Uniform; - lightProbe: Uniform; - opacity: Uniform; - pointLights: Uniform; - pointShadowMap: Uniform; - pointShadowMatrix: Uniform; - rectAreaLights: Uniform; - shininess: Uniform; - specular: Uniform; - spotLights: Uniform; - spotShadowMap: Uniform; - spotShadowMatrix: Uniform; - tDetail: Uniform; - tDiffuse1: Uniform; - tDiffuse2: Uniform; - tDisplacement: Uniform; - tNormal: Uniform; - tSpecular: Uniform; - uDisplacementBias: Uniform; - uDisplacementScale: Uniform; - uNormalScale: Uniform; - uOffset: Uniform; - uRepeatBase: Uniform; - uRepeatOverlay: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + ambientLightColor: Uniform; + diffuse: Uniform; + directionalLights: Uniform; + directionalShadowMap: Uniform; + directionalShadowMatrix: Uniform; + enableDiffuse1: Uniform; + enableDiffuse2: Uniform; + enableReflection: Uniform; + enableSpecular: Uniform; + fogColor: Uniform; + fogDensity: Uniform; + fogFar: Uniform; + fogNear: Uniform; + hemisphereLights: Uniform; + lightProbe: Uniform; + opacity: Uniform; + pointLights: Uniform; + pointShadowMap: Uniform; + pointShadowMatrix: Uniform; + rectAreaLights: Uniform; + shininess: Uniform; + specular: Uniform; + spotLights: Uniform; + spotShadowMap: Uniform; + spotShadowMatrix: Uniform; + tDetail: Uniform; + tDiffuse1: Uniform; + tDiffuse2: Uniform; + tDisplacement: Uniform; + tNormal: Uniform; + tSpecular: Uniform; + uDisplacementBias: Uniform; + uDisplacementScale: Uniform; + uNormalScale: Uniform; + uOffset: Uniform; + uRepeatBase: Uniform; + uRepeatOverlay: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/TerrainShader.js b/examples/jsm/shaders/TerrainShader.js index ac95d558c87f5253284a7d83b9474b4719cdc7f8..70fb0b852a44adc1d9e45c78f1abc1e514bf0cd6 100644 --- a/examples/jsm/shaders/TerrainShader.js +++ b/examples/jsm/shaders/TerrainShader.js @@ -150,7 +150,7 @@ var TerrainShader = { " vec3 totalDiffuseLight = vec3( 0.0 );", " vec3 totalSpecularLight = vec3( 0.0 );", - // point lights + // point lights " #if NUM_POINT_LIGHTS > 0", @@ -176,7 +176,7 @@ var TerrainShader = { " #endif", - // directional lights + // directional lights " #if NUM_DIR_LIGHTS > 0", @@ -200,7 +200,7 @@ var TerrainShader = { " #endif", - // hemisphere lights + // hemisphere lights " #if NUM_HEMI_LIGHTS > 0", @@ -211,14 +211,14 @@ var TerrainShader = { " vec3 lVector = hemisphereLightDirection[ i ];", - // diffuse + // diffuse " float dotProduct = dot( normal, lVector );", " float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;", " totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );", - // specular (sky light) + // specular (sky light) " float hemiSpecularWeight = 0.0;", @@ -226,7 +226,7 @@ var TerrainShader = { " float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;", " hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );", - // specular (ground light) + // specular (ground light) " vec3 lVectorGround = -lVector;", @@ -244,7 +244,7 @@ var TerrainShader = { " gl_FragColor = vec4( outgoingLight, diffuseColor.a );", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects - ShaderChunk[ "fog_fragment" ], + ShaderChunk[ "fog_fragment" ], "}" @@ -280,20 +280,20 @@ var TerrainShader = { " vNormal = normalize( normalMatrix * normal );", - // tangent and binormal vectors + // tangent and binormal vectors " vTangent = normalize( normalMatrix * tangent.xyz );", " vBinormal = cross( vNormal, vTangent ) * tangent.w;", " vBinormal = normalize( vBinormal );", - // texture coordinates + // texture coordinates " vUv = uv;", " vec2 uvBase = uv * uRepeatBase;", - // displacement mapping + // displacement mapping " #ifdef VERTEX_TEXTURES", @@ -318,8 +318,8 @@ var TerrainShader = { " vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;", " vNormal = normalMatrix * normalTex;", - ShaderChunk[ "shadowmap_vertex" ], - ShaderChunk[ "fog_vertex" ], + ShaderChunk[ "shadowmap_vertex" ], + ShaderChunk[ "fog_vertex" ], "}" diff --git a/examples/jsm/shaders/ToneMapShader.d.ts b/examples/jsm/shaders/ToneMapShader.d.ts index 3cd3ceb156169ce9c2f5bbf44038b38f85740981..b8785923202d4bc9debd4df958493da685a11118 100644 --- a/examples/jsm/shaders/ToneMapShader.d.ts +++ b/examples/jsm/shaders/ToneMapShader.d.ts @@ -1,16 +1,16 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ToneMapShader: { - uniforms: { - tDiffuse: Uniform; - averageLuminance: Uniform; - luminanceMap: Uniform; - maxLuminance: Uniform; - minLuminance: Uniform; - middleGrey: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + averageLuminance: Uniform; + luminanceMap: Uniform; + maxLuminance: Uniform; + minLuminance: Uniform; + middleGrey: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/ToneMapShader.js b/examples/jsm/shaders/ToneMapShader.js index 9e0402fd062dd2cf64665744b9cfd4ec6abe226c..6dc9746a463a92bc3ad914c0f4de7486da8680a8 100644 --- a/examples/jsm/shaders/ToneMapShader.js +++ b/examples/jsm/shaders/ToneMapShader.js @@ -50,16 +50,16 @@ var ToneMapShader = { "vec3 ToneMap( vec3 vColor ) {", " #ifdef ADAPTED_LUMINANCE", - // Get the calculated average luminance + // Get the calculated average luminance " float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;", " #else", " float fLumAvg = averageLuminance;", " #endif", - // Calculate the luminance of the current pixel + // Calculate the luminance of the current pixel " float fLumPixel = linearToRelativeLuminance( vColor );", - // Apply the modified operator (Eq. 4) + // Apply the modified operator (Eq. 4) " float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );", " float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);", diff --git a/examples/jsm/shaders/ToonShader.d.ts b/examples/jsm/shaders/ToonShader.d.ts index 00684a73bf86fb8ad1922063a7182a253b330419..c190f37b8f1818ee643610e4085348ba91c88634 100644 --- a/examples/jsm/shaders/ToonShader.d.ts +++ b/examples/jsm/shaders/ToonShader.d.ts @@ -1,56 +1,56 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const ToonShader1: { - uniforms: { - uDirLightPos: Uniform; - uDirLightColor: Uniform; - uAmbientLightColor: Uniform; - uBaseColor: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + uDirLightPos: Uniform; + uDirLightColor: Uniform; + uAmbientLightColor: Uniform; + uBaseColor: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const ToonShader2: { - uniforms: { - uDirLightPos: Uniform; - uDirLightColor: Uniform; - uAmbientLightColor: Uniform; - uBaseColor: Uniform; - uLineColor1: Uniform; - uLineColor2: Uniform; - uLineColor3: Uniform; - uLineColor4: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + uDirLightPos: Uniform; + uDirLightColor: Uniform; + uAmbientLightColor: Uniform; + uBaseColor: Uniform; + uLineColor1: Uniform; + uLineColor2: Uniform; + uLineColor3: Uniform; + uLineColor4: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const ToonShaderHatching: { - uniforms: { - uDirLightPos: Uniform; - uDirLightColor: Uniform; - uAmbientLightColor: Uniform; - uBaseColor: Uniform; + uniforms: { + uDirLightPos: Uniform; + uDirLightColor: Uniform; + uAmbientLightColor: Uniform; + uBaseColor: Uniform; uLineColor1: Uniform; - uLineColor2: Uniform; - uLineColor3: Uniform; - uLineColor4: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uLineColor2: Uniform; + uLineColor3: Uniform; + uLineColor4: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; export const ToonShaderDotted: { - uniforms: { - uDirLightPos: Uniform; - uDirLightColor: Uniform; - uAmbientLightColor: Uniform; - uBaseColor: Uniform; - uLineColor1: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + uDirLightPos: Uniform; + uDirLightColor: Uniform; + uAmbientLightColor: Uniform; + uBaseColor: Uniform; + uLineColor1: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/TranslucentShader.d.ts b/examples/jsm/shaders/TranslucentShader.d.ts index 9133314fca847e5023d2d2cd4a465224686a8a29..326990d8bc6dd21b4fe5cd13aa5ab824df787fa4 100644 --- a/examples/jsm/shaders/TranslucentShader.d.ts +++ b/examples/jsm/shaders/TranslucentShader.d.ts @@ -1,39 +1,39 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const TranslucentShader: { - uniforms: { - alphaMap: Uniform; - ambientLightColor: Uniform; - color: Uniform; - diffuse: Uniform; - directionalLights: Uniform; - directionalShadowMap: Uniform; - directionalShadowMatrix: Uniform; - emissive: Uniform; - hemisphereLights: Uniform; - lightProbe: Uniform; - map: Uniform; - opacity: Uniform; - pointLights: Uniform; - pointShadowMap: Uniform; - pointShadowMatrix: Uniform; - rectAreaLights: Uniform; - shininess: Uniform; - specular: Uniform; - spotLights: Uniform; - spotShadowMap: Uniform; - spotShadowMatrix: Uniform; - thicknessAmbient: Uniform; - thicknessAttenuation: Uniform; - thicknessColor: Uniform; - thicknessDistortion: Uniform; - thicknessMap: Uniform; - thicknessPower: Uniform; - thicknessScale: Uniform; - uvTransform: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + alphaMap: Uniform; + ambientLightColor: Uniform; + color: Uniform; + diffuse: Uniform; + directionalLights: Uniform; + directionalShadowMap: Uniform; + directionalShadowMatrix: Uniform; + emissive: Uniform; + hemisphereLights: Uniform; + lightProbe: Uniform; + map: Uniform; + opacity: Uniform; + pointLights: Uniform; + pointShadowMap: Uniform; + pointShadowMatrix: Uniform; + rectAreaLights: Uniform; + shininess: Uniform; + specular: Uniform; + spotLights: Uniform; + spotShadowMap: Uniform; + spotShadowMatrix: Uniform; + thicknessAmbient: Uniform; + thicknessAttenuation: Uniform; + thicknessColor: Uniform; + thicknessDistortion: Uniform; + thicknessMap: Uniform; + thicknessPower: Uniform; + thicknessScale: Uniform; + uvTransform: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/TriangleBlurShader.d.ts b/examples/jsm/shaders/TriangleBlurShader.d.ts index 3d048cb7132a7d3dff97c696689e4900ec914785..02fb1efdac5f1e92b09c88d97c555948a9e6d198 100644 --- a/examples/jsm/shaders/TriangleBlurShader.d.ts +++ b/examples/jsm/shaders/TriangleBlurShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const TriangleBlurShader: { - uniforms: { - texture: Uniform; - delta: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + texture: Uniform; + delta: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/TriangleBlurShader.js b/examples/jsm/shaders/TriangleBlurShader.js index 773a90d5104668c53bfaf2a39462cdb2562d71be..7e587378bdeb3a3b8e9c3b04a013de151ee46a0b 100644 --- a/examples/jsm/shaders/TriangleBlurShader.js +++ b/examples/jsm/shaders/TriangleBlurShader.js @@ -53,7 +53,7 @@ var TriangleBlurShader = { " float total = 0.0;", - // randomize the lookup values to hide the fixed number of samples + // randomize the lookup values to hide the fixed number of samples " float offset = rand( vUv );", diff --git a/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts b/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts index 6a714daccb2bc1e833dbb38abd928adf67198ce8..cf38201fac66189b372262d494b6e7d1de81471b 100644 --- a/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +++ b/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const UnpackDepthRGBAShader: { - uniforms: { - tDiffuse: Uniform; - opacity: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + opacity: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/VerticalBlurShader.d.ts b/examples/jsm/shaders/VerticalBlurShader.d.ts index 503e0f1643a815e8d153bc805009b0ad4eb0c4ff..a6d3a55d93097f4fbdd53e4775db9db182941b58 100644 --- a/examples/jsm/shaders/VerticalBlurShader.d.ts +++ b/examples/jsm/shaders/VerticalBlurShader.d.ts @@ -1,12 +1,12 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const VerticalBlurShader: { - uniforms: { - tDiffuse: Uniform; - v: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + v: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/VerticalTiltShiftShader.d.ts b/examples/jsm/shaders/VerticalTiltShiftShader.d.ts index 3f570ea0beff5ca443efab98d900cc2af429d28a..ffb8cc62a888a2d1194191075e4cd47193a77e5a 100644 --- a/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +++ b/examples/jsm/shaders/VerticalTiltShiftShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const VerticalTiltShiftShader: { - uniforms: { - tDiffuse: Uniform; - v: Uniform; - r: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + v: Uniform; + r: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/VignetteShader.d.ts b/examples/jsm/shaders/VignetteShader.d.ts index 9e52995f168693f42a6b704a866c5674a5425aa1..1319966a32a743850ca4c1c16220950b30b842a1 100644 --- a/examples/jsm/shaders/VignetteShader.d.ts +++ b/examples/jsm/shaders/VignetteShader.d.ts @@ -1,13 +1,13 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const VignetteShader: { - uniforms: { - tDiffuse: Uniform; - offset: Uniform; - darkness: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + tDiffuse: Uniform; + offset: Uniform; + darkness: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/VignetteShader.js b/examples/jsm/shaders/VignetteShader.js index 29cd6aefb9a68ee9b46562dc2ae34d942dfd0f34..77b8cf06a5cec62d666026d68ac833764d42317e 100644 --- a/examples/jsm/shaders/VignetteShader.js +++ b/examples/jsm/shaders/VignetteShader.js @@ -42,7 +42,7 @@ var VignetteShader = { "void main() {", - // Eskil's vignette + // Eskil's vignette " vec4 texel = texture2D( tDiffuse, vUv );", " vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", diff --git a/examples/jsm/shaders/VolumeShader.d.ts b/examples/jsm/shaders/VolumeShader.d.ts index 048c410b97763161c2f5ffe04ad8762b9413e4b5..db44729398b7f53ba520df28fe9642a457336cea 100644 --- a/examples/jsm/shaders/VolumeShader.d.ts +++ b/examples/jsm/shaders/VolumeShader.d.ts @@ -1,16 +1,16 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const VolumeShader: { - uniforms: { - u_size: Uniform; - u_renderstyle: Uniform; - u_renderthreshold: Uniform; - u_clim: Uniform; - u_data: Uniform; - u_cmdata: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + u_size: Uniform; + u_renderstyle: Uniform; + u_renderthreshold: Uniform; + u_clim: Uniform; + u_data: Uniform; + u_cmdata: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/VolumeShader.js b/examples/jsm/shaders/VolumeShader.js index f05098ff269debff7a310425c720c349367edabf..37a26c2b3377ec8fb6f7deb3f24ec9403a64125b 100644 --- a/examples/jsm/shaders/VolumeShader.js +++ b/examples/jsm/shaders/VolumeShader.js @@ -13,319 +13,319 @@ import { var VolumeRenderShader1 = { uniforms: { - "u_size": { value: new Vector3( 1, 1, 1 ) }, - "u_renderstyle": { value: 0 }, - "u_renderthreshold": { value: 0.5 }, - "u_clim": { value: new Vector2( 1, 1 ) }, - "u_data": { value: null }, - "u_cmdata": { value: null } - }, - vertexShader: [ - 'varying vec4 v_nearpos;', - 'varying vec4 v_farpos;', - 'varying vec3 v_position;', - - 'mat4 inversemat(mat4 m) {', - // Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl - // This function is licenced by the MIT license to Mikola Lysenko - 'float', - 'a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],', - 'a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],', - 'a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],', - 'a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],', - - 'b00 = a00 * a11 - a01 * a10,', - 'b01 = a00 * a12 - a02 * a10,', - 'b02 = a00 * a13 - a03 * a10,', - 'b03 = a01 * a12 - a02 * a11,', - 'b04 = a01 * a13 - a03 * a11,', - 'b05 = a02 * a13 - a03 * a12,', - 'b06 = a20 * a31 - a21 * a30,', - 'b07 = a20 * a32 - a22 * a30,', - 'b08 = a20 * a33 - a23 * a30,', - 'b09 = a21 * a32 - a22 * a31,', - 'b10 = a21 * a33 - a23 * a31,', - 'b11 = a22 * a33 - a23 * a32,', - - 'det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;', - - 'return mat4(', - 'a11 * b11 - a12 * b10 + a13 * b09,', - 'a02 * b10 - a01 * b11 - a03 * b09,', - 'a31 * b05 - a32 * b04 + a33 * b03,', - 'a22 * b04 - a21 * b05 - a23 * b03,', - 'a12 * b08 - a10 * b11 - a13 * b07,', - 'a00 * b11 - a02 * b08 + a03 * b07,', - 'a32 * b02 - a30 * b05 - a33 * b01,', - 'a20 * b05 - a22 * b02 + a23 * b01,', - 'a10 * b10 - a11 * b08 + a13 * b06,', - 'a01 * b08 - a00 * b10 - a03 * b06,', - 'a30 * b04 - a31 * b02 + a33 * b00,', - 'a21 * b02 - a20 * b04 - a23 * b00,', - 'a11 * b07 - a10 * b09 - a12 * b06,', - 'a00 * b09 - a01 * b07 + a02 * b06,', - 'a31 * b01 - a30 * b03 - a32 * b00,', - 'a20 * b03 - a21 * b01 + a22 * b00) / det;', - '}', - - - 'void main() {', - // Prepare transforms to map to "camera view". See also: - // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram - 'mat4 viewtransformf = viewMatrix;', - 'mat4 viewtransformi = inversemat(viewMatrix);', - - // Project local vertex coordinate to camera position. Then do a step - // backward (in cam coords) to the near clipping plane, and project back. Do - // the same for the far clipping plane. This gives us all the information we - // need to calculate the ray and truncate it to the viewing cone. - 'vec4 position4 = vec4(position, 1.0);', - 'vec4 pos_in_cam = viewtransformf * position4;', - - // Intersection of ray and near clipping plane (z = -1 in clip coords) - 'pos_in_cam.z = -pos_in_cam.w;', - 'v_nearpos = viewtransformi * pos_in_cam;', - - // Intersection of ray and far clipping plane (z = +1 in clip coords) - 'pos_in_cam.z = pos_in_cam.w;', - 'v_farpos = viewtransformi * pos_in_cam;', - - // Set varyings and output pos - 'v_position = position;', - 'gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;', - '}', - ].join( '\n' ), + "u_size": { value: new Vector3( 1, 1, 1 ) }, + "u_renderstyle": { value: 0 }, + "u_renderthreshold": { value: 0.5 }, + "u_clim": { value: new Vector2( 1, 1 ) }, + "u_data": { value: null }, + "u_cmdata": { value: null } + }, + vertexShader: [ + " varying vec4 v_nearpos;", + " varying vec4 v_farpos;", + " varying vec3 v_position;", + + " mat4 inversemat(mat4 m) {", + // Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl + // This function is licenced by the MIT license to Mikola Lysenko + " float", + " a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],", + " a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],", + " a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],", + " a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],", + + " b00 = a00 * a11 - a01 * a10,", + " b01 = a00 * a12 - a02 * a10,", + " b02 = a00 * a13 - a03 * a10,", + " b03 = a01 * a12 - a02 * a11,", + " b04 = a01 * a13 - a03 * a11,", + " b05 = a02 * a13 - a03 * a12,", + " b06 = a20 * a31 - a21 * a30,", + " b07 = a20 * a32 - a22 * a30,", + " b08 = a20 * a33 - a23 * a30,", + " b09 = a21 * a32 - a22 * a31,", + " b10 = a21 * a33 - a23 * a31,", + " b11 = a22 * a33 - a23 * a32,", + + " det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;", + + " return mat4(", + " a11 * b11 - a12 * b10 + a13 * b09,", + " a02 * b10 - a01 * b11 - a03 * b09,", + " a31 * b05 - a32 * b04 + a33 * b03,", + " a22 * b04 - a21 * b05 - a23 * b03,", + " a12 * b08 - a10 * b11 - a13 * b07,", + " a00 * b11 - a02 * b08 + a03 * b07,", + " a32 * b02 - a30 * b05 - a33 * b01,", + " a20 * b05 - a22 * b02 + a23 * b01,", + " a10 * b10 - a11 * b08 + a13 * b06,", + " a01 * b08 - a00 * b10 - a03 * b06,", + " a30 * b04 - a31 * b02 + a33 * b00,", + " a21 * b02 - a20 * b04 - a23 * b00,", + " a11 * b07 - a10 * b09 - a12 * b06,", + " a00 * b09 - a01 * b07 + a02 * b06,", + " a31 * b01 - a30 * b03 - a32 * b00,", + " a20 * b03 - a21 * b01 + a22 * b00) / det;", + " }", + + + " void main() {", + // Prepare transforms to map to "camera view". See also: + // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram + " mat4 viewtransformf = viewMatrix;", + " mat4 viewtransformi = inversemat(viewMatrix);", + + // Project local vertex coordinate to camera position. Then do a step + // backward (in cam coords) to the near clipping plane, and project back. Do + // the same for the far clipping plane. This gives us all the information we + // need to calculate the ray and truncate it to the viewing cone. + " vec4 position4 = vec4(position, 1.0);", + " vec4 pos_in_cam = viewtransformf * position4;", + + // Intersection of ray and near clipping plane (z = -1 in clip coords) + " pos_in_cam.z = -pos_in_cam.w;", + " v_nearpos = viewtransformi * pos_in_cam;", + + // Intersection of ray and far clipping plane (z = +1 in clip coords) + " pos_in_cam.z = pos_in_cam.w;", + " v_farpos = viewtransformi * pos_in_cam;", + + // Set varyings and output pos + " v_position = position;", + " gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;", + " }", + ].join( "\n" ), fragmentShader: [ - 'precision highp float;', - 'precision mediump sampler3D;', - - 'uniform vec3 u_size;', - 'uniform int u_renderstyle;', - 'uniform float u_renderthreshold;', - 'uniform vec2 u_clim;', - - 'uniform sampler3D u_data;', - 'uniform sampler2D u_cmdata;', - - 'varying vec3 v_position;', - 'varying vec4 v_nearpos;', - 'varying vec4 v_farpos;', - - // The maximum distance through our rendering volume is sqrt(3). - 'const int MAX_STEPS = 887; // 887 for 512^3, 1774 for 1024^3', - 'const int REFINEMENT_STEPS = 4;', - 'const float relative_step_size = 1.0;', - 'const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);', - 'const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);', - 'const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);', - 'const float shininess = 40.0;', - - 'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);', - 'void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);', - - 'float sample1(vec3 texcoords);', - 'vec4 apply_colormap(float val);', - 'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);', - - - 'void main() {', - // Normalize clipping plane info - 'vec3 farpos = v_farpos.xyz / v_farpos.w;', - 'vec3 nearpos = v_nearpos.xyz / v_nearpos.w;', - - // Calculate unit vector pointing in the view direction through this fragment. - 'vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);', - - // Compute the (negative) distance to the front surface or near clipping plane. - // v_position is the back face of the cuboid, so the initial distance calculated in the dot - // product below is the distance from near clip plane to the back of the cuboid - 'float distance = dot(nearpos - v_position, view_ray);', - 'distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,', - '(u_size.x - 0.5 - v_position.x) / view_ray.x));', - 'distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,', - '(u_size.y - 0.5 - v_position.y) / view_ray.y));', - 'distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,', - '(u_size.z - 0.5 - v_position.z) / view_ray.z));', - - // Now we have the starting position on the front surface - 'vec3 front = v_position + view_ray * distance;', - - // Decide how many steps to take - 'int nsteps = int(-distance / relative_step_size + 0.5);', - 'if ( nsteps < 1 )', - 'discard;', - - // Get starting location and step vector in texture coordinates - 'vec3 step = ((v_position - front) / u_size) / float(nsteps);', - 'vec3 start_loc = front / u_size;', - - // For testing: show the number of steps. This helps to establish - // whether the rays are correctly oriented - //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);', - //'return;', - - 'if (u_renderstyle == 0)', - 'cast_mip(start_loc, step, nsteps, view_ray);', - 'else if (u_renderstyle == 1)', - 'cast_iso(start_loc, step, nsteps, view_ray);', - - 'if (gl_FragColor.a < 0.05)', - 'discard;', - '}', - - - 'float sample1(vec3 texcoords) {', - '/* Sample float value from a 3D texture. Assumes intensity data. */', - 'return texture(u_data, texcoords.xyz).r;', - '}', - - - 'vec4 apply_colormap(float val) {', - 'val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);', - 'return texture2D(u_cmdata, vec2(val, 0.5));', - '}', - - - 'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {', - - 'float max_val = -1e6;', - 'int max_i = 100;', - 'vec3 loc = start_loc;', - - // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with - // non-constant expression. So we use a hard-coded max, and an additional condition - // inside the loop. - 'for (int iter=0; iter= nsteps)', - 'break;', - // Sample from the 3D texture - 'float val = sample1(loc);', - // Apply MIP operation - 'if (val > max_val) {', - 'max_val = val;', - 'max_i = iter;', - '}', - // Advance location deeper into the volume - 'loc += step;', - '}', - - // Refine location, gives crispier images - 'vec3 iloc = start_loc + step * (float(max_i) - 0.5);', - 'vec3 istep = step / float(REFINEMENT_STEPS);', - 'for (int i=0; i= nsteps)', - 'break;', - - // Sample from the 3D texture - 'float val = sample1(loc);', - - 'if (val > low_threshold) {', - // Take the last interval in smaller steps - 'vec3 iloc = loc - 0.5 * step;', - 'vec3 istep = step / float(REFINEMENT_STEPS);', - 'for (int i=0; i u_renderthreshold) {', - 'gl_FragColor = add_lighting(val, iloc, dstep, view_ray);', - 'return;', - '}', - 'iloc += istep;', - '}', - '}', - - // Advance location deeper into the volume - 'loc += step;', - '}', - '}', - - - 'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)', - '{', - // Calculate color by incorporating lighting - - // View direction - 'vec3 V = normalize(view_ray);', - - // calculate normal vector from gradient - 'vec3 N;', - 'float val1, val2;', - 'val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));', - 'val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));', - 'N[0] = val1 - val2;', - 'val = max(max(val1, val2), val);', - 'val1 = sample1(loc + vec3(0.0, -step[1], 0.0));', - 'val2 = sample1(loc + vec3(0.0, +step[1], 0.0));', - 'N[1] = val1 - val2;', - 'val = max(max(val1, val2), val);', - 'val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));', - 'val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));', - 'N[2] = val1 - val2;', - 'val = max(max(val1, val2), val);', - - 'float gm = length(N); // gradient magnitude', - 'N = normalize(N);', - - // Flip normal so it points towards viewer - 'float Nselect = float(dot(N, V) > 0.0);', - 'N = (2.0 * Nselect - 1.0) * N; // == Nselect * N - (1.0-Nselect)*N;', - - // Init colors - 'vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);', - 'vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);', - 'vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);', - - // note: could allow multiple lights - 'for (int i=0; i<1; i++)', - '{', + " precision highp float;", + " precision mediump sampler3D;", + + " uniform vec3 u_size;", + " uniform int u_renderstyle;", + " uniform float u_renderthreshold;", + " uniform vec2 u_clim;", + + " uniform sampler3D u_data;", + " uniform sampler2D u_cmdata;", + + " varying vec3 v_position;", + " varying vec4 v_nearpos;", + " varying vec4 v_farpos;", + + // The maximum distance through our rendering volume is sqrt(3). + " const int MAX_STEPS = 887; // 887 for 512^3, 1774 for 1024^3", + " const int REFINEMENT_STEPS = 4;", + " const float relative_step_size = 1.0;", + " const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);", + " const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);", + " const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);", + " const float shininess = 40.0;", + + " void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);", + " void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);", + + " float sample1(vec3 texcoords);", + " vec4 apply_colormap(float val);", + " vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);", + + + " void main() {", + // Normalize clipping plane info + " vec3 farpos = v_farpos.xyz / v_farpos.w;", + " vec3 nearpos = v_nearpos.xyz / v_nearpos.w;", + + // Calculate unit vector pointing in the view direction through this fragment. + " vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);", + + // Compute the (negative) distance to the front surface or near clipping plane. + // v_position is the back face of the cuboid, so the initial distance calculated in the dot + // product below is the distance from near clip plane to the back of the cuboid + " float distance = dot(nearpos - v_position, view_ray);", + " distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,", + " (u_size.x - 0.5 - v_position.x) / view_ray.x));", + " distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,", + " (u_size.y - 0.5 - v_position.y) / view_ray.y));", + " distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,", + " (u_size.z - 0.5 - v_position.z) / view_ray.z));", + + // Now we have the starting position on the front surface + " vec3 front = v_position + view_ray * distance;", + + // Decide how many steps to take + " int nsteps = int(-distance / relative_step_size + 0.5);", + " if ( nsteps < 1 )", + " discard;", + + // Get starting location and step vector in texture coordinates + " vec3 step = ((v_position - front) / u_size) / float(nsteps);", + " vec3 start_loc = front / u_size;", + + // For testing: show the number of steps. This helps to establish + // whether the rays are correctly oriented + //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);', + //'return;', + + " if (u_renderstyle == 0)", + " cast_mip(start_loc, step, nsteps, view_ray);", + " else if (u_renderstyle == 1)", + " cast_iso(start_loc, step, nsteps, view_ray);", + + " if (gl_FragColor.a < 0.05)", + " discard;", + " }", + + + " float sample1(vec3 texcoords) {", + " /* Sample float value from a 3D texture. Assumes intensity data. */", + " return texture(u_data, texcoords.xyz).r;", + " }", + + + " vec4 apply_colormap(float val) {", + " val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);", + " return texture2D(u_cmdata, vec2(val, 0.5));", + " }", + + + " void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {", + + " float max_val = -1e6;", + " int max_i = 100;", + " vec3 loc = start_loc;", + + // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with + // non-constant expression. So we use a hard-coded max, and an additional condition + // inside the loop. + " for (int iter=0; iter= nsteps)", + " break;", + // Sample from the 3D texture + " float val = sample1(loc);", + // Apply MIP operation + " if (val > max_val) {", + " max_val = val;", + " max_i = iter;", + " }", + // Advance location deeper into the volume + " loc += step;", + " }", + + // Refine location, gives crispier images + " vec3 iloc = start_loc + step * (float(max_i) - 0.5);", + " vec3 istep = step / float(REFINEMENT_STEPS);", + " for (int i=0; i= nsteps)", + " break;", + + // Sample from the 3D texture + " float val = sample1(loc);", + + " if (val > low_threshold) {", + // Take the last interval in smaller steps + " vec3 iloc = loc - 0.5 * step;", + " vec3 istep = step / float(REFINEMENT_STEPS);", + " for (int i=0; i u_renderthreshold) {", + " gl_FragColor = add_lighting(val, iloc, dstep, view_ray);", + " return;", + " }", + " iloc += istep;", + " }", + " }", + + // Advance location deeper into the volume + " loc += step;", + " }", + " }", + + + " vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)", + " {", + // Calculate color by incorporating lighting + + // View direction + " vec3 V = normalize(view_ray);", + + // calculate normal vector from gradient + " vec3 N;", + " float val1, val2;", + " val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));", + " val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));", + " N[0] = val1 - val2;", + " val = max(max(val1, val2), val);", + " val1 = sample1(loc + vec3(0.0, -step[1], 0.0));", + " val2 = sample1(loc + vec3(0.0, +step[1], 0.0));", + " N[1] = val1 - val2;", + " val = max(max(val1, val2), val);", + " val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));", + " val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));", + " N[2] = val1 - val2;", + " val = max(max(val1, val2), val);", + + " float gm = length(N); // gradient magnitude", + " N = normalize(N);", + + // Flip normal so it points towards viewer + " float Nselect = float(dot(N, V) > 0.0);", + " N = (2.0 * Nselect - 1.0) * N; // == Nselect * N - (1.0-Nselect)*N;", + + // Init colors + " vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);", + " vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);", + " vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);", + + // note: could allow multiple lights + " for (int i=0; i<1; i++)", + " {", // Get light direction (make sure to prevent zero devision) - 'vec3 L = normalize(view_ray); //lightDirs[i];', - 'float lightEnabled = float( length(L) > 0.0 );', - 'L = normalize(L + (1.0 - lightEnabled));', - - // Calculate lighting properties - 'float lambertTerm = clamp(dot(N, L), 0.0, 1.0);', - 'vec3 H = normalize(L+V); // Halfway vector', - 'float specularTerm = pow(max(dot(H, N), 0.0), shininess);', - - // Calculate mask - 'float mask1 = lightEnabled;', - - // Calculate colors - 'ambient_color += mask1 * ambient_color; // * gl_LightSource[i].ambient;', - 'diffuse_color += mask1 * lambertTerm;', - 'specular_color += mask1 * specularTerm * specular_color;', - '}', - - // Calculate final color by componing different components - 'vec4 final_color;', - 'vec4 color = apply_colormap(val);', - 'final_color = color * (ambient_color + diffuse_color) + specular_color;', - 'final_color.a = color.a;', - 'return final_color;', - '}', - ].join( '\n' ) + " vec3 L = normalize(view_ray); //lightDirs[i];", + " float lightEnabled = float( length(L) > 0.0 );", + " L = normalize(L + (1.0 - lightEnabled));", + + // Calculate lighting properties + " float lambertTerm = clamp(dot(N, L), 0.0, 1.0);", + " vec3 H = normalize(L+V); // Halfway vector", + " float specularTerm = pow(max(dot(H, N), 0.0), shininess);", + + // Calculate mask + " float mask1 = lightEnabled;", + + // Calculate colors + " ambient_color += mask1 * ambient_color; // * gl_LightSource[i].ambient;", + " diffuse_color += mask1 * lambertTerm;", + " specular_color += mask1 * specularTerm * specular_color;", + " }", + + // Calculate final color by componing different components + " vec4 final_color;", + " vec4 color = apply_colormap(val);", + " final_color = color * (ambient_color + diffuse_color) + specular_color;", + " final_color.a = color.a;", + " return final_color;", + " }", + ].join( "\n" ) }; export { VolumeRenderShader1 }; diff --git a/examples/jsm/shaders/WaterRefractionShader.d.ts b/examples/jsm/shaders/WaterRefractionShader.d.ts index b925d2ba23847af31bb176111c975d2de26f403a..c26b60fd87a2e931f8c7306597f841a5e8e14849 100644 --- a/examples/jsm/shaders/WaterRefractionShader.d.ts +++ b/examples/jsm/shaders/WaterRefractionShader.d.ts @@ -1,15 +1,15 @@ import { - Uniform + Uniform } from '../../../src/Three'; export const WaterRefractionShader: { - uniforms: { - color: Uniform; - time: Uniform; - tDiffuse: Uniform; - tDudv: Uniform; - textureMatrix: Uniform; - }; - vertexShader: string; - fragmentShader: string; + uniforms: { + color: Uniform; + time: Uniform; + tDiffuse: Uniform; + tDudv: Uniform; + textureMatrix: Uniform; + }; + vertexShader: string; + fragmentShader: string; }; diff --git a/examples/jsm/shaders/WaterRefractionShader.js b/examples/jsm/shaders/WaterRefractionShader.js index 8cdb69d7732b8ffdc041305a5bc6add03762c776..bead74047dda2a58fa0482251e55102cc3ec012f 100644 --- a/examples/jsm/shaders/WaterRefractionShader.js +++ b/examples/jsm/shaders/WaterRefractionShader.js @@ -9,23 +9,23 @@ var WaterRefractionShader = { uniforms: { - 'color': { + "color": { value: null }, - 'time': { + "time": { value: 0 }, - 'tDiffuse': { + "tDiffuse": { value: null }, - 'tDudv': { + "tDudv": { value: null }, - 'textureMatrix': { + "textureMatrix": { value: null } @@ -33,68 +33,68 @@ var WaterRefractionShader = { vertexShader: [ - 'uniform mat4 textureMatrix;', + "uniform mat4 textureMatrix;", - 'varying vec2 vUv;', - 'varying vec4 vUvRefraction;', + "varying vec2 vUv;", + "varying vec4 vUvRefraction;", - 'void main() {', + "void main() {", - ' vUv = uv;', + " vUv = uv;", - ' vUvRefraction = textureMatrix * vec4( position, 1.0 );', + " vUvRefraction = textureMatrix * vec4( position, 1.0 );", - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", - '}' + "}" - ].join( '\n' ), + ].join( "\n" ), fragmentShader: [ - 'uniform vec3 color;', - 'uniform float time;', - 'uniform sampler2D tDiffuse;', - 'uniform sampler2D tDudv;', + "uniform vec3 color;", + "uniform float time;", + "uniform sampler2D tDiffuse;", + "uniform sampler2D tDudv;", - 'varying vec2 vUv;', - 'varying vec4 vUvRefraction;', + "varying vec2 vUv;", + "varying vec4 vUvRefraction;", - 'float blendOverlay( float base, float blend ) {', + "float blendOverlay( float base, float blend ) {", - ' return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );', + " return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );", - '}', + "}", - 'vec3 blendOverlay( vec3 base, vec3 blend ) {', + "vec3 blendOverlay( vec3 base, vec3 blend ) {", - ' return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );', + " return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );", - '}', + "}", - 'void main() {', + "void main() {", - ' float waveStrength = 0.1;', - ' float waveSpeed = 0.03;', + " float waveStrength = 0.1;", + " float waveSpeed = 0.03;", // simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s) - ' vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;', - ' distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );', - ' vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;', + " vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;", + " distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );", + " vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;", // new uv coords - ' vec4 uv = vec4( vUvRefraction );', - ' uv.xy += distortion;', + " vec4 uv = vec4( vUvRefraction );", + " uv.xy += distortion;", - ' vec4 base = texture2DProj( tDiffuse, uv );', + " vec4 base = texture2DProj( tDiffuse, uv );", - ' gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );', + " gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );", - '}' + "}" - ].join( '\n' ) + ].join( "\n" ) }; export { WaterRefractionShader }; diff --git a/examples/jsm/utils/BufferGeometryUtils.d.ts b/examples/jsm/utils/BufferGeometryUtils.d.ts index 5d3a32087bba95c6cfc7deb51d1a0419d2fc3d68..14f4533c71c8effb8ceddc0a7e7bdb19e26c329e 100644 --- a/examples/jsm/utils/BufferGeometryUtils.d.ts +++ b/examples/jsm/utils/BufferGeometryUtils.d.ts @@ -1,7 +1,7 @@ import { BufferAttribute, BufferGeometry } from '../../../src/Three'; export namespace BufferGeometryUtils { - export function mergeBufferGeometries(geometries: BufferGeometry[], useGroups?: boolean): BufferGeometry; - export function computeTangents(geometry: BufferGeometry): null; - export function mergeBufferAttributes(attributes: BufferAttribute[]): BufferAttribute; + export function mergeBufferGeometries( geometries: BufferGeometry[], useGroups?: boolean ): BufferGeometry; + export function computeTangents( geometry: BufferGeometry ): null; + export function mergeBufferAttributes( attributes: BufferAttribute[] ): BufferAttribute; } diff --git a/examples/jsm/utils/GeometryUtils.d.ts b/examples/jsm/utils/GeometryUtils.d.ts index a7631676b62c8583fd806a3fa0b3629ab70995cf..3bd94b32284768ec726dea317f0d1c1f71417567 100644 --- a/examples/jsm/utils/GeometryUtils.d.ts +++ b/examples/jsm/utils/GeometryUtils.d.ts @@ -1,25 +1,25 @@ import { - BufferGeometry, - Face3, - Geometry, - Vector3 + BufferGeometry, + Face3, + Geometry, + Vector3 } from '../../../src/Three'; export namespace GeometryUtils { - /** + /** * @deprecated Use {@link Geometry#merge geometry.merge( geometry2, matrix, materialIndexOffset )} instead. */ - export function merge(geometry1: Geometry, geometry2: Geometry, materialIndexOffset?: number): void; - /** + export function merge( geometry1: Geometry, geometry2: Geometry, materialIndexOffset?: number ): void; + /** * @deprecated Use {@link Geometry#center geometry.center()} instead. */ - export function center(geometry: Geometry): Geometry; + export function center( geometry: Geometry ): Geometry; - export function randomPointInTriangle(vectorA: Vector3, vectorB: Vector3, vectorC: Vector3): Vector3; - export function randomPointInFace(face: Face3, geometry: Geometry): Vector3; - export function randomPointsInGeometry(geometry: Geometry, n: number): Vector3[]; - export function randomPointsInBufferGeometry(geometry: BufferGeometry, n: number): Vector3[]; - export function triangleArea(vectorA: Vector3, vectorB: Vector3, vectorC: Vector3): number; - export function hilbert2D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number): Vector3[]; - export function hilbert3D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number): Vector3[]; + export function randomPointInTriangle( vectorA: Vector3, vectorB: Vector3, vectorC: Vector3 ): Vector3; + export function randomPointInFace( face: Face3, geometry: Geometry ): Vector3; + export function randomPointsInGeometry( geometry: Geometry, n: number ): Vector3[]; + export function randomPointsInBufferGeometry( geometry: BufferGeometry, n: number ): Vector3[]; + export function triangleArea( vectorA: Vector3, vectorB: Vector3, vectorC: Vector3 ): number; + export function hilbert2D( center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number ): Vector3[]; + export function hilbert3D( center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number ): Vector3[]; } diff --git a/examples/jsm/utils/MathUtils.d.ts b/examples/jsm/utils/MathUtils.d.ts index e1923c5c7f8c21c852a86191201b4299d3909c15..e6caaf4e73425d2264f54b6f2fd30510246ef8ec 100644 --- a/examples/jsm/utils/MathUtils.d.ts +++ b/examples/jsm/utils/MathUtils.d.ts @@ -1,5 +1,5 @@ -import {Quaternion} from "../../../src/Three"; +import { Quaternion } from "../../../src/Three"; export namespace MathUtils { - export function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: string): void ; + export function setQuaternionFromProperEuler( q: Quaternion, a: number, b: number, c: number, order: string ): void; } diff --git a/examples/jsm/utils/SceneUtils.d.ts b/examples/jsm/utils/SceneUtils.d.ts index b80cd2d841c91cae7dcaf0dd70ab859ec857e972..1ac7a377cb2a67166123956ae8f909b5bf57151b 100644 --- a/examples/jsm/utils/SceneUtils.d.ts +++ b/examples/jsm/utils/SceneUtils.d.ts @@ -1,7 +1,7 @@ import { Geometry, Material, Object3D, Scene } from '../../../src/Three'; export namespace SceneUtils { - export function createMultiMaterialObject(geometry: Geometry, materials: Material[]): Object3D; - export function detach(child: Object3D, parent: Object3D, scene: Scene): void; - export function attach(child: Object3D, scene: Scene, parent: Object3D): void; + export function createMultiMaterialObject( geometry: Geometry, materials: Material[] ): Object3D; + export function detach( child: Object3D, parent: Object3D, scene: Scene ): void; + export function attach( child: Object3D, scene: Scene, parent: Object3D ): void; } diff --git a/examples/jsm/utils/ShadowMapViewer.d.ts b/examples/jsm/utils/ShadowMapViewer.d.ts index 36cf7da20094e6f473bf3a4bb68aa36d828bb456..46c502f854d2b19a79073da3dce2a5da30ff4c10 100644 --- a/examples/jsm/utils/ShadowMapViewer.d.ts +++ b/examples/jsm/utils/ShadowMapViewer.d.ts @@ -1,7 +1,9 @@ -import {Light} from "../../../src/Three"; +import { Light } from "../../../src/Three"; export class ShadowMapViewer { - constructor(light: Light) + + constructor( light: Light ) + } diff --git a/examples/jsm/utils/SkeletonUtils.d.ts b/examples/jsm/utils/SkeletonUtils.d.ts index 71e30a9fa99de7caf826af354ea80ab4d0f092f0..f98bd050cd6138ad8dbd6248b07c3d0d319a81a4 100644 --- a/examples/jsm/utils/SkeletonUtils.d.ts +++ b/examples/jsm/utils/SkeletonUtils.d.ts @@ -1,32 +1,32 @@ -import {AnimationClip, Bone, Matrix4, Object3D, Skeleton, SkeletonHelper} from "../../../src/Three"; +import { AnimationClip, Bone, Matrix4, Object3D, Skeleton, SkeletonHelper } from "../../../src/Three"; export namespace SkeletonUtils { - export function retarget(target: Object3D | Skeleton, + export function retarget( target: Object3D | Skeleton, source: Object3D | Skeleton, - options: {}): void; + options: {} ): void; - export function retargetClip(target: Skeleton | Object3D, + export function retargetClip( target: Skeleton | Object3D, source: Skeleton | Object3D, clip: AnimationClip, - options: {}): AnimationClip; + options: {} ): AnimationClip; - export function getHelperFromSkeleton(skeleton: Skeleton): SkeletonHelper; + export function getHelperFromSkeleton( skeleton: Skeleton ): SkeletonHelper; - export function getSkeletonOffsets(target: Object3D | Skeleton, + export function getSkeletonOffsets( target: Object3D | Skeleton, source: Object3D | Skeleton, - options: {}): Matrix4[]; + options: {} ): Matrix4[]; - export function renameBones(skeleton: Skeleton, names: {}): any; + export function renameBones( skeleton: Skeleton, names: {} ): any; - export function getBones(skeleton: Skeleton | Bone[]): Bone[]; + export function getBones( skeleton: Skeleton | Bone[] ): Bone[]; - export function getBoneByName(name: string, skeleton: Skeleton): Bone; + export function getBoneByName( name: string, skeleton: Skeleton ): Bone; - export function getNearestBone(bone: Bone, names: {}): Bone; + export function getNearestBone( bone: Bone, names: {} ): Bone; - export function findBoneTrackData(name: string, tracks: any[]): {}; + export function findBoneTrackData( name: string, tracks: any[] ): {}; - export function getEqualsBonesNames(skeleton: Skeleton, targetSkeleton: Skeleton): string[]; + export function getEqualsBonesNames( skeleton: Skeleton, targetSkeleton: Skeleton ): string[]; - export function clone(source: Object3D | Skeleton): Object3D | Skeleton; + export function clone( source: Object3D | Skeleton ): Object3D | Skeleton; } diff --git a/examples/jsm/utils/TypedArrayUtils.d.ts b/examples/jsm/utils/TypedArrayUtils.d.ts index 5785a4dd3a7f846892dce9203270ffcbdf034276..0a0f5c063a405715659e26a47e5a6fd26104ca3d 100644 --- a/examples/jsm/utils/TypedArrayUtils.d.ts +++ b/examples/jsm/utils/TypedArrayUtils.d.ts @@ -1,26 +1,28 @@ export namespace TypedArrayUtils { - export function quicksortIP(arr: any[], eleSize: number, orderElement: number): any[]; + export function quicksortIP( arr: any[], eleSize: number, orderElement: number ): any[]; export class Kdtree { + self: this; root: Node; private maxDepth: number; - constructor(points: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray, metric: (a: any, b: any) => number, eleSize: number); + constructor( points: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray, metric: ( a: any, b: any ) => number, eleSize: number ); - getPointSet(points: any, pos: number); + getPointSet( points: any, pos: number ); buildTree(): Node; getMaxDepth(): number; - nearest(point: [], maxNodes: number, maxDistance: number): any[]; + nearest( point: [], maxNodes: number, maxDistance: number ): any[]; } export namespace Kdtree { export class Node { + obj: any; left: Node | null; right: Node | null; @@ -28,31 +30,34 @@ export namespace TypedArrayUtils { depth: number; pos: any; - constructor(obj: any, depth: number, parent: Node, pos: any) + constructor( obj: any, depth: number, parent: Node, pos: any ) + } export class BinaryHeap { + content: any[]; scoreFunction: () => any; - constructor(scoreFunction?: () => any); + constructor( scoreFunction?: () => any ); + } export namespace BinaryHeap { - export function push(element: any): void; + export function push( element: any ): void; export function pop(): any; export function peek(): any; - export function remove(node: any): any; + export function remove( node: any ): any; export function size(): number; - export function bubbleUp(n: number): void; + export function bubbleUp( n: number ): void; - export function sinkDown(n: number): void; + export function sinkDown( n: number ): void; } } } diff --git a/examples/jsm/utils/UVsDebug.d.ts b/examples/jsm/utils/UVsDebug.d.ts index 9f65b0a78b8e4360d73c61244dc11c3efa71438b..469cf3e4f12f19055407820bb0ede9ac39f8c9f1 100644 --- a/examples/jsm/utils/UVsDebug.d.ts +++ b/examples/jsm/utils/UVsDebug.d.ts @@ -1,3 +1,3 @@ -import {Geometry} from "../../../src/Three"; +import { Geometry } from "../../../src/Three"; -export function UVsDebug(geometry: Geometry, size: number): HTMLCanvasElement; +export function UVsDebug( geometry: Geometry, size: number ): HTMLCanvasElement; diff --git a/examples/jsm/vr/PaintViveController.d.ts b/examples/jsm/vr/PaintViveController.d.ts index 8365c3ea548e35324095f9ac67d62166b0bd1642..49b035eb7cc34d3e3f104bc23544fe8208e52f4c 100644 --- a/examples/jsm/vr/PaintViveController.d.ts +++ b/examples/jsm/vr/PaintViveController.d.ts @@ -1,12 +1,14 @@ import { - Color + Color } from '../../../src/Three'; import { ViveController } from './ViveController'; export class PaintViveController extends ViveController { - constructor(id: number); - getColor(): Color; - getSize(): number; + constructor( id: number ); + + getColor(): Color; + getSize(): number; + } diff --git a/examples/jsm/vr/ViveController.d.ts b/examples/jsm/vr/ViveController.d.ts index 050c86fdcaa2a24f0c46e474bd17e7b975ff9fa9..60d1050dbfd7e256e465fb149b99c77bed3e2b7c 100644 --- a/examples/jsm/vr/ViveController.d.ts +++ b/examples/jsm/vr/ViveController.d.ts @@ -1,13 +1,15 @@ import { - Matrix4, - Object3D + Matrix4, + Object3D } from '../../../src/Three'; export class ViveController extends Object3D { - constructor(id: number); - standingMatrix: Matrix4; - getButtonState(button: string): boolean; - getGamepad(): object; - update(): void; + constructor( id: number ); + standingMatrix: Matrix4; + + getButtonState( button: string ): boolean; + getGamepad(): object; + update(): void; + } diff --git a/examples/jsm/vr/WebVR.d.ts b/examples/jsm/vr/WebVR.d.ts index f888bc33cc784d2df916eaf440cc84bbb8a7080f..f66522e9d87c8bcff1d5114c665fa69fbc54060b 100644 --- a/examples/jsm/vr/WebVR.d.ts +++ b/examples/jsm/vr/WebVR.d.ts @@ -1,11 +1,11 @@ import { - WebGLRenderer + WebGLRenderer } from '../../../src/Three'; export interface WEBVROptions { - referenceSpaceType: string; + referenceSpaceType: string; } export namespace WEBVR { - export function createButton(renderer: WebGLRenderer, options: WEBVROptions); + export function createButton( renderer: WebGLRenderer, options: WEBVROptions ); } diff --git a/examples/jsm/vr/deprecated/DaydreamController.d.ts b/examples/jsm/vr/deprecated/DaydreamController.d.ts index d2a833a13e4dc1e0559ba703ef7f493431cdd08e..e3b3f6a2477532a25e31fb360f6241533b92715b 100644 --- a/examples/jsm/vr/deprecated/DaydreamController.d.ts +++ b/examples/jsm/vr/deprecated/DaydreamController.d.ts @@ -1,11 +1,13 @@ import { - Object3D + Object3D } from '../../../../src/Three'; export class DaydreamController extends Object3D { - constructor(id: number); + + constructor( id: number ); getTouchpadState(): boolean; - getGamepad(): object; - update(): void; + getGamepad(): object; + update(): void; + } diff --git a/examples/jsm/vr/deprecated/GearVRController.d.ts b/examples/jsm/vr/deprecated/GearVRController.d.ts index 850b6fd3fe1587a5d390aca92713eb66a63fef09..3dc4e2abe607c5ff5ec93bd6df403bfd290efc30 100644 --- a/examples/jsm/vr/deprecated/GearVRController.d.ts +++ b/examples/jsm/vr/deprecated/GearVRController.d.ts @@ -1,11 +1,13 @@ import { - Object3D + Object3D } from '../../../../src/Three'; export class GearVRController extends Object3D { - constructor(id: number); + + constructor( id: number ); getTouchpadState(): boolean; - getGamepad(): object; - update(): void; + getGamepad(): object; + update(): void; + } diff --git a/examples/misc_exporter_gltf.html b/examples/misc_exporter_gltf.html index fe8868e89691ca85936f9fd8876331681036e151..484415501e88a32595b091fa797823f11d065483 100644 --- a/examples/misc_exporter_gltf.html +++ b/examples/misc_exporter_gltf.html @@ -22,6 +22,7 @@ +