Sfoglia il codice sorgente

Blender exporter now exports proper per-face-vertex vertex colors.

alteredq 14 anni fa
parent
commit
673ff47199

+ 15 - 14
build/Three.js

@@ -48,7 +48,7 @@ c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?
 THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=d*e;this.w=h*g-k*b;this.x=h*b+k*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;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);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+e*g+b*k-d*h;this.y=b*a+e*h+d*g-c*k;this.z=d*a+e*k+c*h-b*g;this.w=e*a-c*g-b*h-d*k;return this},
 multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*b+h*e-k*d,t=j*d+k*b-g*e,x=j*e+g*d-h*b;b=-g*b-h*d-k*e;c.x=m*j+b*-g+t*-k-x*-h;c.y=t*j+b*-h+x*-g-m*-k;c.z=x*j+b*-k+m*-h-t*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;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,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -288,14 +288,15 @@ fb;Sa++){ga=gb[Sa].vertices[V.a].position;ha=gb[Sa].vertices[V.b].position;na=gb
 U[L+10]=na.z;U[L+11]=na.w;U[L+12]=Pa.x;U[L+13]=Pa.y;U[L+14]=Pa.z;U[L+15]=Pa.w;ga=mb[V.a];ha=mb[V.b];na=mb[V.c];Pa=mb[V.d];Y[L]=ga.x;Y[L+1]=ga.y;Y[L+2]=ga.z;Y[L+3]=ga.w;Y[L+4]=ha.x;Y[L+5]=ha.y;Y[L+6]=ha.z;Y[L+7]=ha.w;Y[L+8]=na.x;Y[L+9]=na.y;Y[L+10]=na.z;Y[L+11]=na.w;Y[L+12]=Pa.x;Y[L+13]=Pa.y;Y[L+14]=Pa.z;Y[L+15]=Pa.w;ga=kb[V.a];ha=kb[V.b];na=kb[V.c];Pa=kb[V.d];va[L]=ga.x;va[L+1]=ga.y;va[L+2]=ga.z;va[L+3]=1;va[L+4]=ha.x;va[L+5]=ha.y;va[L+6]=ha.z;va[L+7]=1;va[L+8]=na.x;va[L+9]=na.y;va[L+10]=na.z;va[L+
 11]=1;va[L+12]=Pa.x;va[L+13]=Pa.y;va[L+14]=Pa.z;va[L+15]=1;ga=lb[V.a];ha=lb[V.b];na=lb[V.c];V=lb[V.d];J[L]=ga.x;J[L+1]=ga.y;J[L+2]=ga.z;J[L+3]=1;J[L+4]=ha.x;J[L+5]=ha.y;J[L+6]=ha.z;J[L+7]=1;J[L+8]=na.x;J[L+9]=na.y;J[L+10]=na.z;J[L+11]=1;J[L+12]=V.x;J[L+13]=V.y;J[L+14]=V.z;J[L+15]=1;L+=16}if(bb&&Aa){if(Ba.length==4&&Aa==THREE.VertexColors){V=Ba[0];ga=Ba[1];ha=Ba[2];Ba=Ba[3]}else Ba=ha=ga=V=Ya;Ra[Oa]=V.r;Ra[Oa+1]=V.g;Ra[Oa+2]=V.b;Ra[Oa+3]=ga.r;Ra[Oa+4]=ga.g;Ra[Oa+5]=ga.b;Ra[Oa+6]=ha.r;Ra[Oa+7]=ha.g;
 Ra[Oa+8]=ha.b;Ra[Oa+9]=Ba.r;Ra[Oa+10]=Ba.g;Ra[Oa+11]=Ba.b;Oa+=12}if(hb&&R.hasTangents){Ba=ua[0];Ya=ua[1];V=ua[2];ua=ua[3];Ha[Ja]=Ba.x;Ha[Ja+1]=Ba.y;Ha[Ja+2]=Ba.z;Ha[Ja+3]=Ba.w;Ha[Ja+4]=Ya.x;Ha[Ja+5]=Ya.y;Ha[Ja+6]=Ya.z;Ha[Ja+7]=Ya.w;Ha[Ja+8]=V.x;Ha[Ja+9]=V.y;Ha[Ja+10]=V.z;Ha[Ja+11]=V.w;Ha[Ja+12]=ua.x;Ha[Ja+13]=ua.y;Ha[Ja+14]=ua.z;Ha[Ja+15]=ua.w;Ja+=16}if(db&&K)if(Ia.length==4&&pa)for(ua=0;ua<4;ua++){Ca=Ia[ua];Wa[Ta]=Ca.x;Wa[Ta+1]=Ca.y;Wa[Ta+2]=Ca.z;Ta+=3}else for(ua=0;ua<4;ua++){Wa[Ta]=Ca.x;Wa[Ta+
-1]=Ca.y;Wa[Ta+2]=Ca.z;Ta+=3}if(Za&&ra!==undefined&&N)for(ua=0;ua<4;ua++){Ia=ra[ua];Fa[Ga]=Ia.u;Fa[Ga+1]=Ia.v;Ga+=2}if(Za&&$!==undefined&&N)for(ua=0;ua<4;ua++){Ia=$[ua];$a[Ma]=Ia.u;$a[Ma+1]=Ia.v;Ma+=2}if(cb){za[Xa]=ma;za[Xa+1]=ma+1;za[Xa+2]=ma+2;za[Xa+3]=ma;za[Xa+4]=ma+2;za[Xa+5]=ma+3;Xa+=6;qa[Va]=ma;qa[Va+1]=ma+1;qa[Va+2]=ma;qa[Va+3]=ma+3;qa[Va+4]=ma+1;qa[Va+5]=ma+2;qa[Va+6]=ma+2;qa[Va+7]=ma+3;Va+=8;ma+=4}}}if(Ka){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Ua,F)}if(eb){Sa=
-0;for(fb=gb.length;Sa<fb;Sa++){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[Sa]);f.bufferData(f.ARRAY_BUFFER,fa[Sa],F)}}if(bb&&Oa>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ra,F)}if(db){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Wa,F)}if(hb&&R.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,F)}if(Za&&Ga>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,
-Fa,F)}if(Za&&Ma>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,$a,F)}if(cb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,za,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,qa,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,va,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,J,F);f.bindBuffer(f.ARRAY_BUFFER,
-B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Y,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,U,F)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;Aa=void 0;B=void 0;K=o.vertices;F=o.colors;ra=K.length;Z=F.length;$=o.__vertexArray;
-Ea=o.__colorArray;ma=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<ra;N++){Aa=K[N].position;B=N*3;$[B]=Aa.x;$[B+1]=Aa.y;$[B+2]=Aa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,$,D)}if(ma){for(N=0;N<Z;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=
-w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;Aa=void 0;B=void 0;K=o.vertices;F=o.colors;ra=K.length;Z=F.length;$=o.__vertexArray;Ea=o.__colorArray;ma=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<ra;N++){Aa=K[N].position;B=N*3;$[B]=Aa.x;$[B+1]=Aa.y;$[B+2]=Aa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,$,D)}if(ma){for(N=0;N<Z;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,
-Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-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(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+1]=Ca.y;Wa[Ta+2]=Ca.z;Ta+=3}if(Za&&ra!==undefined&&N)for(ua=0;ua<4;ua++){Ia=ra[ua];Fa[Ga]=Ia.u;Fa[Ga+1]=Ia.v;Ga+=2}if(Za&&$!==undefined&&N)for(ua=0;ua<4;ua++){Ia=$[ua];$a[Ma]=Ia.u;$a[Ma+1]=Ia.v;Ma+=2}if(cb){za[Xa]=ma;za[Xa+1]=ma+1;za[Xa+2]=ma+3;za[Xa+3]=ma+1;za[Xa+4]=ma+2;za[Xa+5]=ma+3;Xa+=6;qa[Va]=ma;qa[Va+1]=ma+1;qa[Va+2]=ma;qa[Va+3]=ma+3;qa[Va+4]=ma+1;qa[Va+5]=ma+2;qa[Va+6]=ma+2;qa[Va+7]=ma+3;Va+=8;ma+=4}}}if(Ka){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Ua,
+F)}if(eb){Sa=0;for(fb=gb.length;Sa<fb;Sa++){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[Sa]);f.bufferData(f.ARRAY_BUFFER,fa[Sa],F)}}if(bb&&Oa>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ra,F)}if(db){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Wa,F)}if(hb&&R.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,F)}if(Za&&Ga>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);
+f.bufferData(f.ARRAY_BUFFER,Fa,F)}if(Za&&Ma>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,$a,F)}if(cb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,za,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,qa,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,va,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,
+J,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Y,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,U,F)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;Aa=void 0;B=void 0;K=o.vertices;F=o.colors;ra=K.length;
+Z=F.length;$=o.__vertexArray;Ea=o.__colorArray;ma=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<ra;N++){Aa=K[N].position;B=N*3;$[B]=Aa.x;$[B+1]=Aa.y;$[B+2]=Aa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,$,D)}if(ma){for(N=0;N<Z;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=o.geometry;
+if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;Aa=void 0;B=void 0;K=o.vertices;F=o.colors;ra=K.length;Z=F.length;$=o.__vertexArray;Ea=o.__colorArray;ma=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<ra;N++){Aa=K[N].position;B=N*3;$[B]=Aa.x;$[B+1]=Aa.y;$[B+2]=Aa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,$,D)}if(ma){for(N=0;N<Z;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);
+f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=
+function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>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(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.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};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=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,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
@@ -324,7 +325,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}"},
 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(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.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.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)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=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -334,7 +335,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
 THREE.PathCamera=function(a){function c(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),H=t.getLength(),E=G.length,I=0;A=E-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<E-1;A++){I=y*H.chunks[A]/H.total;t.keys[A]={time:I,pos:G[A]}}q.hierarchy[0]=t;THREE.AnimationHandler.add(q);return new THREE.Animation(m,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var x,
 y,q=new THREE.Geometry;for(x=0;x<m.points.length*t;x++){y=x/(m.points.length*t);y=m.getPoint(y);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return q}function d(m,t){var x=b(t,10),y=b(t,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);y=new Sphere(1,
-16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}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.lookVertical=
+16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}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.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(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)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,g=Math.PI/180;this.update=function(m,t,x){var y,q;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)*g;this.theta=this.lon*g;y=this.phi%e;this.phi=y>=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;
@@ -350,7 +351,7 @@ for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*
 var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),t=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,j,t,h);b(g.faces[k].b,m,j,h);b(g.faces[k].c,
 t,m,h);b(j,m,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();e[k]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.001;m+=c){for(k=0;k<d.length;k++)if(m<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;m==0&&(h=e);for(k=
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();e[k]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)if(m<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;m==0&&(h=e);for(k=
 0;k<e.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k]));this.faceVertexUvs[0].push([new THREE.UV(m/b,k/a.length),new THREE.UV(m/b,(k+1)/a.length),new THREE.UV((m-c)/b,(k+1)/a.length),new THREE.UV((m-c)/b,k/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var k=b+1,j=d+1;a/=b;var m=c/d;for(e=0;e<j;e++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*e,c+k*(e+1),c+1+k*(e+1),c+1+k*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
@@ -365,8 +366,8 @@ a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=k(j,h,this.q,th
 m,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
 c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-k.image.width=t;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,t,x)}else k.image=this;k.needsUpdate=!0};m.src=j}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*
-255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+k.image.width=t;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,t,x)}else k.image=this;k.needsUpdate=!0};m.src=j}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};if(a.shading)if(a.shading=="Phong")e="MeshPhongMaterial";else a.shading=="Basic"&&(e="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=
+(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
 else{var h,k,j,m,t,x,y,q,A,G,H=a.faces;q=a.vertices;var E=a.normals,I=a.colors,z=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&z++;for(h=0;h<z;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}j=0;for(m=q.length;j<m;){A=new THREE.Vertex;A.position.x=q[j++];A.position.y=q[j++];A.position.z=q[j++];g.vertices.push(A)}j=0;for(m=H.length;j<m;){t=H[j++];x=t&1;h=t&2;y=t&4;k=t&8;q=t&16;A=t&32;G=t&64;t&=128;if(x){x=new THREE.Face4;x.a=H[j++];x.b=H[j++];x.c=H[j++];x.d=H[j++];nVertices=4}else{x=new THREE.Face3;x.a=

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=e*d;this.w=g*f-j*c;this.x=g*c+j*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,e=this.z,d=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+d*f+c*j-e*g;this.y=c*a+d*g+e*f-b*j;this.z=e*a+d*j+b*g-c*f;this.w=d*a-b*f-c*g-e*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*d-j*e,l=h*e+j*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-j*d;b.x=i*h+c*-f+l*-j-m*-g;b.y=l*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-l*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){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);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){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);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){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);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];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}};

