提交 f1041824 编写于 作者: A alteredq

Added handling of texture repeat and offset to WebGLRenderer.

上级 95bb462e
......@@ -49,7 +49,7 @@ THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;thi
e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*h+d*k-e*j;this.y=d*b+f*j+e*h-c*k;this.z=e*b+f*k+c*j-d*h;this.w=f*b-c*h-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,h=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*f-k*e,o=
m*e+k*d-h*f,p=m*f+h*e-j*d,d=-h*d-j*e-k*f;c.x=n*m+d*-h+o*-k-p*-j;c.y=o*m+d*-j+p*-h-n*-k;c.z=p*m+d*-k+n*-j-o*-h;return c}};
THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*h)/j;e=Math.sin(e*h)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Face3=function(b,c,d,e,f,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
THREE.Face4=function(b,c,d,e,f,h,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
......@@ -96,12 +96,13 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
THREE.ParticleBasicMaterial=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.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=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.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
THREE.Texture=function(b,c,d,e,f,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;
THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;
THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
THREE.Texture=function(b,c,d,e,f,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
......@@ -189,16 +190,16 @@ C.positionScreen.y),x.addPoint(E.positionScreen.x,E.positionScreen.y),x.addPoint
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",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 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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",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 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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\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#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 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 + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
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\nvColor = color;\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"};THREE.UniformsUtils={merge:function(b){var c,d,e,f={};for(c=0;c<b.length;c++)for(d in e=this.clone(b[c]),e)f[d]=e[d];return f},clone:function(b){var c,d,e,f={};for(c in b)for(d in f[c]={},b[c])e=b[c][d],f[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e;return f}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},
fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",
value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},
map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
......@@ -222,27 +223,27 @@ o[f+2]=color.b}else{if(u)for(e=0;e<k;e++)h=j[e].position,f=e*3,p[f]=h.x,p[f+1]=h
O=f);g.uniformMatrix4fv(j.projectionMatrix,!1,P);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,
n,p=0,o=0,t=0,u,v,y,x,E=ea,C=E.directional.colors,F=E.directional.positions,D=E.point.colors,I=E.point.positions,J=E.point.distances,G=0,B=0,c=n=x=0;for(m=d.length;c<m;c++)if(n=d[c],u=n.color,v=n.position,y=n.intensity,x=n.distance,n instanceof THREE.AmbientLight)p+=u.r,o+=u.g,t+=u.b;else if(n instanceof THREE.DirectionalLight)x=G*3,C[x]=u.r*y,C[x+1]=u.g*y,C[x+2]=u.b*y,F[x]=v.x,F[x+1]=v.y,F[x+2]=v.z,G+=1;else if(n instanceof THREE.PointLight)n=B*3,D[n]=u.r*y,D[n+1]=u.g*y,D[n+2]=u.b*y,I[n]=v.x,I[n+
1]=v.y,I[n+2]=v.z,J[B]=x,B+=1;for(c=G*3;c<C.length;c++)C[c]=0;for(c=B*3;c<D.length;c++)D[c]=0;E.point.length=B;E.directional.length=G;E.ambient[0]=p;E.ambient[1]=o;E.ambient[2]=t;c=ea;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof
THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,k.map.texture=e.map,k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;
else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=ha.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var Xa in k)if(o=f.uniforms[Xa])if(m=
k[Xa],p=m.type,c=m.value,p=="i")g.uniform1i(o,c);else if(p=="f")g.uniform1f(o,c);else if(p=="fv1")g.uniform1fv(o,c);else if(p=="fv")g.uniform3fv(o,c);else if(p=="v2")g.uniform2f(o,c.x,c.y);else if(p=="v3")g.uniform3f(o,c.x,c.y,c.z);else if(p=="v4")g.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")g.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(g.uniform1i(o,c),m=m.texture))if(m.image instanceof Array&&m.image.length==6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){g.bindTexture(g.TEXTURE_CUBE_MAP,
m.image.__webglTextureCube);for(p=0;p<6;++p)g.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,g.RGBA,g.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=g.createTexture();g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}A(g.TEXTURE_CUBE_MAP,m,m.image[0]);g.bindTexture(g.TEXTURE_CUBE_MAP,null);m.needsUpdate=!1}g.activeTexture(g.TEXTURE0+c);g.bindTexture(g.TEXTURE_CUBE_MAP,
m.image.__webglTextureCube)}}else z(m,c);g.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);g.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&g.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==null&&g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(e instanceof
THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&g.uniformMatrix4fv(j.viewMatrix,!1,W);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,g.uniform3fv(j.directionalLightDirection,b),g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray),g.uniformMatrix4fv(j.viewMatrix,!1,W);e.skinning&&(g.uniformMatrix4fv(j.cameraInverseMatrix,
!1,W),g.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return f}function e(b,c,e,h,f,j){if(h.opacity!=0){var k,b=d(b,c,e,h,j).attributes;if(!h.morphTargets&&b.position>=0)g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.vertexAttribPointer(b.position,3,g.FLOAT,!1,0,0);else{c=h.program.attributes;j.morphTargetBase!==-1?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j.morphTargetBase]),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):c.position>=0&&(g.bindBuffer(g.ARRAY_BUFFER,
f.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;e<h.numSupportedMorphTargets&&e<m.length;)g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m[e]]),g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=n[m[e]],e++;else{var m=[],p=-1,o=0,n=j.morphTargetInfluences,t,u=n.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=
!0);e<h.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&n[t]>p&&(o=t,p=n[o]);g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[o]=1;p=-1;e++}}h.program.uniforms.morphTargetInfluences!==null&&g.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(f.__webglCustomAttributes)for(k in f.__webglCustomAttributes)b[k]>=0&&(c=f.__webglCustomAttributes[k],g.bindBuffer(g.ARRAY_BUFFER,
c.buffer),g.vertexAttribPointer(b[k],c.size,g.FLOAT,!1,0,0));b.color>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglColorBuffer),g.vertexAttribPointer(b.color,3,g.FLOAT,!1,0,0));b.normal>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));b.tangent>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUVBuffer),g.vertexAttribPointer(b.uv,
2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUV2Buffer),g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),
g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(g.lineWidth(h.wireframeLinewidth),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),g.drawElements(g.LINES,f.__webglLineCount,g.UNSIGNED_SHORT,0)):(g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,
f.__webglFaceBuffer),g.drawElements(g.TRIANGLES,f.__webglFaceCount,g.UNSIGNED_SHORT,0)),N.data.vertices+=f.__webglFaceCount,N.data.faces+=f.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?g.LINE_STRIP:g.LINES,g.lineWidth(h.linewidth),g.drawArrays(j,0,f.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,f.__webglParticleCount),N.data.drawCalls++):j instanceof THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,f.__webglVertexCount),
N.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=g.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=g.createBuffer();b.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,b.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(d.attributes.position),g.vertexAttribPointer(d.attributes.position,3,g.FLOAT,!1,0,0));if(b.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,
f,h,j,k,m,n,p,o,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],h=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],n=c[t+7],o=c[t+8],e=(e+j+k)/3,f=(f+m+n)/3,h=(h+p+o)/3,c[t]=e,c[t+1]=f,c[t+2]=h,c[t+3]=e,c[t+4]=f,c[t+5]=h,c[t+6]=e,c[t+7]=f,c[t+8]=h}g.bufferData(g.ARRAY_BUFFER,b.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(d.attributes.normal);g.vertexAttribPointer(d.attributes.normal,3,g.FLOAT,!1,0,0)}g.drawArrays(g.TRIANGLES,0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?
g.disable(g.CULL_FACE):g.enable(g.CULL_FACE),$=b.doubleSided;if(T!=b.flipSided)b.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW),T=b.flipSided}function j(b){fa!=b&&(b?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),fa=b)}function k(b){aa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,
b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=aa[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function m(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=aa[e].x*d.n14+aa[e].y*d.n24+aa[e].z*d.n34+aa[e].w,b<=c)return!1;return!0}function n(b,d){b.list[b.count]=d;b.count+=1}function o(b){var d,c,e=b.object,g=b.opaque,f=b.transparent;f.count=0;b=g.count=
0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?n(f,c):n(g,c)}function p(b){var d,c,e,g,f=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)if(d=f.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(g=h.materials[d])&&(g.transparent?n(k,g):n(j,g))}else(g=d)&&(g.transparent?n(k,g):n(j,g))}function t(b,d){return d.z-b.z}function u(b){g.enable(g.POLYGON_OFFSET_FILL);g.polygonOffset(0.1,1);g.enable(g.STENCIL_TEST);
g.enable(g.DEPTH_TEST);g.depthMask(!1);g.colorMask(!1,!1,!1,!1);g.stencilFunc(g.ALWAYS,1,255);g.stencilOpSeparate(g.BACK,g.KEEP,g.INCR,g.KEEP);g.stencilOpSeparate(g.FRONT,g.KEEP,g.DECR,g.KEEP);var d,c=b.lights.length,e,f=b.lights,h=[],j,k,m,n,p,o=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){h[0]=-e.position.x;h[1]=-e.position.y;h[2]=-e.position.z;for(p=0;p<o;p++)e=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,
k=e.materials[0],k.program||N.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,n=k.attributes,O!==k&&(g.useProgram(k),O=k,g.uniformMatrix4fv(m.projectionMatrix,!1,P),g.uniformMatrix4fv(m.viewMatrix,!1,W),g.uniform3fv(m.directionalLightDirection,h)),e.matrixWorld.flattenToArray(e._objectMatrixArray),g.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),g.bindBuffer(g.ARRAY_BUFFER,j.__webglVertexBuffer),g.vertexAttribPointer(n.position,3,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,j.__webglNormalBuffer),
g.vertexAttribPointer(n.normal,3,g.FLOAT,!1,0,0),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),g.cullFace(g.FRONT),g.drawElements(g.TRIANGLES,j.__webglFaceCount,g.UNSIGNED_SHORT,0),g.cullFace(g.BACK),g.drawElements(g.TRIANGLES,j.__webglFaceCount,g.UNSIGNED_SHORT,0)}g.disable(g.POLYGON_OFFSET_FILL);g.colorMask(!0,!0,!0,!0);g.stencilFunc(g.NOTEQUAL,0,255);g.stencilOp(g.KEEP,g.KEEP,g.KEEP);g.disable(g.DEPTH_TEST);Q=-1;O=Z.program;g.useProgram(Z.program);g.uniformMatrix4fv(Z.projectionLocation,
THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=ha.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof
THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var Xa in k)if(o=f.uniforms[Xa])if(m=k[Xa],p=m.type,c=m.value,p=="i")g.uniform1i(o,c);else if(p=="f")g.uniform1f(o,c);else if(p=="fv1")g.uniform1fv(o,c);else if(p=="fv")g.uniform3fv(o,c);else if(p=="v2")g.uniform2f(o,c.x,c.y);else if(p=="v3")g.uniform3f(o,c.x,c.y,c.z);else if(p=="v4")g.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")g.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(g.uniform1i(o,c),m=m.texture))if(m.image instanceof Array&&m.image.length==
6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,g.RGBA,g.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=g.createTexture();g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}A(g.TEXTURE_CUBE_MAP,m,m.image[0]);g.bindTexture(g.TEXTURE_CUBE_MAP,
null);m.needsUpdate=!1}g.activeTexture(g.TEXTURE0+c);g.bindTexture(g.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else z(m,c);g.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);g.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&g.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==
null&&g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&g.uniformMatrix4fv(j.viewMatrix,!1,W);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,g.uniform3fv(j.directionalLightDirection,b),g.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray),
g.uniformMatrix4fv(j.viewMatrix,!1,W);e.skinning&&(g.uniformMatrix4fv(j.cameraInverseMatrix,!1,W),g.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return f}function e(b,c,e,h,f,j){if(h.opacity!=0){var k,b=d(b,c,e,h,j).attributes;if(!h.morphTargets&&b.position>=0)g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.vertexAttribPointer(b.position,3,g.FLOAT,!1,0,0);else{c=h.program.attributes;j.morphTargetBase!==-1?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j.morphTargetBase]),
g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0)):c.position>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglVertexBuffer),g.vertexAttribPointer(c.position,3,g.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;e<h.numSupportedMorphTargets&&e<m.length;)g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m[e]]),g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=n[m[e]],e++;else{var m=[],p=-1,
o=0,n=j.morphTargetInfluences,t,u=n.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);e<h.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&n[t]>p&&(o=t,p=n[o]);g.bindBuffer(g.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);g.vertexAttribPointer(c["morphTarget"+e],3,g.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[o]=1;p=-1;e++}}h.program.uniforms.morphTargetInfluences!==null&&g.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(f.__webglCustomAttributes)for(k in f.__webglCustomAttributes)b[k]>=
0&&(c=f.__webglCustomAttributes[k],g.bindBuffer(g.ARRAY_BUFFER,c.buffer),g.vertexAttribPointer(b[k],c.size,g.FLOAT,!1,0,0));b.color>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglColorBuffer),g.vertexAttribPointer(b.color,3,g.FLOAT,!1,0,0));b.normal>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));b.tangent>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,
f.__webglUVBuffer),g.vertexAttribPointer(b.uv,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,f.__webglUV2Buffer),g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,
g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(g.lineWidth(h.wireframeLinewidth),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),g.drawElements(g.LINES,f.__webglLineCount,
g.UNSIGNED_SHORT,0)):(g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),g.drawElements(g.TRIANGLES,f.__webglFaceCount,g.UNSIGNED_SHORT,0)),N.data.vertices+=f.__webglFaceCount,N.data.faces+=f.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?g.LINE_STRIP:g.LINES,g.lineWidth(h.linewidth),g.drawArrays(j,0,f.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,f.__webglParticleCount),N.data.drawCalls++):j instanceof
THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,f.__webglVertexCount),N.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=g.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=g.createBuffer();b.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,b.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,b.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(d.attributes.position),g.vertexAttribPointer(d.attributes.position,3,g.FLOAT,!1,0,0));if(b.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,
b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,h,j,k,m,n,p,o,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],h=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],n=c[t+7],o=c[t+8],e=(e+j+k)/3,f=(f+m+n)/3,h=(h+p+o)/3,c[t]=e,c[t+1]=f,c[t+2]=h,c[t+3]=e,c[t+4]=f,c[t+5]=h,c[t+6]=e,c[t+7]=f,c[t+8]=h}g.bufferData(g.ARRAY_BUFFER,b.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(d.attributes.normal);g.vertexAttribPointer(d.attributes.normal,3,g.FLOAT,!1,0,0)}g.drawArrays(g.TRIANGLES,
0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE),$=b.doubleSided;if(T!=b.flipSided)b.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW),T=b.flipSided}function j(b){fa!=b&&(b?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),fa=b)}function k(b){aa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);aa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);aa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);aa[3].set(b.n41-b.n21,
b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);aa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);aa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=aa[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function m(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=aa[e].x*d.n14+aa[e].y*d.n24+aa[e].z*d.n34+aa[e].w,b<=c)return!1;return!0}function n(b,d){b.list[b.count]=d;b.count+=1}function o(b){var d,
c,e=b.object,g=b.opaque,f=b.transparent;f.count=0;b=g.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?n(f,c):n(g,c)}function p(b){var d,c,e,g,f=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)if(d=f.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(g=h.materials[d])&&(g.transparent?n(k,g):n(j,g))}else(g=d)&&(g.transparent?n(k,g):n(j,g))}function t(b,d){return d.z-b.z}function u(b){g.enable(g.POLYGON_OFFSET_FILL);
g.polygonOffset(0.1,1);g.enable(g.STENCIL_TEST);g.enable(g.DEPTH_TEST);g.depthMask(!1);g.colorMask(!1,!1,!1,!1);g.stencilFunc(g.ALWAYS,1,255);g.stencilOpSeparate(g.BACK,g.KEEP,g.INCR,g.KEEP);g.stencilOpSeparate(g.FRONT,g.KEEP,g.DECR,g.KEEP);var d,c=b.lights.length,e,f=b.lights,h=[],j,k,m,n,p,o=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){h[0]=-e.position.x;h[1]=-e.position.y;h[2]=-e.position.z;for(p=0;p<o;p++)e=b.__webglShadowVolumes[p].object,
j=b.__webglShadowVolumes[p].buffer,k=e.materials[0],k.program||N.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,n=k.attributes,O!==k&&(g.useProgram(k),O=k,g.uniformMatrix4fv(m.projectionMatrix,!1,P),g.uniformMatrix4fv(m.viewMatrix,!1,W),g.uniform3fv(m.directionalLightDirection,h)),e.matrixWorld.flattenToArray(e._objectMatrixArray),g.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),g.bindBuffer(g.ARRAY_BUFFER,j.__webglVertexBuffer),g.vertexAttribPointer(n.position,3,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,
j.__webglNormalBuffer),g.vertexAttribPointer(n.normal,3,g.FLOAT,!1,0,0),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),g.cullFace(g.FRONT),g.drawElements(g.TRIANGLES,j.__webglFaceCount,g.UNSIGNED_SHORT,0),g.cullFace(g.BACK),g.drawElements(g.TRIANGLES,j.__webglFaceCount,g.UNSIGNED_SHORT,0)}g.disable(g.POLYGON_OFFSET_FILL);g.colorMask(!0,!0,!0,!0);g.stencilFunc(g.NOTEQUAL,0,255);g.stencilOp(g.KEEP,g.KEEP,g.KEEP);g.disable(g.DEPTH_TEST);Q=-1;O=Z.program;g.useProgram(Z.program);g.uniformMatrix4fv(Z.projectionLocation,
!1,P);g.uniform1f(Z.darknessLocation,Z.darkness);g.bindBuffer(g.ARRAY_BUFFER,Z.vertexBuffer);g.vertexAttribPointer(Z.vertexLocation,3,g.FLOAT,!1,0,0);g.enableVertexAttribArray(Z.vertexLocation);g.blendFunc(g.ONE,g.ONE_MINUS_SRC_ALPHA);g.blendEquation(g.FUNC_ADD);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);g.disable(g.STENCIL_TEST);g.enable(g.DEPTH_TEST);g.depthMask(L)}function v(b,d){var c,e,f;c=_sprite.attributes;var h=_sprite.uniforms,j=
ca/ga,k,m=[],n=ga*0.5,p=ca*0.5,o=!0;g.useProgram(_sprite.program);O=_sprite.program;Q=-1;qa||(g.enableVertexAttribArray(_sprite.attributes.position),g.enableVertexAttribArray(_sprite.attributes.uv),qa=!0);g.disable(g.CULL_FACE);g.enable(g.BLEND);g.depthMask(!0);g.bindBuffer(g.ARRAY_BUFFER,_sprite.vertexBuffer);g.vertexAttribPointer(c.position,2,g.FLOAT,!1,16,0);g.vertexAttribPointer(c.uv,2,g.FLOAT,!1,16,8);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);g.uniformMatrix4fv(h.projectionMatrix,
!1,P);g.activeTexture(g.TEXTURE0);g.uniform1i(h.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(t);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(g.uniform1i(h.useScreenCoordinates,1),g.uniform3f(h.screenPosition,
......@@ -251,7 +252,7 @@ g.uniform1f(h.rotation,f.rotation),g.uniform2fv(h.scale,m),f.mergeWith3D&&!o?(g.
wa||(g.enableVertexAttribArray(K.attributes.vertex),g.enableVertexAttribArray(K.attributes.uv),wa=!0);g.uniform1i(x.occlusionMap,0);g.uniform1i(x.map,1);g.bindBuffer(g.ARRAY_BUFFER,K.vertexBuffer);g.vertexAttribPointer(c.vertex,2,g.FLOAT,!1,16,0);g.vertexAttribPointer(c.uv,2,g.FLOAT,!1,16,8);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,K.elementBuffer);g.disable(g.CULL_FACE);g.depthMask(!1);g.activeTexture(g.TEXTURE0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.activeTexture(g.TEXTURE1);for(e=0;e<f;e++)if(c=
b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,y[0]=v[0]*p+p,y[1]=v[1]*o+o,K.hasVertexTexture||y[0]>0&&y[0]<ga&&y[1]>0&&y[1]<ca){g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGB,y[0]-8,y[1]-8,16,16,0);g.uniform1i(x.renderType,0);g.uniform2fv(x.scale,u);g.uniform3fv(x.screenPosition,v);g.disable(g.BLEND);g.enable(g.DEPTH_TEST);
g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);g.bindTexture(g.TEXTURE_2D,K.occlusionTexture);g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,y[0]-8,y[1]-8,16,16,0);g.uniform1i(x.renderType,1);g.disable(g.DEPTH_TEST);g.bindTexture(g.TEXTURE_2D,K.tempTexture);g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0);c.positionScreen.x=v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();g.uniform1i(x.renderType,2);g.enable(g.BLEND);h=0;for(j=c.lensFlares.length;h<
j;h++)if(k=c.lensFlares[h],k.opacity>0.001&&k.scale>0.001)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*n,u[1]=t,g.uniform3fv(x.screenPosition,v),g.uniform2fv(x.scale,u),g.uniform1f(x.rotation,k.rotation),g.uniform1f(x.opacity,k.opacity),I(k.blending),z(k.texture,1),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0)}g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
j;h++)if(k=c.lensFlares[h],k.opacity>0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/ca,u[0]=t*n,u[1]=t,g.uniform3fv(x.screenPosition,v),g.uniform2fv(x.scale,u),g.uniform1f(x.rotation,k.rotation),g.uniform1f(x.opacity,k.opacity),I(k.blending),z(k.texture,1),g.drawElements(g.TRIANGLES,6,g.UNSIGNED_SHORT,0)}g.enable(g.CULL_FACE);g.enable(g.DEPTH_TEST);g.depthMask(L)}function E(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
function y(b){var d,e,f,h,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(h in f.__webglCustomAttributes)if(f.__webglCustomAttributes[h].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=g.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,n=void 0,p=void 0,o=void 0,t=p=void 0,u=void 0,v=void 0,y=void 0,x=void 0,E=void 0,C=void 0,
F=void 0,ha=void 0,z=void 0,A=void 0,D=void 0,I=void 0,B=o=y=o=v=u=void 0,J=void 0,w=J=B=u=void 0,G=void 0,M=w=J=B=p=p=t=y=o=w=J=B=G=w=J=B=G=w=J=B=void 0,da=0,K=0,la=0,L=0,P=0,S=0,N=0,R=0,O=0,H=0,Q=0,J=B=0,U=f.__vertexArray,Z=f.__uvArray,$=f.__uv2Array,fa=f.__normalArray,T=f.__tangentArray,ma=f.__colorArray,V=f.__skinVertexAArray,W=f.__skinVertexBArray,X=f.__skinIndexArray,Y=f.__skinWeightArray,ga=f.__morphTargetsArrays,ca=f.__webglCustomAttributes,w=void 0,aa=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals,
E=f.__vertexColorType,x=f.__uvType,C=f.__normalType,oa=j.geometry,ya=oa.__dirtyVertices,va=oa.__dirtyElements,qa=oa.__dirtyUvs,wa=oa.__dirtyNormals,Ua=oa.__dirtyTangents,Va=oa.__dirtyColors,Wa=oa.__dirtyMorphTargets,Da=oa.vertices,Za=f.faces,bb=oa.faces,$a=oa.faceVertexUvs[0],ab=oa.faceVertexUvs[1],Ea=oa.skinVerticesA,Fa=oa.skinVerticesB,Ga=oa.skinIndices,xa=oa.skinWeights,Ba=j instanceof THREE.ShadowVolume?oa.edgeFaces:void 0;morphTargets=oa.morphTargets;if(ca)for(M in ca)ca[M].offset=0,ca[M].offsetSrc=
......@@ -329,8 +330,8 @@ e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new
f,d)}else if(d instanceof THREE.ParticleSystem){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=g.createBuffer(),e.__webglColorBuffer=g.createBuffer(),e=f,h=e.vertices.length,e.__vertexArray=new Float32Array(h*3),e.__colorArray=new Float32Array(h*3),e.__sortArray=[],e.__webglParticleCount=h,f.__dirtyVertices=!0,f.__dirtyColors=!0;x(c.__webglObjects,f,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},
transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&c.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];c=b;e=f=void 0;if(d instanceof THREE.Mesh)for(f=c.__webglObjects.length-1;f>=0;f--){if(e=c.__webglObjects[f].object,d==e){c.__webglObjects.splice(f,1);break}}else if(d instanceof THREE.Sprite)for(f=c.__webglSprites.length-1;f>=0;f--)if(e=c.__webglSprites[f],d==e){c.__webglSprites.splice(f,1);break}b.__objectsRemoved.splice(0,1)}d=
0;for(c=b.__webglObjects.length;d<c;d++)y(b.__webglObjects[d].object,b);d=0;for(c=b.__webglShadowVolumes.length;d<c;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(c=b.__webglLensFlares.length;d<c;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?g.frontFace(g.CCW):g.frontFace(g.CW),b=="back"?g.cullFace(g.BACK):b=="front"?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.supportsVertexTextures=function(){return va}};
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.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=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.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(void 0,!1,c);var d=b.sounds,e,f=d.length;for(e=0;e<f;e++)b=d[e],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
......@@ -372,7 +373,7 @@ this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=f,this.points[2]=h,thi
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,h,j,k,m,n;f=(b.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];n=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(h[0],k[0],m[0],n[0],f,d,j);e[1]=this.interpolate(h[1],k[1],m[1],n[1],f,d,j);e[2]=this.interpolate(h[2],k[2],m[2],n[2],f,d,j);return e};
THREE.Animation.prototype.interpolate=function(b,c,d,e,f,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
......@@ -384,7 +385,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
THREE.PathCamera=function(b){function c(b,d,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,j=d.getControlPointsArray(),k=d.getLength(),m=j.length,D=0;h=m-1;d={parent:-1,keys:[]};d.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};d.keys[h]={time:e,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<m-1;h++)D=e*k.chunks[h]/k.total,d.keys[h]={time:D,pos:j[h]};f.hierarchy[0]=d;THREE.AnimationHandler.add(f);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(b,d){var c,
e,f=new THREE.Geometry;for(c=0;c<b.points.length*d;c++)e=c/(b.points.length*d),e=b.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(b,c){var e=d(c,10),f=d(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);f=new THREE.Sphere(1,
16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,h),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,h=Math.PI/180;this.update=function(b,d,c){var e,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var k=j[1]-j[0];this.phi=
......@@ -392,7 +393,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j
b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,0);this.animation=c(this.animationParent,
this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,d){return function(){d.apply(b,arguments)}}(this,this.onMouseMove),!1)};
THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
......@@ -430,7 +431,7 @@ e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.
THREE.Icosahedron=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=f.vertices[b].position,h=f.vertices[d].position;return c((e.x+h.x)/2,(e.y+h.y)/2,(e.z+h.z)/2)}var f=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=e(h.faces[k].a,h.faces[k].b),n=e(h.faces[k].b,h.faces[k].c),o=e(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,m,o,j);d(h.faces[k].b,n,m,j);d(h.faces[k].c,
o,n,j);d(m,n,o,j)}h.faces=j.faces}f.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
THREE.Lathe=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.001;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=h;m==0&&(h=e);for(k=0;k<
THREE.Lathe=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=h;m==0&&(h=e);for(k=0;k<
e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
THREE.Plane=function(b,c,d,e){THREE.Geometry.call(this);var f,h=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(f*n-j),0)));for(f=0;f<e;f++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
......
......@@ -49,7 +49,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,k=j*c+f*e-h*d,m=
j*d+h*c-g*e,p=j*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=k*j+c*-g+m*-h-p*-f;b.y=m*j+c*-f+p*-g-k*-h;b.z=p*j+c*-h+k*-f-m*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
......@@ -84,12 +84,12 @@ THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.sha
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};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=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.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
THREE.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;
THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;
THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Texture=function(a,b,c,d,e,g){this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==void 0?e:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.overdraw=this.doubleSided=this.flipSided=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
......
......@@ -49,7 +49,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,k=i*c+f*e-h*d,l=
i*d+h*c-g*e,n=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=k*i+c*-g+l*-h-n*-f;b.y=l*i+c*-f+n*-g-k*-h;b.z=n*i+c*-h+k*-f-l*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
......
......@@ -35,7 +35,7 @@ this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,thi
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,j,h,l;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];j=a[c[1]];h=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],j[0],h[0],l[0],e,c,g);d[1]=this.interpolate(f[1],j[1],h[1],l[1],e,c,g);d[2]=this.interpolate(f[2],j[2],h[2],l[2],e,c,g);return d};
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
THREE.QuakeCamera=function(a){function b(a,d){return function(){d.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
THREE.QuakeCamera=function(a){function b(a,d){return function(){d.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=
......@@ -47,7 +47,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
THREE.QuakeCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
THREE.PathCamera=function(a){function b(a,c,d,b){var f={name:d,fps:0.6,length:b,hierarchy:[]},g,e=c.getControlPointsArray(),j=c.getLength(),h=e.length,w=0;g=h-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:e[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[g]={time:b,pos:e[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<h-1;g++)w=b*j.chunks[g]/j.total,c.keys[g]={time:w,pos:e[g]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var d,
b,f=new THREE.Geometry;for(d=0;d<a.points.length*c;d++)b=d/(a.points.length*c),b=a.getPoint(b),f.vertices[d]=new THREE.Vertex(new THREE.Vector3(b.x,b.y,b.z));return f}function d(a,d){var b=c(d,10),f=c(d,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(b,g);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);f=new THREE.Sphere(1,
16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<d.points.length;i++)b=new THREE.Mesh(f,g),b.position.copy(d.points[i]),b.updateMatrix(),a.addChild(b)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=
16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<d.points.length;i++)b=new THREE.Mesh(f,g),b.position.copy(d.points[i]),b.updateMatrix(),a.addChild(b)}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,f=Math.PI/180;this.update=function(a,c,d){var b,g;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;b=this.phi%e;this.phi=b>=0?b:b+e;b=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
......@@ -55,7 +55,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-b[0])*(g[1]-g[0])/(b[1]-b[0])+g[0]-g
a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.Cube(10,10,20),h=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(h,g);a.position.set(0,10,0);this.animation=b(this.animationParent,
this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),!1)};
THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
......@@ -93,7 +93,7 @@ d));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.
THREE.Icosahedron=function(a){function b(a,c,b){var d=Math.sqrt(a*a+c*c+b*b);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,c/d,b/d)))-1}function c(a,c,b,d){d.faces.push(new THREE.Face3(a,c,b))}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var j in f.faces){var h=d(f.faces[j].a,f.faces[j].b),l=d(f.faces[j].b,f.faces[j].c),k=d(f.faces[j].c,f.faces[j].a);c(f.faces[j].a,h,k,g);c(f.faces[j].b,l,h,g);c(f.faces[j].c,
k,l,g);c(h,l,k,g)}f.faces=g.faces}e.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
THREE.Lathe=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),d[j]=this.vertices.length-1;for(var h=0;h<=this.angle+0.001;h+=b){for(j=0;j<c.length;j++)h<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),e[j]=this.vertices.length-1):e=f;h==0&&(f=d);for(j=0;j<
THREE.Lathe=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),d[j]=this.vertices.length-1;for(var h=0;h<=this.angle+0.0010;h+=b){for(j=0;j<c.length;j++)h<this.angle?(c[j]=g.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),e[j]=this.vertices.length-1):e=f;h==0&&(f=d);for(j=0;j<
d.length-1;j++)this.faces.push(new THREE.Face4(e[j],e[j+1],d[j+1],d[j])),this.faceVertexUvs[0].push([new THREE.UV(1-h/this.angle,j/a.length),new THREE.UV(1-h/this.angle,(j+1)/a.length),new THREE.UV(1-(h-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(h-b)/this.angle,j/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
THREE.Plane=function(a,b,c,d){THREE.Geometry.call(this);var e,f=a/2,g=b/2,c=c||1,d=d||1,j=c+1,h=d+1;a/=c;var l=b/d;for(e=0;e<h;e++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-f,-(e*l-g),0)));for(e=0;e<d;e++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*e,b+j*(e+1),b+1+j*(e+1),b+1+j*e)),this.faceVertexUvs[0].push([new THREE.UV(b/c,e/d),new THREE.UV(b/c,(e+1)/d),new THREE.UV((b+1)/c,(e+1)/d),new THREE.UV((b+1)/c,e/d)]);this.computeCentroids();this.computeFaceNormals()};
THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
......
......@@ -49,7 +49,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d;this.z=a.z*d;this.w=Math.cos(c);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},
multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,l=i*c+f*e-h*d,k=
i*d+h*c-g*e,n=i*e+g*d-f*c,c=-g*c-f*d-h*e;b.x=l*i+c*-g+k*-h-n*-f;b.y=k*i+c*-f+n*-g-l*-h;b.z=n*i+c*-h+l*-f-k*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
......
......@@ -49,7 +49,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;thi
f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,h=this.w,i=b.x,g=b.y,j=b.z,b=b.w;this.x=d*b+h*i+e*j-f*g;this.y=e*b+h*g+f*i-d*j;this.z=f*b+h*j+d*g-e*i;this.w=h*b-d*i-e*g-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,h=b.z,i=this.x,g=this.y,j=this.z,p=this.w,k=p*e+g*h-j*f,n=
p*f+j*e-i*h,v=p*h+i*f-g*e,e=-i*e-g*f-j*h;d.x=k*p+e*-i+n*-j-v*-g;d.y=n*p+e*-g+v*-i-k*-j;d.z=v*p+e*-j+k*-g-n*-i;return d}};
THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.001)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Quaternion.slerp=function(b,d,e,f){var h=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
......@@ -94,7 +94,8 @@ b.fog!==void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexCol
THREE.ParticleBasicMaterial=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.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ShadowVolumeDynamicMaterial=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.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.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.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;THREE.Texture=function(b,d,e,f,h,i){this.image=b;this.mapping=d!==void 0?d:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
THREE.Texture=function(b,d,e,f,h,i){this.image=b;this.mapping=d!==void 0?d:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=i!==void 0?i:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,d,e){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
......@@ -150,16 +151,16 @@ THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElem
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",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 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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",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 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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\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#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 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 + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
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\nvColor = color;\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"};THREE.UniformsUtils={merge:function(b){var d,e,f,h={};for(d=0;d<b.length;d++)for(e in f=this.clone(b[d]),f)h[e]=f[e];return h},clone:function(b){var d,e,f,h={};for(d in b)for(e in h[d]={},b[d])f=b[d][e],h[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f;return h}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},
fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",
value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},
map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
......@@ -183,36 +184,36 @@ color.g,G[g+2]=color.b}else{if(n)for(f=0;f<j;f++)h=i[f].position,g=f*3,o[g]=h.x,
oa=g);c.uniformMatrix4fv(i.projectionMatrix,!1,fa);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
f.lights){var k,p,o=0,G=0,ua=0,n,r,v,q,t=Ba,z=t.directional.colors,y=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=p=q=0;for(k=d.length;e<k;e++)if(p=d[e],n=p.color,r=p.position,v=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)o+=n.r,G+=n.g,ua+=n.b;else if(p instanceof THREE.DirectionalLight)q=u*3,z[q]=n.r*v,z[q+1]=n.g*v,z[q+2]=n.b*v,y[q]=r.x,y[q+1]=r.y,y[q+2]=r.z,u+=1;else if(p instanceof THREE.PointLight)p=s*3,C[p]=n.r*v,C[p+1]=n.g*v,C[p+2]=
n.b*v,I[p]=r.x,I[p+1]=r.y,I[p+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<z.length;e++)z[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=o;t.ambient[1]=G;t.ambient[2]=ua;e=Ba;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,j.map.texture=f.map,j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=
f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=
f.opacity;for(var A in j)if(G=g.uniforms[A])if(k=j[A],o=k.type,e=k.value,o=="i")c.uniform1i(G,e);else if(o=="f")c.uniform1f(G,e);else if(o=="fv1")c.uniform1fv(G,e);else if(o=="fv")c.uniform3fv(G,e);else if(o=="v2")c.uniform2f(G,e.x,e.y);else if(o=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(o=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(o=="c")c.uniform3f(G,e.r,e.g,e.b);else if(o=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,
k.image.__webglTextureCube);for(o=0;o<6;++o)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[o])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(o=0;o<6;++o)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[o]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,
k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof
THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,
!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,
g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,p=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=p[k[f]],f++;else{var k=[],n=-1,o=0,p=i.morphTargetInfluences,G,ua=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=
!0);f<h.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&p[G]>n&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,
d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,
2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),
c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=g.__webglFaceCount,$.data.faces+=g.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),$.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),
$.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,
g,h,i,j,k,p,o,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],o=e[n+5],j=e[n+6],p=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+p)/3,h=(h+o+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided?
c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function g(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32,
b.n43-b.n33,b.n44-b.n34);N[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function k(b,c){b.list[b.count]=c;b.count+=1}function n(b){var c,d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=
e.materials.length;b<c;b++)d=e.materials[b],d.transparent?k(g,d):k(f,d)}function v(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?k(j,f):k(i,f))}else(f=c)&&(f.transparent?k(j,f):k(i,f))}function r(b,c){return c.z-b.z}function q(b){c.enable(c.POLYGON_OFFSET_FILL);c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);
c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,p,o,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(o=0;o<n;o++)f=b.__webglShadowVolumes[o].object,i=b.__webglShadowVolumes[o].buffer,
j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,p=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(p.position,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),
c.vertexAttribPointer(p.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);c.uniformMatrix4fv(u.projectionLocation,
!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;var h=_sprite.uniforms,
i=H/O,j,k=[],p=O*0.5,o=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=ia.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=
f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var A in j)if(G=g.uniforms[A])if(k=j[A],o=k.type,e=k.value,o=="i")c.uniform1i(G,e);else if(o=="f")c.uniform1f(G,e);else if(o=="fv1")c.uniform1fv(G,e);else if(o=="fv")c.uniform3fv(G,e);else if(o=="v2")c.uniform2f(G,e.x,e.y);else if(o=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(o=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(o=="c")c.uniform3f(G,e.r,e.g,e.b);else if(o=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof
Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(o=0;o<6;++o)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[o])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(o=0;o<6;++o)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[o]);k.__webglInit=!0}B(c.TEXTURE_CUBE_MAP,
k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else x(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||
f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,la);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,
!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,la);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,la),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),
c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,p=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=p[k[f]],f++;else{var k=[],n=-1,
o=0,p=i.morphTargetInfluences,G,ua=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(G=0;G<ua;G++)!k[G]&&p[G]>n&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=
0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,
g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,
c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,
c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),$.data.vertices+=g.__webglFaceCount,$.data.faces+=g.__webglFaceCount/3,$.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),$.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),$.data.drawCalls++):i instanceof
THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),$.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,
b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,p,o,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],o=e[n+5],j=e[n+6],p=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+p)/3,h=(h+o+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,
0,b.count);b.count=0}function i(b){if(pa!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),pa=b.doubleSided;if(ka!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),ka=b.flipSided}function g(b){ha!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),ha=b)}function j(b){N[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);N[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);N[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);N[3].set(b.n41-b.n21,
b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);N[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);N[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=N[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=N[e].x*c.n14+N[e].y*c.n24+N[e].z*c.n34+N[e].w,b<=d)return!1;return!0}function k(b,c){b.list[b.count]=c;b.count+=1}function n(b){var c,
d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?k(g,d):k(f,d)}function v(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?k(j,f):k(i,f))}else(f=c)&&(f.transparent?k(j,f):k(i,f))}function r(b,c){return c.z-b.z}function q(b){c.enable(c.POLYGON_OFFSET_FILL);
c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,p,o,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(o=0;o<n;o++)f=b.__webglShadowVolumes[o].object,
i=b.__webglShadowVolumes[o].buffer,j=f.materials[0],j.program||$.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,p=j.attributes,oa!==j&&(c.useProgram(j),oa=j,c.uniformMatrix4fv(k.projectionMatrix,!1,fa),c.uniformMatrix4fv(k.viewMatrix,!1,la),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(p.position,3,c.FLOAT,!1,0,0),
c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(p.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);M=-1;oa=u.program;c.useProgram(u.program);
c.uniformMatrix4fv(u.projectionLocation,!1,fa);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function z(b,d){var e,f,g;e=_sprite.attributes;
var h=_sprite.uniforms,i=H/O,j,k=[],p=O*0.5,o=H*0.5,n=!0;c.useProgram(_sprite.program);oa=_sprite.program;M=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
!1,fa);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
(g.position.x-p)/p,(o-g.position.y)/o,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:H),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),x(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,p=H/O,o=O*0.5,n=H*0.5,r=16/H,v=[r*p,r],q=[1,1,0],z=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);oa=t.program;M=-1;Ea||
(c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,z[0]=q[0]*o+o,z[1]=q[1]*n+n,t.hasVertexTexture||z[0]>0&&z[0]<O&&z[1]>0&&z[1]<H){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,z[0]-8,z[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
i;h++)if(j=e.lensFlares[h],j.opacity>0.001&&j.scale>0.001)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
i;h++)if(j=e.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/H,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),x(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ra)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
function y(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,z=void 0,y=void 0,
x=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,A=void 0,m=A=s=r=void 0,F=void 0,J=m=A=s=n=n=G=q=o=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,E=0,O=0,P=0,H=0,M=0,T=0,N=0,ca=0,w=0,da=0,A=s=0,L=g.__vertexArray,Z=g.__uvArray,$=g.__uv2Array,Q=g.__normalArray,U=g.__tangentArray,ea=g.__colorArray,V=g.__skinVertexAArray,W=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,aa=g.__morphTargetsArrays,R=g.__webglCustomAttributes,m=void 0,ma=g.__faceArray,S=g.__lineArray,ja=g.__needsSmoothNormals,
z=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ha=ga.__dirtyVertices,ia=ga.__dirtyElements,fa=ga.__dirtyUvs,ka=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,ra=ga.faces,sa=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],xa=ga.skinVerticesA,ya=ga.skinVerticesB,za=ga.skinIndices,va=ga.skinWeights,wa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0;morphTargets=ga.morphTargets;if(R)for(J in R)R[J].offset=0,R[J].offsetSrc=
......@@ -290,5 +291,5 @@ f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new
g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;Q(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},
transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];e=b;f=g=void 0;if(d instanceof THREE.Mesh)for(g=e.__webglObjects.length-1;g>=0;g--){if(f=e.__webglObjects[g].object,d==f){e.__webglObjects.splice(g,1);break}}else if(d instanceof THREE.Sprite)for(g=e.__webglSprites.length-1;g>=0;g--)if(f=e.__webglSprites[g],d==f){e.__webglSprites.splice(g,1);break}b.__objectsRemoved.splice(0,1)}d=
0;for(e=b.__webglObjects.length;d<e;d++)y(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)y(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)y(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:
!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
......@@ -69,7 +69,7 @@
camera = new THREE.PathCamera( {
fov: 40, aspect: window.viewportWidth / window.viewportHeight, near: 1, far: 1000,
fov: 40, aspect: window.innerWidth / window.innerHeight, near: 1, far: 1000,
waypoints: waypoints, duration: 28,
useConstantSpeed: true, resamplingCoef: 1,
createDebugPath: true, createDebugDummy: true,
......
......@@ -99,18 +99,6 @@
}
for( i = 0; i < geometry.faceVertexUvs[ 0 ].length; i++ ) {
var uvs = geometry.faceVertexUvs[ 0 ][ i ];
for ( j = 0, jl = uvs.length; j < jl; j++ ) {
uvs[ j ].u *= 5;
uvs[ j ].v *= 5;
}
}
//console.log( "triangles: " + geometry.faces.length * 2 + " faces: " + geometry.faces.length + " vertices: " + geometry.vertices.length );
......@@ -119,6 +107,7 @@
var texture = THREE.ImageUtils.loadTexture( "textures/water.jpg" );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 5, 5 );
material = new THREE.MeshBasicMaterial( { color:0x0044ff, opacity:1, map: texture } );
mesh = new THREE.Mesh( geometry, material );
......
......@@ -110,20 +110,10 @@
var xm = new THREE.MeshBasicMaterial( { map: new THREE.Texture( x, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping ) } );
xm.map.needsUpdate = true;
xm.map.repeat.set( 10, 10 );
geometry = new THREE.Plane( 100, 100, 15, 10 );
for( var i = 0; i < geometry.faceVertexUvs[ 0 ].length; i++ ) {
var uvs = geometry.faceVertexUvs[ 0 ][ i ];
for ( j = 0, jl = uvs.length; j < jl; j++ ) {
uvs[ j ].u *= 10;
uvs[ j ].v *= 10;
}
}
mesh = new THREE.Mesh( geometry, xm );
mesh.position.x = 0;
mesh.position.y = FLOOR;
......@@ -138,7 +128,8 @@
var material_spheres = new THREE.MeshLambertMaterial( { color: 0xdddddd } ),
sphere = new THREE.Sphere( 100, 16, 8 );
for (var i=0; i<10; i++) {
for ( var i=0; i<10; i++ ) {
mesh = new THREE.Mesh( sphere, material_spheres );
mesh.position.x = 500 * (Math.random() - 0.5);
mesh.position.y = 300 * (Math.random() - 0) + FLOOR;
......
......@@ -16,7 +16,7 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter )
this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
this.offset = new THREE.Vector2();
this.offset = new THREE.Vector2( 0, 0 );
this.repeat = new THREE.Vector2( 1, 1 );
this.needsUpdate = false;
......
......@@ -15,6 +15,9 @@ THREE.WebGLRenderTarget = function ( width, height, options ) {
this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;
this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;
this.offset = new THREE.Vector2( 0, 0 );
this.repeat = new THREE.Vector2( 1, 1 );
this.format = options.format !== undefined ? options.format : THREE.RGBAFormat;
this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;
......
......@@ -2162,7 +2162,13 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms.diffuse.value = material.color;
uniforms.opacity.value = material.opacity;
uniforms.map.texture = material.map;
if ( material.map ) {
uniforms.offsetRepeat.value.set( material.map.offset.x, material.map.offset.y, material.map.repeat.x, material.map.repeat.y );
}
uniforms.lightMap.texture = material.lightMap;
......@@ -2187,6 +2193,7 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms.opacity.value = material.opacity;
uniforms.size.value = material.size;
uniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this.
uniforms.map.texture = material.map;
};
......
......@@ -156,6 +156,7 @@ THREE.ShaderChunk = {
"#ifdef USE_MAP",
"varying vec2 vUv;",
"uniform vec4 offsetRepeat;",
"#endif"
......@@ -175,7 +176,7 @@ THREE.ShaderChunk = {
"#ifdef USE_MAP",
"vUv = uv;",
"vUv = uv * offsetRepeat.zw + offsetRepeat.xy;",
"#endif"
......@@ -575,7 +576,9 @@ THREE.UniformsLib = {
"diffuse" : { type: "c", value: new THREE.Color( 0xeeeeee ) },
"opacity" : { type: "f", value: 1.0 },
"map" : { type: "t", value: 0, texture: null },
"offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
"lightMap" : { type: "t", value: 2, texture: null },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册