Added "metal" parameter to Phong. Added new materials test.

Metal makes specular term multiplicative (default is additive). This is to be able to have textured materials that do not have diffuse color, just a specular one, to get metallic look (additive specular gives plastic look).
This commit is contained in:
alteredq
2011-10-18 16:05:03 +02:00
parent 1e7e75e29c
commit 2253592365
8 changed files with 385 additions and 78 deletions
+16 -16
View File
@@ -109,9 +109,9 @@ THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.col
THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=
b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=
b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=
b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.metal=b.metal!==void 0?b.metal:!1;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=
b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?
b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
@@ -201,7 +201,7 @@ map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif",
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;\n}",
lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif",
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
@@ -292,21 +292,21 @@ o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBu
THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),Q.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),Q.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),Q.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":
b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var t,u,v;t=v=p=0;for(u=c.length;t<u;t++)m=c[t],m instanceof
THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&p++;p+v<=ya?t=v:(t=Math.ceil(ya*v/(p+v)),p=ya-t);m={directional:t,point:p};p=v=0;for(t=c.length;p<t;p++)u=c[p],u instanceof THREE.SpotLight&&u.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{t=b.fragmentShader;u=b.vertexShader;var p=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(t),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=R.length;y<f;y++)if(R[y].code==
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest,metal:b.metal},y,f=[];n?f.push(n):(f.push(t),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=R.length;y<f;y++)if(R[y].code==
n){x=R[y].program;break a}y=o.createProgram();f=[Ha?"#define VERTEX_TEXTURES":"",Q.gammaInput?"#define GAMMA_INPUT":"",Q.gammaOutput?"#define GAMMA_OUTPUT":"",Q.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":
"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",Q.gammaInput?"#define GAMMA_INPUT":"",Q.gammaOutput?"#define GAMMA_OUTPUT":"",Q.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":
"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,J("fragment",m+t));o.attachShader(y,J("vertex",f+u));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||
console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");y.uniforms={};y.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in p)f.push(z);z=f;f=0;for(p=z.length;f<p;f++)t=z[f],y.uniforms[t]=o.getUniformLocation(y,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA",
"skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(x in c)f.push(x);x=f;z=0;for(c=x.length;z<c;z++)e=x[z],y.attributes[e]=o.getAttribLocation(y,e);y.id=R.length;R.push({program:y,code:n});Q.info.memory.programs=R.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);
b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,x[z]>=0&&(o.enableVertexAttribArray(x[z]),b.numSupportedMorphTargets++);
b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){N(b);this.clear(c,e,f)};this.updateShadowMap=function(b,c){z(b,c)};this.render=function(b,c,u,U){var L,da,E,C,G,pa,B,ma,I=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(b,c);Q.info.render.calls=0;Q.info.render.vertices=0;Q.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa);
c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);N(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(U=0;U<G;U++)if(L=b.__webglObjects[U],B=L.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),v(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:
(Da.copy(B.position),Ca.multiplyVector3(Da),L.z=Da.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(A);pa=b.__webglObjectsImmediate.length;for(U=0;U<pa;U++)L=b.__webglObjectsImmediate[U],B=L.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),x(L));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<G;U++)if(L=b.__webglObjects[U],L.render)B=L.object,ma=L.buffer,k(B),f(c,I,ca,b.overrideMaterial,
ma,B);for(U=0;U<pa;U++)L=b.__webglObjectsImmediate[U],B=L.object,B.visible&&(ga=-1,k(B),da=e(c,I,ca,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(c){h(c,da,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(U=G-1;U>=0;U--)if(L=b.__webglObjects[U],L.render){B=L.object;ma=L.buffer;E=L.opaque;k(B);for(L=0;L<E.count;L++)C=E.list[L],m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,I,ca,C,
ma,B)}for(U=0;U<pa;U++)if(L=b.__webglObjectsImmediate[U],B=L.object,B.visible){ga=-1;E=L.opaque;k(B);for(L=0;L<E.count;L++)C=E.list[L],m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,I,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(b){h(b,da,C.shading)})}for(U=0;U<G;U++)if(L=b.__webglObjects[U],L.render){B=L.object;ma=L.buffer;E=L.transparent;k(B);for(L=0;L<E.count;L++)C=E.list[L],K(C.blending),m(C.depthTest),
n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,I,ca,C,ma,B)}for(U=0;U<pa;U++)if(L=b.__webglObjectsImmediate[U],B=L.object,B.visible){ga=-1;E=L.transparent;k(B);for(L=0;L<E.count;L++)C=E.list[L],K(C.blending),m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,I,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(b){h(b,da,C.shading)})}}b.__webglSprites.length&&y(b,c);u&&u.minFilter!==
THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&V(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,J("fragment",m+t));o.attachShader(y,J("vertex",f+u));o.linkProgram(y);
o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");y.uniforms={};y.attributes={};var z,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in p)f.push(z);z=f;f=0;for(p=z.length;f<p;f++)t=z[f],y.uniforms[t]=o.getUniformLocation(y,t);f=["position","normal",
"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<e.maxMorphTargets;z++)f.push("morphTarget"+z);for(x in c)f.push(x);x=f;z=0;for(c=x.length;z<c;z++)e=x[z],y.attributes[e]=o.getAttribLocation(y,e);y.id=R.length;R.push({program:y,code:n});Q.info.memory.programs=R.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=
0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)z="morphTarget"+k,x[z]>=0&&(o.enableVertexAttribArray(x[z]),
b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){N(b);this.clear(c,e,f)};this.updateShadowMap=function(b,c){z(b,c)};this.render=function(b,c,u,U){var L,da,E,C,G,pa,B,ma,I=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(b,c);Q.info.render.calls=0;Q.info.render.vertices=0;Q.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,
!1,c);c.matrixWorldInverse.flattenToArray(Fa);c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);N(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(U=0;U<G;U++)if(L=b.__webglObjects[U],B=L.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),v(L),L.render=!0,this.sortObjects)L.object.renderDepth?
L.z=L.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),L.z=Da.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(A);pa=b.__webglObjectsImmediate.length;for(U=0;U<pa;U++)L=b.__webglObjectsImmediate[U],B=L.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),D(B,c,!0),x(L));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<G;U++)if(L=b.__webglObjects[U],L.render)B=L.object,ma=L.buffer,
k(B),f(c,I,ca,b.overrideMaterial,ma,B);for(U=0;U<pa;U++)L=b.__webglObjectsImmediate[U],B=L.object,B.visible&&(ga=-1,k(B),da=e(c,I,ca,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(c){h(c,da,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(U=G-1;U>=0;U--)if(L=b.__webglObjects[U],L.render){B=L.object;ma=L.buffer;E=L.opaque;k(B);for(L=0;L<E.count;L++)C=E.list[L],m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,
C.polygonOffsetUnits),f(c,I,ca,C,ma,B)}for(U=0;U<pa;U++)if(L=b.__webglObjectsImmediate[U],B=L.object,B.visible){ga=-1;E=L.opaque;k(B);for(L=0;L<E.count;L++)C=E.list[L],m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,I,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(b){h(b,da,C.shading)})}for(U=0;U<G;U++)if(L=b.__webglObjects[U],L.render){B=L.object;ma=L.buffer;E=L.transparent;k(B);for(L=0;L<E.count;L++)C=E.list[L],
K(C.blending),m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,I,ca,C,ma,B)}for(U=0;U<pa;U++)if(L=b.__webglObjectsImmediate[U],B=L.object,B.visible){ga=-1;E=L.transparent;k(B);for(L=0;L<E.count;L++)C=E.list[L],K(C.blending),m(C.depthTest),n(C.depthWrite),p(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,I,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,o,xa):B.render(function(b){h(b,da,C.shading)})}}b.__webglSprites.length&&
y(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&V(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),
e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&I(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();
n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}Q.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,y=void 0,z=void 0,U=z=p=0,L=w=v=void 0,w=t=L=v=u=void 0,x=n.geometry,y=x.faces,L=m.faces,u=0,v=L.length;u<v;u++)w=L[u],w=y[w],w instanceof THREE.Face3?
(p+=3,z+=1,U+=3):w instanceof THREE.Face4&&(p+=4,z+=2,U+=4);for(var u=m,v=n,A=L=y=void 0,da=void 0,A=void 0,w=[],y=0,L=v.materials.length;y<L;y++)if(A=v.materials[y],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<l;A++)(da=u.materials[A])&&w.push(da)}else(da=A)&&w.push(da);u=w;m.__materials=u;a:{y=v=void 0;L=u.length;for(v=0;v<L;v++)if(y=u[v],y.map||y.lightMap||y instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{L=y=void 0;w=u.length;for(y=0;y<w;y++)if(L=u[y],!(L instanceof
+3 -3
View File
@@ -103,9 +103,9 @@ THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=
a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=
a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;
this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=
a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=
a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?
a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
+3 -3
View File
@@ -103,9 +103,9 @@ THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=
a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=
a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;
this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=
a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=
a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?
a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
+54 -54
View File
@@ -106,9 +106,9 @@ THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.col
THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=
b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=
b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=
b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.metal=b.metal!==void 0?b.metal:!1;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=
b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?
b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
@@ -152,7 +152,7 @@ map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif",
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;\n}",
lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif",
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
@@ -243,59 +243,59 @@ e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBu
THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),J.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":
b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var p=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var m,n,o;m=o=p=0;for(n=c.length;m<n;m++)j=c[m],j instanceof
THREE.SpotLight&&o++,j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&p++;p+o<=Za?m=o:(m=Math.ceil(Za*o/(p+o)),p=Za-m);j={directional:m,point:p};p=o=0;for(m=c.length;p<m;p++)n=c[p],n instanceof THREE.SpotLight&&n.castShadow&&o++;var r=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)r=f.bones.length;var x;a:{m=b.fragmentShader;n=b.vertexShader;var p=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:b.alphaTest},v,f=[];k?f.push(k):(f.push(m),f.push(n));for(v in d)f.push(v),f.push(d[v]);k=f.join();v=0;for(f=La.length;v<f;v++)if(La[v].code==
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:b.alphaTest,metal:b.metal},v,f=[];k?f.push(k):(f.push(m),f.push(n));for(v in d)f.push(v),f.push(d[v]);k=f.join();v=0;for(f=La.length;v<f;v++)if(La[v].code==
k){x=La[v].program;break a}v=e.createProgram();f=[db?"#define VERTEX_TEXTURES":"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":
"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":
"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(v,ia("fragment",j+m));e.attachShader(v,ia("vertex",f+n));e.linkProgram(v);e.getProgramParameter(v,
e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in p)f.push(w);w=f;f=0;for(p=w.length;f<p;f++)m=w[f],v.uniforms[m]=e.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent",
"color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(x in c)f.push(x);x=f;w=0;for(c=x.length;w<c;w++)d=x[w],v.attributes[d]=e.getAttribLocation(v,d);v.id=La.length;La.push({program:v,code:k});J.info.memory.programs=La.length;x=v}b.program=x;x=b.program.attributes;x.position>=0&&e.enableVertexAttribArray(x.position);x.color>=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal);x.tangent>=0&&e.enableVertexAttribArray(x.tangent);
b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(e.enableVertexAttribArray(x.skinVertexA),e.enableVertexAttribArray(x.skinVertexB),e.enableVertexAttribArray(x.skinIndex),e.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(i in b.attributes)x[i]!==void 0&&x[i]>=0&&e.enableVertexAttribArray(x[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)w="morphTarget"+i,x[w]>=0&&(e.enableVertexAttribArray(x[w]),b.numSupportedMorphTargets++);
b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);this.clear(c,d,e)};this.updateShadowMap=function(b,c){F(b,c)};this.render=function(b,c,o,u){var K,Ia,ra,s,p,D,B,Pa,Qa=b.lights,x=b.fog;W=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(b,c);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;if(c.matrixAutoUpdate){for(p=c;p.parent;)p=p.parent;p.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);
c.projectionMatrix.flattenToArray(Va);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Ea);this.initWebGLObjects(b);S(o);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=b.__webglObjects.length;for(u=0;u<p;u++)if(K=b.__webglObjects[u],B=K.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||r(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),w(K),K.render=!0,this.sortObjects)K.object.renderDepth?K.z=K.object.renderDepth:
(Ja.copy(B.position),Ea.multiplyVector3(Ja),K.z=Ja.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(A);D=b.__webglObjectsImmediate.length;for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),v(K));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render)B=K.object,Pa=K.buffer,i(B),f(c,Qa,x,b.overrideMaterial,
Pa,B);for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(G=-1,i(B),Ia=d(c,Qa,x,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(u=p-1;u>=0;u--)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,
s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),
k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}}b.__webglSprites.length&&L(b,c);o&&o.minFilter!==
THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&la(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),
d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&sa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();
k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}J.info.memory.geometries++;for(var k=d,n=void 0,o=void 0,r=void 0,v=r=void 0,x=void 0,u=void 0,w=u=m=0,E=r=o=void 0,r=p=E=o=n=void 0,v=k.geometry,x=v.faces,E=j.faces,n=0,o=E.length;n<o;n++)r=E[n],r=x[r],r instanceof THREE.Face3?
(m+=3,u+=1,w+=3):r instanceof THREE.Face4&&(m+=4,u+=2,w+=4);for(var n=j,o=k,D=E=x=void 0,A=void 0,D=void 0,r=[],x=0,E=o.materials.length;x<E;x++)if(D=o.materials[x],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<l;D++)(A=n.materials[D])&&r.push(A)}else(A=D)&&r.push(A);n=r;j.__materials=n;a:{x=o=void 0;E=n.length;for(o=0;o<E;o++)if(x=n[o],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){o=!0;break a}o=!1}a:{E=x=void 0;r=n.length;for(x=0;x<r;x++)if(E=n[x],!(E instanceof THREE.MeshBasicMaterial&&
!E.envMap||E instanceof THREE.MeshDepthMaterial)){E=E&&E.shading!=void 0&&E.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}E=!1}a:{r=x=void 0;D=n.length;for(x=0;x<D;x++)if(r=n[x],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(m*3);if(E)j.__normalArray=new Float32Array(m*3);if(v.hasTangents)j.__tangentArray=new Float32Array(m*4);if(r)j.__colorArray=new Float32Array(m*3);if(o){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*
2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(x=
j.numMorphTargets;v<x;v++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=E==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=r;j.__normalType=E;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;v=0;for(x=n.length;v<x;v++)if(o=n[v],o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in o.attributes){r=o.attributes[a];E={};for(p in r)E[p]=r[p];if(!E.__webglInitialized||E.createUniqueBuffers)E.__webglInitialized=
!0,u=1,E.type==="v2"?u=2:E.type==="v3"?u=3:E.type==="v4"?u=4:E.type==="c"&&(u=3),E.size=u,E.array=new Float32Array(m*u),E.buffer=e.createBuffer(),E.buffer.belongsToAttribute=a,r.needsUpdate=!0,E.__original=r;j.__webglCustomAttributesList.push(E)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=
e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=
new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();J.info.geometries++;j=i;k=d;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=m;j.__materials=k.materials;w=u=p=void 0;p=0;for(u=k.materials.length;p<u;p++)if(w=k.materials[p],
w.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*
size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(f.__webglObjects,i,d)):
THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)ja(f.__webglObjects,d);else if(d instanceof
THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ja(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,p=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],p=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||
h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,p.__inittedArrays){var F=n=v=void 0,C=void 0,H=F=void 0,G=void 0,L=void 0,O=void 0,Q=A=D=r=E=x=o=void 0,R=void 0,N=void 0,y=C=O=C=L=G=void 0,I=void 0,t=I=y=G=void 0,q=void 0,t=I=y=F=F=H=I=y=C=t=I=y=q=t=I=y=q=t=I=y=void 0,M=0,P=0,X=0,aa=0,U=0,S=0,$=0,T=0,ma=0,z=0,na=0,V=t=0,V=void 0,oa=p.__vertexArray,ka=p.__uvArray,la=p.__uv2Array,W=p.__normalArray,ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,
ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,q=void 0,ia=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,x=p.__vertexColorType,o=p.__uvType,E=p.__normalType,ua=i.geometry,ta=ua.__dirtyVertices,za=ua.__dirtyElements,va=ua.__dirtyUvs,Aa=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,Ba=ua.vertices,Fa=p.faces,La=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Ma=ua.skinVerticesA,
Na=ua.skinVerticesB,Oa=ua.skinIndices,Ka=ua.skinWeights,Ga=ua.morphTargets;if(Z){y=0;for(I=Z.length;y<I;y++)Z[y].offset=0,Z[y].offsetSrc=0}v=0;for(n=Fa.length;v<n;v++)if(F=Fa[v],C=La[F],Ha&&(r=Ha[F]),Ja&&(D=Ja[F]),F=C.vertexNormals,H=C.normal,G=C.vertexColors,L=C.color,O=C.vertexTangents,C instanceof THREE.Face3){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,P+=9;if(Z){y=0;for(I=
Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.offsetSrc+=3),q.offset+=3):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],
R=q.value[C.c]):q.boundTo==="faces"?(R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],q.offsetSrc+=3),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.offset+=6):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+
2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z),q.offset+=9):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.offset+=12))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,
t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z;na+=9}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],da[z]=y.x,da[z+1]=y.y,
da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,z+=12;if(Da&&x)G.length==3&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2]):I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,ma+=9;if(Ca&&ua.hasTangents)G=
O[0],L=O[1],C=O[2],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,$+=12;if(Aa&&E)if(F.length==3&&wa)for(y=0;y<3;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<3;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<3;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<3;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+2,U+=3,Y[T]=
M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+2,Y[T+4]=M+1,Y[T+5]=M+2,T+=6,M+=3)}else if(C instanceof THREE.Face4){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,N=Ba[C.d].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,oa[P+9]=N.x,oa[P+10]=N.y,oa[P+11]=N.z,P+=12;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],
q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c],q.array[t+3]=q.value[C.d]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.array[t+3]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.array[t+3]=q.value[V+3],q.offsetSrc+=4),q.offset+=4):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],R=q.value[C.c],N=q.value[C.d]):q.boundTo==="faces"?(N=R=Q=A=V=q.value[V],q.offsetSrc++):
q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],N=q.value[V+3],q.offsetSrc+=4),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.array[t+6]=N.x,q.array[t+7]=N.y,q.offset+=8):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b,q.array[t+9]=N.r,q.array[t+10]=N.g,q.array[t+11]=N.b):(q.array[t]=
A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z,q.array[t+9]=N.x,q.array[t+10]=N.y,q.array[t+11]=N.z),q.offset+=12):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.array[t+12]=N.x,q.array[t+13]=N.y,q.array[t+14]=N.z,q.array[t+15]=N.w,q.offset+=16))}if(Ea){y=
0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,N=Ga[y].vertices[C.d].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z,t[na+9]=N.x,t[na+10]=N.y,t[na+11]=N.z;na+=12}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],q=Ka[C.d],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=
t.w,ga[z+12]=q.x,ga[z+13]=q.y,ga[z+14]=q.z,ga[z+15]=q.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],q=Oa[C.d],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,fa[z+12]=q.x,fa[z+13]=q.y,fa[z+14]=q.z,fa[z+15]=q.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],q=Ma[C.d],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,da[z+12]=q.x,da[z+13]=q.y,da[z+
14]=q.z,da[z+15]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],C=Na[C.d],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,ea[z+12]=C.x,ea[z+13]=C.y,ea[z+14]=C.z,ea[z+15]=1,z+=16;if(Da&&x)G.length==4&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2],G=G[3]):G=I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ca&&
ua.hasTangents)G=O[0],L=O[1],C=O[2],O=O[3],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(Aa&&E)if(F.length==4&&wa)for(y=0;y<4;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<4;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<4;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<4;y++)F=D[y],
la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+3,ia[U+3]=M+1,ia[U+4]=M+2,ia[U+5]=M+3,U+=6,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+3,Y[T+4]=M+1,Y[T+5]=M+2,Y[T+6]=M+2,Y[T+7]=M+3,T+=8,M+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(Z){y=0;for(I=Z.length;y<I;y++)q=Z[y],q.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,u))}if(Ea){y=0;for(I=Ga.length;y<I;y++)e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[y]),
e.bufferData(e.ARRAY_BUFFER,qa[y],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,u));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,
la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,u));z>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,
p.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=
!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,
i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=
0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,p=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||p)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b==
"front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return db}};
"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.metal?"#define METAL":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(v,ia("fragment",j+m));e.attachShader(v,ia("vertex",f+n));e.linkProgram(v);
e.getProgramParameter(v,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in p)f.push(w);w=f;f=0;for(p=w.length;f<p;f++)m=w[f],v.uniforms[m]=e.getUniformLocation(v,m);f=["position","normal",
"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(x in c)f.push(x);x=f;w=0;for(c=x.length;w<c;w++)d=x[w],v.attributes[d]=e.getAttribLocation(v,d);v.id=La.length;La.push({program:v,code:k});J.info.memory.programs=La.length;x=v}b.program=x;x=b.program.attributes;x.position>=0&&e.enableVertexAttribArray(x.position);x.color>=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal);
x.tangent>=0&&e.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(e.enableVertexAttribArray(x.skinVertexA),e.enableVertexAttribArray(x.skinVertexB),e.enableVertexAttribArray(x.skinIndex),e.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(i in b.attributes)x[i]!==void 0&&x[i]>=0&&e.enableVertexAttribArray(x[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)w="morphTarget"+i,x[w]>=0&&(e.enableVertexAttribArray(x[w]),
b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);this.clear(c,d,e)};this.updateShadowMap=function(b,c){F(b,c)};this.render=function(b,c,o,u){var K,Ia,ra,s,p,D,B,Pa,Qa=b.lights,x=b.fog;W=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(b,c);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;if(c.matrixAutoUpdate){for(p=c;p.parent;)p=p.parent;p.update(void 0,!0)}b.update(void 0,
!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Ea);this.initWebGLObjects(b);S(o);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=b.__webglObjects.length;for(u=0;u<p;u++)if(K=b.__webglObjects[u],B=K.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||r(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),w(K),K.render=!0,this.sortObjects)K.object.renderDepth?
K.z=K.object.renderDepth:(Ja.copy(B.position),Ea.multiplyVector3(Ja),K.z=Ja.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(A);D=b.__webglObjectsImmediate.length;for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),v(K));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render)B=K.object,Pa=K.buffer,
i(B),f(c,Qa,x,b.overrideMaterial,Pa,B);for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(G=-1,i(B),Ia=d(c,Qa,x,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(u=p-1;u>=0;u--)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,
s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=
ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}}b.__webglSprites.length&&
L(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&la(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),
d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&sa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=
e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}J.info.memory.geometries++;for(var k=d,n=void 0,o=void 0,r=void 0,v=r=void 0,x=void 0,u=void 0,w=u=m=0,E=r=o=void 0,r=p=E=o=n=void 0,v=k.geometry,x=v.faces,E=
j.faces,n=0,o=E.length;n<o;n++)r=E[n],r=x[r],r instanceof THREE.Face3?(m+=3,u+=1,w+=3):r instanceof THREE.Face4&&(m+=4,u+=2,w+=4);for(var n=j,o=k,D=E=x=void 0,A=void 0,D=void 0,r=[],x=0,E=o.materials.length;x<E;x++)if(D=o.materials[x],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<l;D++)(A=n.materials[D])&&r.push(A)}else(A=D)&&r.push(A);n=r;j.__materials=n;a:{x=o=void 0;E=n.length;for(o=0;o<E;o++)if(x=n[o],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){o=!0;break a}o=!1}a:{E=
x=void 0;r=n.length;for(x=0;x<r;x++)if(E=n[x],!(E instanceof THREE.MeshBasicMaterial&&!E.envMap||E instanceof THREE.MeshDepthMaterial)){E=E&&E.shading!=void 0&&E.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}E=!1}a:{r=x=void 0;D=n.length;for(x=0;x<D;x++)if(r=n[x],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(m*3);if(E)j.__normalArray=new Float32Array(m*3);if(v.hasTangents)j.__tangentArray=new Float32Array(m*4);if(r)j.__colorArray=new Float32Array(m*
3);if(o){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=
new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(x=j.numMorphTargets;v<x;v++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=E==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=r;j.__normalType=E;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;v=0;for(x=n.length;v<x;v++)if(o=n[v],o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in o.attributes){r=
o.attributes[a];E={};for(p in r)E[p]=r[p];if(!E.__webglInitialized||E.createUniqueBuffers)E.__webglInitialized=!0,u=1,E.type==="v2"?u=2:E.type==="v3"?u=3:E.type==="v4"?u=4:E.type==="c"&&(u=3),E.size=u,E.array=new Float32Array(m*u),E.buffer=e.createBuffer(),E.buffer.belongsToAttribute=a,r.needsUpdate=!0,E.__original=r;j.__webglCustomAttributesList.push(E)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;
i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),
J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();J.info.geometries++;j=i;k=d;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=
m;j.__materials=k.materials;w=u=p=void 0;p=0;for(u=k.materials.length;p<u;p++)if(w=k.materials[p],w.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||
d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||
d instanceof THREE.Ribbon||d instanceof THREE.Line)ja(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ja(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,p=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<
m;k++)if(j=h.geometryGroupsList[k],p=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,p.__inittedArrays){var F=n=v=void 0,C=void 0,H=F=void 0,G=void 0,L=void 0,O=void 0,Q=A=D=r=E=x=o=void 0,R=void 0,N=void 0,y=C=O=C=L=G=void 0,I=void 0,t=I=y=G=void 0,q=void 0,t=I=y=F=F=H=I=y=C=t=I=y=q=t=I=y=q=t=I=y=void 0,M=0,P=0,X=0,aa=0,U=0,S=0,$=0,T=0,ma=0,z=0,na=0,V=t=0,V=void 0,oa=p.__vertexArray,
ka=p.__uvArray,la=p.__uv2Array,W=p.__normalArray,ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,q=void 0,ia=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,x=p.__vertexColorType,o=p.__uvType,E=p.__normalType,ua=i.geometry,ta=ua.__dirtyVertices,za=ua.__dirtyElements,va=ua.__dirtyUvs,Aa=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,
Ba=ua.vertices,Fa=p.faces,La=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Ma=ua.skinVerticesA,Na=ua.skinVerticesB,Oa=ua.skinIndices,Ka=ua.skinWeights,Ga=ua.morphTargets;if(Z){y=0;for(I=Z.length;y<I;y++)Z[y].offset=0,Z[y].offsetSrc=0}v=0;for(n=Fa.length;v<n;v++)if(F=Fa[v],C=La[F],Ha&&(r=Ha[F]),Ja&&(D=Ja[F]),F=C.vertexNormals,H=C.normal,G=C.vertexColors,L=C.color,O=C.vertexTangents,C instanceof THREE.Face3){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,oa[P]=A.x,oa[P+1]=A.y,
oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,P+=9;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+
2],q.offsetSrc+=3),q.offset+=3):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],R=q.value[C.c]):q.boundTo==="faces"?(R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],q.offsetSrc+=3),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.offset+=6):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+
5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z),q.offset+=9):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.offset+=12))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,
Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z;na+=9}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=
t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,z+=12;if(Da&&x)G.length==3&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2]):I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+
3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,ma+=9;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,$+=12;if(Aa&&E)if(F.length==3&&wa)for(y=0;y<3;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<3;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<3;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&
o)for(y=0;y<3;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+2,U+=3,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+2,Y[T+4]=M+1,Y[T+5]=M+2,T+=6,M+=3)}else if(C instanceof THREE.Face4){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,N=Ba[C.d].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,oa[P+9]=N.x,oa[P+10]=N.y,oa[P+11]=N.z,P+=12;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=
q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c],q.array[t+3]=q.value[C.d]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.array[t+3]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.array[t+3]=q.value[V+3],q.offsetSrc+=4),q.offset+=4):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],
Q=q.value[C.b],R=q.value[C.c],N=q.value[C.d]):q.boundTo==="faces"?(N=R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],N=q.value[V+3],q.offsetSrc+=4),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.array[t+6]=N.x,q.array[t+7]=N.y,q.offset+=8):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+
6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b,q.array[t+9]=N.r,q.array[t+10]=N.g,q.array[t+11]=N.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z,q.array[t+9]=N.x,q.array[t+10]=N.y,q.array[t+11]=N.z),q.offset+=12):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,
q.array[t+11]=R.w,q.array[t+12]=N.x,q.array[t+13]=N.y,q.array[t+14]=N.z,q.array[t+15]=N.w,q.offset+=16))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,N=Ga[y].vertices[C.d].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z,t[na+9]=N.x,t[na+10]=N.y,t[na+11]=N.z;na+=12}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],q=Ka[C.d],ga[z]=y.x,ga[z+1]=y.y,ga[z+
2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,ga[z+12]=q.x,ga[z+13]=q.y,ga[z+14]=q.z,ga[z+15]=q.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],q=Oa[C.d],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,fa[z+12]=q.x,fa[z+13]=q.y,fa[z+14]=q.z,fa[z+15]=q.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],q=Ma[C.d],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,
da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,da[z+12]=q.x,da[z+13]=q.y,da[z+14]=q.z,da[z+15]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],C=Na[C.d],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,ea[z+12]=C.x,ea[z+13]=C.y,ea[z+14]=C.z,ea[z+15]=1,z+=16;if(Da&&x)G.length==4&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2],G=G[3]):G=I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+
4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],O=O[3],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(Aa&&E)if(F.length==4&&wa)for(y=0;y<4;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<4;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=
3;if(va&&r!==void 0&&o)for(y=0;y<4;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<4;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+3,ia[U+3]=M+1,ia[U+4]=M+2,ia[U+5]=M+3,U+=6,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+3,Y[T+4]=M+1,Y[T+5]=M+2,Y[T+6]=M+2,Y[T+7]=M+3,T+=8,M+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(Z){y=0;for(I=Z.length;y<I;y++)q=Z[y],q.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,
q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,u))}if(Ea){y=0;for(I=Ga.length;y<I;y++)e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[y]),e.bufferData(e.ARRAY_BUFFER,qa[y],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,u));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,
p.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,u));z>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=
!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+
1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,p=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||p)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=
function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return db}};
THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
+294
View File
@@ -0,0 +1,294 @@
<!doctype html>
<html lang="en">
<head>
<title>three.js webgl - materials</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #000;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script type="text/javascript" src="../src/Three.js"></script>
<script type="text/javascript" src="../src/core/Clock.js"></script>
<script type="text/javascript" src="../src/core/Color.js"></script>
<script type="text/javascript" src="../src/core/Vector2.js"></script>
<script type="text/javascript" src="../src/core/Vector3.js"></script>
<script type="text/javascript" src="../src/core/Vector4.js"></script>
<script type="text/javascript" src="../src/core/Ray.js"></script>
<script type="text/javascript" src="../src/core/Rectangle.js"></script>
<script type="text/javascript" src="../src/core/Math.js"></script>
<script type="text/javascript" src="../src/core/Matrix3.js"></script>
<script type="text/javascript" src="../src/core/Matrix4.js"></script>
<script type="text/javascript" src="../src/core/Object3D.js"></script>
<script type="text/javascript" src="../src/core/Projector.js"></script>
<script type="text/javascript" src="../src/core/Quaternion.js"></script>
<script type="text/javascript" src="../src/core/Vertex.js"></script>
<script type="text/javascript" src="../src/core/Face3.js"></script>
<script type="text/javascript" src="../src/core/Face4.js"></script>
<script type="text/javascript" src="../src/core/UV.js"></script>
<script type="text/javascript" src="../src/core/Geometry.js"></script>
<script type="text/javascript" src="../src/core/Spline.js"></script>
<script type="text/javascript" src="../src/core/Edge.js"></script>
<script type="text/javascript" src="../src/cameras/Camera.js"></script>
<script type="text/javascript" src="../src/cameras/OrthographicCamera.js"></script>
<script type="text/javascript" src="../src/cameras/PerspectiveCamera.js"></script>
<script type="text/javascript" src="../src/lights/Light.js"></script>
<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
<script type="text/javascript" src="../src/lights/PointLight.js"></script>
<script type="text/javascript" src="../src/lights/SpotLight.js"></script>
<script type="text/javascript" src="../src/materials/Material.js"></script>
<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ShaderMaterial.js"></script>
<script type="text/javascript" src="../src/textures/Texture.js"></script>
<script type="text/javascript" src="../src/textures/DataTexture.js"></script>
<script type="text/javascript" src="../src/objects/Particle.js"></script>
<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
<script type="text/javascript" src="../src/objects/Line.js"></script>
<script type="text/javascript" src="../src/objects/Mesh.js"></script>
<script type="text/javascript" src="../src/objects/Bone.js"></script>
<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
<script type="text/javascript" src="../src/objects/MorphAnimMesh.js"></script>
<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
<script type="text/javascript" src="../src/objects/LOD.js"></script>
<script type="text/javascript" src="../src/objects/Sprite.js"></script>
<script type="text/javascript" src="../src/scenes/Scene.js"></script>
<script type="text/javascript" src="../src/scenes/Fog.js"></script>
<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderTarget.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderTargetCube.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
<script type="text/javascript" src="../src/extras/ColorUtils.js"></script>
<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
<script type="text/javascript" src="../src/extras/core/Curve.js"></script>
<script type="text/javascript" src="../src/extras/core/CurvePath.js"></script>
<script type="text/javascript" src="../src/extras/core/Path.js"></script>
<script type="text/javascript" src="../src/extras/core/Shape.js"></script>
<script type="text/javascript" src="../src/extras/core/TextPath.js"></script>
<script type="text/javascript" src="../src/extras/animation/AnimationHandler.js"></script>
<script type="text/javascript" src="../src/extras/animation/Animation.js"></script>
<script type="text/javascript" src="../src/extras/cameras/CubeCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/FirstPersonCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/FlyCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/RollCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/TrackballCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/CombinedCamera.js"></script>
<script type="text/javascript" src="../src/extras/controls/FirstPersonControls.js"></script>
<script type="text/javascript" src="../src/extras/controls/PathControls.js"></script>
<script type="text/javascript" src="../src/extras/controls/FlyControls.js"></script>
<script type="text/javascript" src="../src/extras/controls/RollControls.js"></script>
<script type="text/javascript" src="../src/extras/controls/TrackballControls.js"></script>
<script type="text/javascript" src="../src/extras/geometries/CubeGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/CylinderGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/ExtrudeGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/IcosahedronGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/LatheGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/OctahedronGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/PlaneGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/SphereGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TextGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TorusGeometry.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TorusKnotGeometry.js"></script>
<script type="text/javascript" src="../src/extras/modifiers/SubdivisionModifier.js"></script>
<script type="text/javascript" src="../src/extras/loaders/Loader.js"></script>
<script type="text/javascript" src="../src/extras/loaders/BinaryLoader.js"></script>
<script type="text/javascript" src="../src/extras/loaders/ColladaLoader.js"></script>
<script type="text/javascript" src="../src/extras/loaders/JSONLoader.js"></script>
<script type="text/javascript" src="../src/extras/loaders/SceneLoader.js"></script>
<script type="text/javascript" src="../src/extras/loaders/UTF8Loader.js"></script>
<script type="text/javascript" src="../src/extras/objects/Axes.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="../src/extras/physics/Collisions.js"></script>
<script type="text/javascript" src="../src/extras/physics/CollisionUtils.js"></script>
<script type="text/javascript" src="../src/extras/renderers/AnaglyphWebGLRenderer.js"></script>
<script type="text/javascript" src="../src/extras/renderers/CrosseyedWebGLRenderer.js"></script>
<script src="js/Detector.js"></script>
<script src="js/RequestAnimationFrame.js"></script>
<script src="js/Stats.js"></script>
<script>
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container, stats;
var camera, scene, renderer, objects;
var particleLight, pointLight;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.set( 0, 200, 0 );
scene = new THREE.Scene();
// Materials
var imgTexture2 = THREE.ImageUtils.loadTexture( "textures/planets/moon_1024.jpg" );
var imgTexture = THREE.ImageUtils.loadTexture( "textures/lava/lavatile.jpg" );
imgTexture.repeat.set( 4, 2 );
imgTexture.wrapS = imgTexture.wrapT = THREE.RepeatWrapping;
var shininess = 15, shading = THREE.SmoothShading;
var materials = [];
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture, color: 0xffffff, ambient: 0x777777, specular: 0x999999, shininess: shininess, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture, color: 0x00ff00, ambient: 0x777777, specular: 0x999999, shininess: shininess, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture, color: 0x00ff00, ambient: 0x007700, specular: 0x999999, shininess: shininess, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture, color: 0x000000, ambient: 0x00ff00, specular: 0x999999, shininess: shininess, shading: shading } ) );
materials.push( new THREE.MeshLambertMaterial( { map: imgTexture, color: 0xffffff, ambient: 0x777777, shading: shading } ) );
materials.push( new THREE.MeshLambertMaterial( { map: imgTexture, color: 0xff0000, ambient: 0x777777, shading: shading } ) );
materials.push( new THREE.MeshLambertMaterial( { map: imgTexture, color: 0xff0000, ambient: 0x770000, shading: shading } ) );
materials.push( new THREE.MeshLambertMaterial( { map: imgTexture, color: 0x000000, ambient: 0xff0000, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, color: 0x000000, ambient: 0x000000, specular: 0xffaa00, shininess: shininess, metal: true, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, color: 0x000000, ambient: 0x000000, specular: 0xaaff00, shininess: shininess, metal: true, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, color: 0x000000, ambient: 0x000000, specular: 0x00ffaa, shininess: shininess, metal: true, shading: shading } ) );
materials.push( new THREE.MeshPhongMaterial( { map: imgTexture2, color: 0x000000, ambient: 0x000000, specular: 0x00aaff, shininess: shininess, metal: true, shading: shading } ) );
// Spheres geometry
var geometry_smooth = new THREE.SphereGeometry( 70, 32, 16 );
var geometry_flat = new THREE.SphereGeometry( 70, 32, 16 );
objects = [];
var sphere, geometry, material;
for ( var i = 0, l = materials.length; i < l; i ++ ) {
material = materials[ i ];
geometry = material.shading == THREE.FlatShading ? geometry_flat : geometry_smooth;
sphere = new THREE.Mesh( geometry, material );
sphere.position.x = ( i % 4 ) * 200 - 200;
sphere.position.z = Math.floor( i / 4 ) * 200 - 200;
objects.push( sphere );
scene.add( sphere );
}
particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
scene.add( particleLight );
// Lights
scene.add( new THREE.AmbientLight( 0x444444 ) );
var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
directionalLight.position.set( 1, 1, 1 ).normalize();
scene.add( directionalLight );
pointLight = new THREE.PointLight( 0xffffff, 2, 800 );
scene.add( pointLight );
particleLight.materials[ 0 ].color = pointLight.color;
pointLight.position = particleLight.position;
//
renderer = new THREE.WebGLRenderer( { clearColor: 0x0a0a0a, clearAlpha: 1, antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.sortObjects = true;
container.appendChild( renderer.domElement );
renderer.gammaInput = true;
renderer.gammaOutput = true;
//renderer.physicallyBasedShading = true;
//
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
function render() {
var timer = Date.now() * 0.00025;
camera.position.x = Math.cos( timer ) * 800;
camera.position.z = Math.sin( timer ) * 800;
camera.lookAt( scene.position );
for ( var i = 0, l = objects.length; i < l; i ++ ) {
var object = objects[ i ];
object.rotation.y += 0.005;
}
particleLight.position.x = Math.sin( timer * 7 ) * 300;
particleLight.position.y = Math.cos( timer * 5 ) * 400;
particleLight.position.z = Math.cos( timer * 3 ) * 300;
renderer.render( scene, camera );
}
</script>
</body>
</html>
+2
View File
@@ -43,6 +43,8 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this.specular = parameters.specular !== undefined ? new THREE.Color( parameters.specular ) : new THREE.Color( 0x111111 );
this.shininess = parameters.shininess !== undefined ? parameters.shininess : 30;
this.metal = parameters.metal !== undefined ? parameters.metal : false;
this.map = parameters.map !== undefined ? parameters.map : null;
this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
+4 -1
View File
@@ -2744,7 +2744,8 @@ THREE.WebGLRenderer = function ( parameters ) {
shadowMapWidth: this.shadowMapWidth,
shadowMapHeight: this.shadowMapHeight,
maxShadows: maxShadows,
alphaTest: material.alphaTest
alphaTest: material.alphaTest,
metal: material.metal
};
@@ -4932,6 +4933,8 @@ THREE.WebGLRenderer = function ( parameters ) {
parameters.lightMap ? "#define USE_LIGHTMAP" : "",
parameters.vertexColors ? "#define USE_COLOR" : "",
parameters.metal ? "#define METAL" : "",
parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "",
parameters.shadowMapSoft ? "#define SHADOWMAP_SOFT" : "",
parameters.shadowMapSoft ? "#define SHADOWMAP_WIDTH " + parameters.shadowMapWidth.toFixed( 1 ) : "",
+9 -1
View File
@@ -505,7 +505,15 @@ THREE.ShaderChunk = {
"#endif",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;"
"#ifdef METAL",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );",
"#else",
"gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
"#endif",
].join("\n"),