+ 5 - 5
build/custom/ThreeExtras.js

@@ -23,7 +23,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}"},
 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(a){var e,b,c,g,f=2*Math.ceil(a*3)+1;f>25&&(f=25);g=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-g)*(e-g))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
-THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.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.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)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=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -33,7 +33,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
 THREE.QuakeCamera.prototype.translate=function(a,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
 THREE.PathCamera=function(a){function e(l,k,o,q){var m={name:o,fps:0.6,length:q,hierarchy:[]},t,B=k.getControlPointsArray(),z=k.getLength(),x=B.length,y=0;t=x-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:q,pos:B[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<x-1;t++){y=q*z.chunks[t]/z.total;k.keys[t]={time:y,pos:B[t]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,o,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var o,
 q,m=new THREE.Geometry;for(o=0;o<l.points.length*k;o++){q=o/(l.points.length*k);q=l.getPoint(q);m.vertices[o]=new THREE.Vertex(new THREE.Vector3(q.x,q.y,q.z))}return m}function c(l,k){var o=b(k,10),q=b(k,10),m=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(o,m);particleObj=new THREE.ParticleSystem(q,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);q=new Sphere(1,
-16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){o=new THREE.Mesh(q,m);o.position.copy(k.points[i]);o.updateMatrix();l.addChild(o)}}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.lookVertical=
+16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){o=new THREE.Mesh(q,m);o.position.copy(k.points[i]);o.updateMatrix();l.addChild(o)}}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.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(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)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 g=Math.PI*2,f=Math.PI/180;this.update=function(l,k,o){var q,m;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;q=this.phi%g;this.phi=q>=0?q:q+g;q=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;
@@ -49,7 +49,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*
 var Icosahedron=function(a){function e(o,q,m){var t=Math.sqrt(o*o+q*q+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(o/t,q/t,m/t)))-1}function b(o,q,m,t){t.faces.push(new THREE.Face3(o,q,m))}function c(o,q){var m=g.vertices[o].position,t=g.vertices[q].position;return e((m.x+t.x)/2,(m.y+t.y)/2,(m.z+t.z)/2)}var g=this,f=new THREE.Geometry,d;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){d=new THREE.Geometry;for(var h in f.faces){var j=c(f.faces[h].a,f.faces[h].b),l=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,d);b(f.faces[h].b,l,j,d);b(f.faces[h].c,
 k,l,d);b(j,l,k,d)}f.faces=d.faces}g.faces=f.faces;delete f;delete d;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],g=[],f=[],d=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.001;l+=e){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=d;l==0&&(d=g);for(h=
+function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],g=[],f=[],d=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.0010;l+=e){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=d;l==0&&(d=g);for(h=
 0;h<g.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],g[h+1],g[h]));this.faceVertexUvs[0].push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-e)/b,(h+1)/a.length),new THREE.UV((l-e)/b,h/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,e,b,c){THREE.Geometry.call(this);var g,f=a/2,d=e/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=e/c;for(g=0;g<j;g++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(g*l-d),0)));for(g=0;g<c;g++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*g,e+h*(g+1),e+1+h*(g+1),e+1+h*g));this.faceVertexUvs[0].push([new THREE.UV(e/b,g/c),new THREE.UV(e/b,(g+1)/c),new THREE.UV((e+1)/b,(g+1)/c),new THREE.UV((e+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
@@ -64,8 +64,8 @@ a/this.segmentsR*2*this.p*Math.PI;d=e/this.segmentsT*2*Math.PI;g=h(j,d,this.q,th
 l,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var e="Loaded ";e+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
 e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,e,b){a.materials=[];for(var c=0;c<e.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(e[c],b)]},createMaterial:function(a,e){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),o=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-h.image.width=k;h.image.height=o;h.image.getContext("2d").drawImage(this,0,0,k,o)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,f,d;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.mapDiffuse&&e){d=document.createElement("canvas");f.map=new THREE.Texture(d);f.map.sourceFile=a.mapDiffuse;c(f.map,e+"/"+a.mapDiffuse)}else if(a.colorDiffuse){d=(a.colorDiffuse[0]*
-255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=d;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&e){d=document.createElement("canvas");f.lightMap=new THREE.Texture(d);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,e+"/"+a.mapLightmap)}return new THREE[g](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+h.image.width=k;h.image.height=o;h.image.getContext("2d").drawImage(this,0,0,k,o)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,f,d;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};if(a.shading)if(a.shading=="Phong")g="MeshPhongMaterial";else a.shading=="Basic"&&(g="MeshBasicMaterial");if(a.mapDiffuse&&e){d=document.createElement("canvas");f.map=new THREE.Texture(d);f.map.sourceFile=a.mapDiffuse;c(f.map,e+"/"+a.mapDiffuse)}else if(a.colorDiffuse){d=
+(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=d;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&e){d=document.createElement("canvas");f.lightMap=new THREE.Texture(d);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,e+"/"+a.mapLightmap)}return new THREE[g](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
 THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype={load:function(a){var e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);e.onmessage=function(g){THREE.JSONLoader.prototype.createModel(g.data,b,c)};e.postMessage(a)},createModel:function(a,e,b){var c=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
 else{var d,h,j,l,k,o,q,m,t,B,z=a.faces;m=a.vertices;var x=a.normals,y=a.colors,n=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&n++;for(d=0;d<n;d++){f.faceUvs[d]=[];f.faceVertexUvs[d]=[]}j=0;for(l=m.length;j<l;){t=new THREE.Vertex;t.position.x=m[j++];t.position.y=m[j++];t.position.z=m[j++];f.vertices.push(t)}j=0;for(l=z.length;j<l;){k=z[j++];o=k&1;d=k&2;q=k&4;h=k&8;m=k&16;t=k&32;B=k&64;k&=128;if(o){o=new THREE.Face4;o.a=z[j++];o.b=z[j++];o.c=z[j++];o.d=z[j++];nVertices=4}else{o=new THREE.Face3;o.a=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){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);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){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);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 2 - 2
build/custom/ThreeWebGL.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,f=a.y*b,e=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var j=a*b,p=f*e;this.w=j*h-p*c;this.x=j*c+p*h;this.y=f*b*h+a*e*c;this.z=a*e*h-f*b*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);if(a==0)this.w=this.z=this.y=this.x=0;else{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,f=this.z,e=this.w,h=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+e*h+c*p-f*j;this.y=c*a+e*j+f*h-b*p;this.z=f*a+e*p+b*j-c*h;this.w=e*a-b*h-c*j-f*p;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,f=a.y,e=a.z,h=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*e-p*f,x=n*f+p*c-h*e,z=n*e+h*f-j*c;c=-h*c-j*f-p*e;b.x=s*n+c*-h+x*-p-z*-j;b.y=x*n+c*-j+z*-h-s*-p;b.z=z*n+c*-p+s*-j-x*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.001){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);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.0010){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);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,f,e,h){this.a=a;this.b=b;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,f,e,h,j){this.a=a;this.b=b;this.c=c;this.d=f;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];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(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.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -243,7 +243,7 @@ I=Sa[B.c].position;na=Sa[B.d].position;wa[T]=E.x;wa[T+1]=E.y;wa[T+2]=E.z;wa[T+3]
 ua[va+10]=na.y;ua[va+11]=na.z}va+=12}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];na=Ra[B.d];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;ga[u+12]=na.x;ga[u+13]=na.y;ga[u+14]=na.z;ga[u+15]=na.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];na=Va[B.d];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;fa[u+12]=na.x;fa[u+13]=na.y;
 fa[u+14]=na.z;fa[u+15]=na.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];na=Ta[B.d];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;da[u+12]=na.x;da[u+13]=na.y;da[u+14]=na.z;da[u+15]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];B=Ua[B.d];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;ea[u+12]=B.x;ea[u+13]=B.y;ea[u+14]=B.z;ea[u+15]=1;u+=16}if(fb&&
 R){if(Y.length==4&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2];Y=Y[3]}else Y=F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;xa[ra+9]=Y.r;xa[ra+10]=Y.g;xa[ra+11]=Y.b;ra+=12}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];O=O[3];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;ca[aa+12]=O.x;ca[aa+13]=O.y;ca[aa+14]=O.z;
-ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Pa[Oa+3]=H;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
+ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+3;Pa[Oa+3]=H+1;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
 6]=H+2;Ka[Ja+7]=H+3;Ja+=8;H+=4}}}if(bb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ea]);d.bufferData(d.ARRAY_BUFFER,ab[Ea],r)}}if(fb&&ra>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,xa,r)}if(db){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(eb&&Fa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
 q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Ya&&Z>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(Ya&&Ga>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,$a,r)}if(cb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ka,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
 d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||

+ 3 - 2
src/extras/io/Loader.js

@@ -128,9 +128,10 @@ THREE.Loader.prototype = {
 		if ( m.shading ) {
 			
 			if ( m.shading == "Phong" ) mtype = "MeshPhongMaterial";
-			
+			else if ( m.shading == "Basic" ) mtype = "MeshBasicMaterial";
+
 		}
-		
+
 		if ( m.mapDiffuse && texture_path ) {
 
 			texture = document.createElement( 'canvas' );

+ 5 - 5
src/renderers/WebGLRenderer.js

@@ -1132,12 +1132,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 				if ( dirtyElements ) {
 
 					faceArray[ offset_face ]     = vertexIndex;
-					faceArray[ offset_face + 1 ] = vertexIndex + 1;
-					faceArray[ offset_face + 2 ] = vertexIndex + 2;
+				   faceArray[ offset_face + 1 ] = vertexIndex + 1;
+				   faceArray[ offset_face + 2 ] = vertexIndex + 3;
 
-					faceArray[ offset_face + 3 ] = vertexIndex;
-					faceArray[ offset_face + 4 ] = vertexIndex + 2;
-					faceArray[ offset_face + 5 ] = vertexIndex + 3;
+				   faceArray[ offset_face + 3 ] = vertexIndex + 1;
+				   faceArray[ offset_face + 4 ] = vertexIndex + 2;
+				   faceArray[ offset_face + 5 ] = vertexIndex + 3;
 
 					offset_face += 6;
 

+ 26 - 27
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -103,7 +103,7 @@ def veckey3d(v):
 
 def veckey2d(v):
     return round(v[0], 6), round(v[1], 6)
-
+    
 def get_normal_indices(v, normals, mesh):
     n = []
     mv = mesh.vertices
@@ -118,13 +118,14 @@ def get_uv_indices(face_index, uvs, mesh):
         uv.append( uvs[veckey2d(i)] )
     return uv
 
-def get_color_indices(v, normals, mesh):
-    # TODO: make it proper
-    # this just reuses vertex indices as color indices
-    n = []
-    for i in range(len(v)):
-        n.append( v[i] )
-    return n
+def get_color_indices(face_index, colors, mesh):
+    c = []
+    color_layer = mesh.vertex_colors.active.data
+    face_colors = color_layer[face_index]
+    face_colors = face_colors.color1, face_colors.color2, face_colors.color3, face_colors.color4
+    for i in face_colors:
+        c.append( colors[hexcolor(i)] )
+    return c
 
 # #####################################################
 # Alignment
@@ -207,6 +208,9 @@ def bottom(vertices):
 # #####################################################
 # Elements
 # #####################################################
+def hexcolor(c):
+    return ( int(c[0] * 255) << 16  ) + ( int(c[1] * 255) << 8 ) + int(c[2] * 255)
+    
 def generate_vertex(v):
     return TEMPLATE_VERTEX % (v.co.x, v.co.y, v.co.z)
 
@@ -214,8 +218,7 @@ def generate_normal(n):
     return TEMPLATE_N % (n[0], n[1], n[2])
     
 def generate_vertex_color(c):
-    hexcolor = ( int(c[0] * 255) << 16  ) + ( int(c[1] * 255) << 8 ) + int(c[2] * 255)
-    return TEMPLATE_C % hexcolor
+    return TEMPLATE_C % c
     
 def generate_uv(uv):
     return TEMPLATE_UV % (uv[0], 1.0 - uv[1])
@@ -292,7 +295,7 @@ def generate_face(f, faceIndex, normals, uvs, colors, mesh, use_normals, use_col
             faceData.append(index)
             
     if hasFaceVertexColors:
-        c = get_color_indices(f.vertices, colors, mesh)
+        c = get_color_indices(faceIndex, colors, mesh)
         for i in range(nVertices):
             index = c[i]
             faceData.append(index)
@@ -334,11 +337,10 @@ def generate_normals(normals, use_normals):
 # #####################################################
 def extract_vertex_colors(mesh, use_colors):
     
-    # TODO: handle properly per face vertex colors
-    
     if not use_colors:
         return {}, 0
 
+    count = 0
     colors = {}
 
     color_layer = mesh.vertex_colors.active.data
@@ -347,19 +349,13 @@ def extract_vertex_colors(mesh, use_colors):
         
         face_colors = color_layer[face_index]
         face_colors = face_colors.color1, face_colors.color2, face_colors.color3, face_colors.color4
-        
-        for i, vertex_index in enumerate(face.vertices):
-
-            if vertex_index not in colors:
-                fc = face_colors[i]
-                colors[vertex_index] = fc[0], fc[1], fc[2]
+    
+        for c in face_colors:
+            key = hexcolor(c)
+            if key not in colors:
+                colors[key] = count
+                count += 1
 
-    # make sure all vertices have some color
-    count = len(mesh.vertices)
-    for i in range(count):
-        if i not in colors:
-            colors[i] = (0,0,0)
-            
     return colors, count
 
 def generate_vertex_colors(colors, use_colors):
@@ -367,8 +363,8 @@ def generate_vertex_colors(colors, use_colors):
         return ""
 
     chunks = []
-    for vertex_index, color in sorted(colors.items(), key=operator.itemgetter(0)):
-        chunks.append(color)
+    for key, index in sorted(colors.items(), key=operator.itemgetter(1)):
+        chunks.append(key)
 
     return ",".join(generate_vertex_color(c) for c in chunks)
 
@@ -376,6 +372,7 @@ def generate_vertex_colors(colors, use_colors):
 # UVs
 # #####################################################
 def extract_uvs(mesh, use_uv_coords):
+
     if not use_uv_coords:
         return {}, 0
 
@@ -385,7 +382,9 @@ def extract_uvs(mesh, use_uv_coords):
     uv_layer = mesh.uv_textures.active.data
 
     for face_index, face in enumerate(mesh.faces):
+
         for uv_index, uv in enumerate(uv_layer[face_index].uv):
+
             key = veckey2d(uv)
             if key not in uvs:
                 uvs[key] = count