|
@@ -48,7 +48,7 @@ c,d)}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==undefined?
|
|
THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,g=b.z*c;b=Math.cos(f);f=Math.sin(f);c=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*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*=
|
|
THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,g=b.z*c;b=Math.cos(f);f=Math.sin(f);c=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*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);if(b==0)this.w=this.z=this.y=this.x=0;else{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,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this},
|
|
-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);if(b==0)this.w=this.z=this.y=this.x=0;else{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,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this},
|
|
multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,w=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-w*-j;c.y=o*n+d*-j+w*-h-p*-k;c.z=w*n+d*-k+p*-j-o*-h;return c}};
|
|
multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,w=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-w*-j;c.y=o*n+d*-j+w*-h-p*-k;c.z=w*n+d*-k+p*-j-o*-h;return c}};
|
|
-THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){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);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
|
|
|
+THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){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);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
|
|
THREE.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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};
|
|
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};
|
|
@@ -265,8 +265,8 @@ xa.darkness);e.bindBuffer(e.ARRAY_BUFFER,xa.vertexBuffer);e.vertexAttribPointer(
|
|
I){e.disable(e.DEPTH_TEST);I=!1}J(z.blending);R(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function G(m,C){var x,u,z=m.__webglLensFlares.length,K,M,E,P=new THREE.Vector3,F=ja/ia,N=ia*0.5,I=ja*0.5,Y=16/ja,U=[Y*F,Y],ya=[1,1,0],wa=[1,1],ra=fa.uniforms;x=fa.attributes;e.useProgram(fa.program);Ca=fa.program;ga="";e.uniform1i(ra.occlusionMap,0);e.uniform1i(ra.map,1);e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.vertexAttribPointer(x.vertex,
|
|
I){e.disable(e.DEPTH_TEST);I=!1}J(z.blending);R(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function G(m,C){var x,u,z=m.__webglLensFlares.length,K,M,E,P=new THREE.Vector3,F=ja/ia,N=ia*0.5,I=ja*0.5,Y=16/ja,U=[Y*F,Y],ya=[1,1,0],wa=[1,1],ra=fa.uniforms;x=fa.attributes;e.useProgram(fa.program);Ca=fa.program;ga="";e.uniform1i(ra.occlusionMap,0);e.uniform1i(ra.map,1);e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.vertexAttribPointer(x.vertex,
|
|
2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,fa.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.activeTexture(e.TEXTURE1);for(u=0;u<z;u++){x=m.__webglLensFlares[u].object;P.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(P);C.projectionMatrix.multiplyVector3(P);ya[0]=P.x;ya[1]=P.y;ya[2]=P.z;wa[0]=ya[0]*N+N;wa[1]=
|
|
2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,fa.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.activeTexture(e.TEXTURE1);for(u=0;u<z;u++){x=m.__webglLensFlares[u].object;P.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(P);C.projectionMatrix.multiplyVector3(P);ya[0]=P.x;ya[1]=P.y;ya[2]=P.z;wa[0]=ya[0]*N+N;wa[1]=
|
|
ya[1]*I+I;if(fa.hasVertexTexture||wa[0]>0&&wa[0]<ia&&wa[1]>0&&wa[1]<ja){e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,0);e.uniform2fv(ra.scale,U);e.uniform3fv(ra.screenPosition,ya);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,1);e.disable(e.DEPTH_TEST);
|
|
ya[1]*I+I;if(fa.hasVertexTexture||wa[0]>0&&wa[0]<ia&&wa[1]>0&&wa[1]<ja){e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,0);e.uniform2fv(ra.scale,U);e.uniform3fv(ra.screenPosition,ya);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,1);e.disable(e.DEPTH_TEST);
|
|
-e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ya[0];x.positionScreen.y=ya[1];x.positionScreen.z=ya[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(ra.renderType,2);e.enable(e.BLEND);K=0;for(M=x.lensFlares.length;K<M;K++){E=x.lensFlares[K];if(E.opacity>0.0010&&E.scale>0.0010){ya[0]=E.x;ya[1]=E.y;ya[2]=E.z;Y=E.size*E.scale/ja;U[0]=Y*F;U[1]=Y;e.uniform3fv(ra.screenPosition,ya);e.uniform2fv(ra.scale,
|
|
|
|
-U);e.uniform1f(ra.rotation,E.rotation);e.uniform1f(ra.opacity,E.opacity);J(E.blending);R(E.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function H(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var C,x,u,z,K;if(m instanceof THREE.Mesh){x=m.geometry;for(C in x.geometryGroups){u=
|
|
|
|
|
|
+e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ya[0];x.positionScreen.y=ya[1];x.positionScreen.z=ya[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(ra.renderType,2);e.enable(e.BLEND);K=0;for(M=x.lensFlares.length;K<M;K++){E=x.lensFlares[K];if(E.opacity>0.001&&E.scale>0.001){ya[0]=E.x;ya[1]=E.y;ya[2]=E.z;Y=E.size*E.scale/ja;U[0]=Y*F;U[1]=Y;e.uniform3fv(ra.screenPosition,ya);e.uniform2fv(ra.scale,U);
|
|
|
|
+e.uniform1f(ra.rotation,E.rotation);e.uniform1f(ra.opacity,E.opacity);J(E.blending);R(E.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function H(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var C,x,u,z,K;if(m instanceof THREE.Mesh){x=m.geometry;for(C in x.geometryGroups){u=
|
|
x.geometryGroups[C];K=!1;for(z in u.__webglCustomAttributes)if(u.__webglCustomAttributes[z].needsUpdate){K=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||K){K=e.DYNAMIC_DRAW;var M=void 0,E=void 0,P=void 0,F=void 0;P=void 0;var N=void 0,I=void 0,Y=void 0,U=void 0,ya=void 0,wa=void 0,ra=void 0,Na=void 0,Sa=void 0,Ka=void 0,Ja=void 0,Ia=void 0,Wa=void 0;I=void 0;Y=void 0;F=void 0;U=void 0;F=void 0;var D=void 0,
|
|
x.geometryGroups[C];K=!1;for(z in u.__webglCustomAttributes)if(u.__webglCustomAttributes[z].needsUpdate){K=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||K){K=e.DYNAMIC_DRAW;var M=void 0,E=void 0,P=void 0,F=void 0;P=void 0;var N=void 0,I=void 0,Y=void 0,U=void 0,ya=void 0,wa=void 0,ra=void 0,Na=void 0,Sa=void 0,Ka=void 0,Ja=void 0,Ia=void 0,Wa=void 0;I=void 0;Y=void 0;F=void 0;U=void 0;F=void 0;var D=void 0,
|
|
da=void 0;I=void 0;D=void 0;da=void 0;var t=void 0,bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;F=void 0;U=void 0;N=void 0;P=void 0;P=void 0;D=void 0;da=void 0;t=void 0;var eb=void 0,Ta=0,Qa=0,hb=0,gb=0,cb=0,fb=0,sa=0,Va=0,Pa=0,T=0,Xa=0;da=D=0;var La=u.__vertexArray,W=u.__uvArray,za=u.__uv2Array,na=u.__normalArray,aa=u.__tangentArray,Ba=u.__colorArray,qa=u.__skinVertexAArray,ha=u.__skinVertexBArray,Q=u.__skinIndexArray,Ea=u.__skinWeightArray,
|
|
da=void 0;I=void 0;D=void 0;da=void 0;var t=void 0,bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;F=void 0;U=void 0;N=void 0;P=void 0;P=void 0;D=void 0;da=void 0;t=void 0;var eb=void 0,Ta=0,Qa=0,hb=0,gb=0,cb=0,fb=0,sa=0,Va=0,Pa=0,T=0,Xa=0;da=D=0;var La=u.__vertexArray,W=u.__uvArray,za=u.__uv2Array,na=u.__normalArray,aa=u.__tangentArray,Ba=u.__colorArray,qa=u.__skinVertexAArray,ha=u.__skinVertexBArray,Q=u.__skinIndexArray,Ea=u.__skinWeightArray,
|
|
ib=u.__morphTargetsArrays,Ya=u.__webglCustomAttributes;t=void 0;var Za=u.__faceArray,db=u.__lineArray,jb=u.__needsSmoothNormals;wa=u.__vertexColorType;ya=u.__uvType;ra=u.__normalType;var Ua=m.geometry,sb=Ua.__dirtyVertices,tb=Ua.__dirtyElements,rb=Ua.__dirtyUvs,ub=Ua.__dirtyNormals,vb=Ua.__dirtyTangents,wb=Ua.__dirtyColors,xb=Ua.__dirtyMorphTargets,nb=Ua.vertices,yb=u.faces,Bb=Ua.faces,zb=Ua.faceVertexUvs[0],Ab=Ua.faceVertexUvs[1],ob=Ua.skinVerticesA,pb=Ua.skinVerticesB,qb=Ua.skinIndices,lb=Ua.skinWeights,
|
|
ib=u.__morphTargetsArrays,Ya=u.__webglCustomAttributes;t=void 0;var Za=u.__faceArray,db=u.__lineArray,jb=u.__needsSmoothNormals;wa=u.__vertexColorType;ya=u.__uvType;ra=u.__normalType;var Ua=m.geometry,sb=Ua.__dirtyVertices,tb=Ua.__dirtyElements,rb=Ua.__dirtyUvs,ub=Ua.__dirtyNormals,vb=Ua.__dirtyTangents,wb=Ua.__dirtyColors,xb=Ua.__dirtyMorphTargets,nb=Ua.vertices,yb=u.faces,Bb=Ua.faces,zb=Ua.faceVertexUvs[0],Ab=Ua.faceVertexUvs[1],ob=Ua.skinVerticesA,pb=Ua.skinVerticesB,qb=Ua.skinIndices,lb=Ua.skinWeights,
|
|
@@ -304,26 +304,26 @@ null)}var C,x;if(m){C=m.__webglFramebuffer;x=m.width;m=m.height}else{C=null;x=ia
|
|
default:return e.LINEAR}}function $(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
|
|
default:return e.LINEAR}}function $(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
|
|
case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
|
|
case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
|
|
var e,ea=document.createElement("canvas"),Aa=[],Ca=null,Ha=null,X=!0,oa=this,pa=null,ta=null,ga=null,Z=null,la=0,Ga=0,ia=0,ja=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ra=new THREE.Matrix4,$a=new Float32Array(16),ab=new Float32Array(16),Oa=new THREE.Vector4,S={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ca=!0,ma=!0,Da=new THREE.Color(0),Ma=0;if(b){if(b.stencil!=
|
|
var e,ea=document.createElement("canvas"),Aa=[],Ca=null,Ha=null,X=!0,oa=this,pa=null,ta=null,ga=null,Z=null,la=0,Ga=0,ia=0,ja=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ra=new THREE.Matrix4,$a=new Float32Array(16),ab=new Float32Array(16),Oa=new THREE.Vector4,S={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ca=!0,ma=!0,Da=new THREE.Color(0),Ma=0;if(b){if(b.stencil!=
|
|
-undefined)ca=b.stencil;if(b.antialias!==undefined)ma=b.antialias;b.clearColor!==undefined&&Da.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ma=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ea;this.autoClear=!0;this.sortObjects=!0;(function(m,C,x,u){try{if(!(e=ea.getContext("experimental-webgl",{antialias:m,stencil:u})))throw"Error creating WebGL context.";}catch(z){console.error(z)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);
|
|
|
|
-e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,x)})(ma,Da,Ma,ca);this.context=e;if(ca){var xa={};xa.vertices=new Float32Array(12);xa.faces=new Uint16Array(6);xa.darkness=0.5;xa.vertices[0]=-20;xa.vertices[1]=-20;xa.vertices[2]=-1;xa.vertices[3]=20;xa.vertices[4]=-20;xa.vertices[5]=-1;xa.vertices[6]=20;xa.vertices[7]=20;xa.vertices[8]=-1;xa.vertices[9]=-20;xa.vertices[10]=20;xa.vertices[11]=-1;xa.faces[0]=
|
|
|
|
-0;xa.faces[1]=1;xa.faces[2]=2;xa.faces[3]=0;xa.faces[4]=2;xa.faces[5]=3;xa.vertexBuffer=e.createBuffer();xa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,xa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,xa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,xa.faces,e.STATIC_DRAW);xa.program=e.createProgram();e.attachShader(xa.program,ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(xa.program,ka("vertex",
|
|
|
|
-THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(xa.program);xa.vertexLocation=e.getAttribLocation(xa.program,"position");xa.projectionLocation=e.getUniformLocation(xa.program,"projectionMatrix");xa.darknessLocation=e.getUniformLocation(xa.program,"darkness")}var fa={};fa.vertices=new Float32Array(16);fa.faces=new Uint16Array(6);b=0;fa.vertices[b++]=-1;fa.vertices[b++]=-1;fa.vertices[b++]=0;fa.vertices[b++]=0;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=
|
|
|
|
-1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=1;b=0;fa.faces[b++]=0;fa.faces[b++]=1;fa.faces[b++]=2;fa.faces[b++]=0;fa.faces[b++]=2;fa.faces[b++]=3;fa.vertexBuffer=e.createBuffer();fa.elementBuffer=e.createBuffer();fa.tempTexture=e.createTexture();fa.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,fa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-fa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.texImage2D(e.TEXTURE_2D,
|
|
|
|
-0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){fa.hasVertexTexture=!1;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(fa.program,
|
|
|
|
-ka("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{fa.hasVertexTexture=!0;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(fa.program,ka("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(fa.program);fa.attributes={};fa.uniforms={};fa.attributes.vertex=e.getAttribLocation(fa.program,"position");fa.attributes.uv=e.getAttribLocation(fa.program,"UV");fa.uniforms.renderType=e.getUniformLocation(fa.program,
|
|
|
|
-"renderType");fa.uniforms.map=e.getUniformLocation(fa.program,"map");fa.uniforms.occlusionMap=e.getUniformLocation(fa.program,"occlusionMap");fa.uniforms.opacity=e.getUniformLocation(fa.program,"opacity");fa.uniforms.scale=e.getUniformLocation(fa.program,"scale");fa.uniforms.rotation=e.getUniformLocation(fa.program,"rotation");fa.uniforms.screenPosition=e.getUniformLocation(fa.program,"screenPosition");e.enableVertexAttribArray(fa.attributes.vertex);e.enableVertexAttribArray(fa.attributes.uv);_sprite=
|
|
|
|
-{};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=
|
|
|
|
-1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,ka("fragment",THREE.ShaderLib.sprite.fragmentShader));
|
|
|
|
-e.attachShader(_sprite.program,ka("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,
|
|
|
|
-"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=
|
|
|
|
-e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);this.setSize=function(m,C){ea.width=m;ea.height=C;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(m,C,x,u){la=m;Ga=C;ia=x;ja=u;e.viewport(la,Ga,
|
|
|
|
-ia,ja)};this.setScissor=function(m,C,x,u){e.scissor(m,C,x,u)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){X=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){xa.darkness=
|
|
|
|
-m};this.initMaterial=function(m,C,x,u){var z,K,M;if(m instanceof THREE.MeshDepthMaterial)M="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)M="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)M="normal";else if(m instanceof THREE.MeshBasicMaterial)M="basic";else if(m instanceof THREE.MeshLambertMaterial)M="lambert";else if(m instanceof THREE.MeshPhongMaterial)M="phong";else if(m instanceof THREE.LineBasicMaterial)M="basic";else m instanceof THREE.ParticleBasicMaterial&&
|
|
|
|
-(M="particle_basic");if(M){var E=THREE.ShaderLib[M];m.uniforms=Uniforms.clone(E.uniforms);m.vertexShader=E.vertexShader;m.fragmentShader=E.fragmentShader}var P,F,N;P=N=E=0;for(F=C.length;P<F;P++){K=C[P];K instanceof THREE.DirectionalLight&&N++;K instanceof THREE.PointLight&&E++}if(E+N<=4)C=N;else{C=Math.ceil(4*N/(E+N));E=4-C}K={directional:C,point:E};N=50;if(u!==undefined&&u instanceof THREE.SkinnedMesh)N=u.bones.length;var I;a:{P=m.fragmentShader;F=m.vertexShader;E=m.uniforms;C=m.attributes;x={map:!!m.map,
|
|
|
|
-envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:N};var Y;K=[];if(M)K.push(M);else{K.push(P);K.push(F)}for(Y in x){K.push(Y);K.push(x[Y])}M=K.join();Y=0;for(K=Aa.length;Y<K;Y++)if(Aa[Y].code==M){I=Aa[Y].program;break a}Y=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
|
|
|
-"#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,
|
|
|
|
-"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
|
|
+undefined)ca=b.stencil;if(b.antialias!==undefined)ma=b.antialias;b.clearColor!==undefined&&Da.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ma=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ea;this.autoClear=!0;this.sortObjects=!0;(function(m,C,x,u){try{if(!(e=ea.getContext("experimental-webgl",{antialias:m,stencil:u})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+
|
|
|
|
+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,x)})(ma,Da,Ma,ca);this.context=e;if(ca){var xa={};xa.vertices=new Float32Array(12);xa.faces=new Uint16Array(6);xa.darkness=0.5;xa.vertices[0]=-20;xa.vertices[1]=-20;xa.vertices[2]=-1;xa.vertices[3]=
|
|
|
|
+20;xa.vertices[4]=-20;xa.vertices[5]=-1;xa.vertices[6]=20;xa.vertices[7]=20;xa.vertices[8]=-1;xa.vertices[9]=-20;xa.vertices[10]=20;xa.vertices[11]=-1;xa.faces[0]=0;xa.faces[1]=1;xa.faces[2]=2;xa.faces[3]=0;xa.faces[4]=2;xa.faces[5]=3;xa.vertexBuffer=e.createBuffer();xa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,xa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,xa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,xa.faces,
|
|
|
|
+e.STATIC_DRAW);xa.program=e.createProgram();e.attachShader(xa.program,ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(xa.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(xa.program);xa.vertexLocation=e.getAttribLocation(xa.program,"position");xa.projectionLocation=e.getUniformLocation(xa.program,"projectionMatrix");xa.darknessLocation=e.getUniformLocation(xa.program,"darkness")}var fa={};fa.vertices=new Float32Array(16);fa.faces=new Uint16Array(6);
|
|
|
|
+b=0;fa.vertices[b++]=-1;fa.vertices[b++]=-1;fa.vertices[b++]=0;fa.vertices[b++]=0;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=1;b=0;fa.faces[b++]=0;fa.faces[b++]=1;fa.faces[b++]=2;fa.faces[b++]=0;fa.faces[b++]=2;fa.faces[b++]=3;fa.vertexBuffer=e.createBuffer();fa.elementBuffer=e.createBuffer();fa.tempTexture=e.createTexture();
|
|
|
|
+fa.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,fa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,fa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,
|
|
|
|
+e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
|
|
|
|
+0){fa.hasVertexTexture=!1;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(fa.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{fa.hasVertexTexture=!0;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(fa.program,ka("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(fa.program);fa.attributes=
|
|
|
|
+{};fa.uniforms={};fa.attributes.vertex=e.getAttribLocation(fa.program,"position");fa.attributes.uv=e.getAttribLocation(fa.program,"UV");fa.uniforms.renderType=e.getUniformLocation(fa.program,"renderType");fa.uniforms.map=e.getUniformLocation(fa.program,"map");fa.uniforms.occlusionMap=e.getUniformLocation(fa.program,"occlusionMap");fa.uniforms.opacity=e.getUniformLocation(fa.program,"opacity");fa.uniforms.scale=e.getUniformLocation(fa.program,"scale");fa.uniforms.rotation=e.getUniformLocation(fa.program,
|
|
|
|
+"rotation");fa.uniforms.screenPosition=e.getUniformLocation(fa.program,"screenPosition");e.enableVertexAttribArray(fa.attributes.vertex);e.enableVertexAttribArray(fa.attributes.uv);_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
|
|
|
|
+1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);
|
|
|
|
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,ka("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,ka("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=
|
|
|
|
+e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=
|
|
|
|
+e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);
|
|
|
|
+this.setSize=function(m,C){ea.width=m;ea.height=C;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(m,C,x,u){la=m;Ga=C;ia=x;ja=u;e.viewport(la,Ga,ia,ja)};this.setScissor=function(m,C,x,u){e.scissor(m,C,x,u)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){X=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,
|
|
|
|
+m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){xa.darkness=m};this.initMaterial=function(m,C,x,u){var z,K,M;if(m instanceof THREE.MeshDepthMaterial)M="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)M="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)M="normal";else if(m instanceof THREE.MeshBasicMaterial)M="basic";else if(m instanceof THREE.MeshLambertMaterial)M="lambert";
|
|
|
|
+else if(m instanceof THREE.MeshPhongMaterial)M="phong";else if(m instanceof THREE.LineBasicMaterial)M="basic";else m instanceof THREE.ParticleBasicMaterial&&(M="particle_basic");if(M){var E=THREE.ShaderLib[M];m.uniforms=Uniforms.clone(E.uniforms);m.vertexShader=E.vertexShader;m.fragmentShader=E.fragmentShader}var P,F,N;P=N=E=0;for(F=C.length;P<F;P++){K=C[P];K instanceof THREE.DirectionalLight&&N++;K instanceof THREE.PointLight&&E++}if(E+N<=4)C=N;else{C=Math.ceil(4*N/(E+N));E=4-C}K={directional:C,
|
|
|
|
+point:E};N=50;if(u!==undefined&&u instanceof THREE.SkinnedMesh)N=u.bones.length;var I;a:{P=m.fragmentShader;F=m.vertexShader;E=m.uniforms;C=m.attributes;x={map:!!m.map,envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:N};var Y;K=[];if(M)K.push(M);else{K.push(P);K.push(F)}for(Y in x){K.push(Y);K.push(x[Y])}M=
|
|
|
|
+K.join();Y=0;for(K=Aa.length;Y<K;Y++)if(Aa[Y].code==M){I=Aa[Y].program;break a}Y=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
|
+prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
e.attachShader(Y,ka("fragment",prefix_fragment+P));e.attachShader(Y,ka("vertex",prefix_vertex+F));e.linkProgram(Y);e.getProgramParameter(Y,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Y.uniforms={};Y.attributes={};var U;P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in E)P.push(U);
|
|
e.attachShader(Y,ka("fragment",prefix_fragment+P));e.attachShader(Y,ka("vertex",prefix_vertex+F));e.linkProgram(Y);e.getProgramParameter(Y,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Y.uniforms={};Y.attributes={};var U;P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in E)P.push(U);
|
|
U=P;E=0;for(P=U.length;E<P;E++){F=U[E];Y.uniforms[F]=e.getUniformLocation(Y,F)}P=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<x.maxMorphTargets;U++)P.push("morphTarget"+U);for(I in C)P.push(I);I=P;U=0;for(C=I.length;U<C;U++){x=I[U];Y.attributes[x]=e.getAttribLocation(Y,x)}Aa.push({program:Y,code:M});I=Y}m.program=I;I=m.program.attributes;e.enableVertexAttribArray(I.position);I.color>=0&&e.enableVertexAttribArray(I.color);I.normal>=
|
|
U=P;E=0;for(P=U.length;E<P;E++){F=U[E];Y.uniforms[F]=e.getUniformLocation(Y,F)}P=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<x.maxMorphTargets;U++)P.push("morphTarget"+U);for(I in C)P.push(I);I=P;U=0;for(C=I.length;U<C;U++){x=I[U];Y.attributes[x]=e.getAttribLocation(Y,x)}Aa.push({program:Y,code:M});I=Y}m.program=I;I=m.program.attributes;e.enableVertexAttribArray(I.position);I.color>=0&&e.enableVertexAttribArray(I.color);I.normal>=
|
|
0&&e.enableVertexAttribArray(I.normal);I.tangent>=0&&e.enableVertexAttribArray(I.tangent);if(m.skinning&&I.skinVertexA>=0&&I.skinVertexB>=0&&I.skinIndex>=0&&I.skinWeight>=0){e.enableVertexAttribArray(I.skinVertexA);e.enableVertexAttribArray(I.skinVertexB);e.enableVertexAttribArray(I.skinIndex);e.enableVertexAttribArray(I.skinWeight)}for(z in m.attributes)I[z]>=0&&e.enableVertexAttribArray(I[z]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(I.morphTarget0>=0){e.enableVertexAttribArray(I.morphTarget0);
|
|
0&&e.enableVertexAttribArray(I.normal);I.tangent>=0&&e.enableVertexAttribArray(I.tangent);if(m.skinning&&I.skinVertexA>=0&&I.skinVertexB>=0&&I.skinIndex>=0&&I.skinWeight>=0){e.enableVertexAttribArray(I.skinVertexA);e.enableVertexAttribArray(I.skinVertexB);e.enableVertexAttribArray(I.skinIndex);e.enableVertexAttribArray(I.skinWeight)}for(z in m.attributes)I[z]>=0&&e.enableVertexAttribArray(I[z]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(I.morphTarget0>=0){e.enableVertexAttribArray(I.morphTarget0);
|
|
@@ -382,7 +382,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=f=0;c<h;++c){d[c]=Math.exp(-((c-g)*(c-g))/(2*b*b));f+=d[c]}for(c=0;c<h;++c)d[c]/=f;return d}};
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=f=0;c<h;++c){d[c]=Math.exp(-((c-g)*(c-g))/(2*b*b));f+=d[c]}for(c=0;c<h;++c)d[c]/=f;return d}};
|
|
-THREE.QuakeCamera=function(b){function c(d,f){return function(){f.apply(d,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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
|
|
|
|
|
|
+THREE.QuakeCamera=function(b){function c(d,f){return function(){f.apply(d,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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
|
|
b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
|
|
b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
|
|
b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(d){d.preventDefault();
|
|
b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(d){d.preventDefault();
|
|
d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=
|
|
d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=
|
|
@@ -393,7 +393,7 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
|
|
this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;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))};
|
|
this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;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(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},B,G=o.getControlPointsArray(),H=o.getLength(),L=G.length,V=0;B=L-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:G[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<L-1;B++){V=y*H.chunks[B]/H.total;o.keys[B]={time:V,pos:G[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var w,
|
|
THREE.PathCamera=function(b){function c(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},B,G=o.getControlPointsArray(),H=o.getLength(),L=G.length,V=0;B=L-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:G[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<L-1;B++){V=y*H.chunks[B]/H.total;o.keys[B]={time:V,pos:G[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var w,
|
|
y,v=new THREE.Geometry;for(w=0;w<p.points.length*o;w++){y=w/(p.points.length*o);y=p.getPoint(y);v.vertices[w]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var w=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
|
|
y,v=new THREE.Geometry;for(w=0;w<p.points.length*o;w++){y=w/(p.points.length*o);y=p.getPoint(y);v.vertices[w]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var w=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
|
|
-16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){w=new THREE.Mesh(y,v);w.position.copy(o.points[i]);w.updateMatrix();p.addChild(w)}}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.lookVertical=
|
|
|
|
|
|
+16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){w=new THREE.Mesh(y,v);w.position.copy(o.points[i]);w.updateMatrix();p.addChild(w)}}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.lookVertical=
|
|
!0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
!0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
|
|
if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)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 g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,w){var y,v;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;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
|
|
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,w){var y,v;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;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
|
|
@@ -410,7 +410,7 @@ THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(w.position.x,w.position.y)/p,0.5
|
|
var Icosahedron=function(b){function c(w,y,v){var B=Math.sqrt(w*w+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(w/B,y/B,v/B)))-1}function d(w,y,v,B){B.faces.push(new THREE.Face3(w,y,v))}function f(w,y){var v=g.vertices[w].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=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,
|
|
var Icosahedron=function(b){function c(w,y,v){var B=Math.sqrt(w*w+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(w/B,y/B,v/B)))-1}function d(w,y,v,B){B.faces.push(new THREE.Face3(w,y,v))}function f(w,y){var v=g.vertices[w].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=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 n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,o,j);d(h.faces[k].b,p,n,j);d(h.faces[k].c,
|
|
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 n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,o,j);d(h.faces[k].b,p,n,j);d(h.faces[k].c,
|
|
o,p,j);d(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
o,p,j);d(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
|
-function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;d=[];for(var f=[],g=[],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();f[k]=this.vertices.length-1}for(var n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<d.length;k++)if(n<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
|
|
|
|
|
|
+function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;d=[];for(var f=[],g=[],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();f[k]=this.vertices.length-1}for(var n=0;n<=this.angle+0.001;n+=c){for(k=0;k<d.length;k++)if(n<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
|
|
0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/b.length),new THREE.UV(1-n/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/b.length),new THREE.UV(1-n/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
|
|
var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var p=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var p=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|
|
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
|