|
@@ -1,5 +1,5 @@
|
|
// three.js - http://github.com/mrdoob/three.js
|
|
// three.js - http://github.com/mrdoob/three.js
|
|
-'use strict';var THREE={REVISION:"66"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};
|
|
|
|
|
|
+'use strict';var THREE={REVISION:"67dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};
|
|
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!self.requestAnimationFrame;++c)self.requestAnimationFrame=self[b[c]+"RequestAnimationFrame"],self.cancelAnimationFrame=self[b[c]+"CancelAnimationFrame"]||self[b[c]+"CancelRequestAnimationFrame"];void 0===self.requestAnimationFrame&&void 0!==self.setTimeout&&(self.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=self.setTimeout(function(){b(c+f)},f);a=c+f;return g});void 0===self.cancelAnimationFrame&&void 0!==
|
|
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!self.requestAnimationFrame;++c)self.requestAnimationFrame=self[b[c]+"RequestAnimationFrame"],self.cancelAnimationFrame=self[b[c]+"CancelAnimationFrame"]||self[b[c]+"CancelRequestAnimationFrame"];void 0===self.requestAnimationFrame&&void 0!==self.setTimeout&&(self.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=self.setTimeout(function(){b(c+f)},f);a=c+f;return g});void 0===self.cancelAnimationFrame&&void 0!==
|
|
self.clearTimeout&&(self.cancelAnimationFrame=function(a){self.clearTimeout(a)})})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;
|
|
self.clearTimeout&&(self.cancelAnimationFrame=function(a){self.clearTimeout(a)})})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;
|
|
THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;
|
|
THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;
|
|
@@ -174,11 +174,11 @@ a.visible||!0===b.visible||!0===c.visible||C.isIntersectionBox(A.setFromPoints(L
|
|
s[a],f=s[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);w.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;G.elements.push(w)},pushTriangle:function(a,c,g){var k=s[a],l=s[c],n=s[g];if(!0===h(k,l,n)){q=b();q.id=e.id;q.v1.copy(k);q.v2.copy(l);q.v3.copy(n);q.z=(k.positionScreen.z+l.positionScreen.z+n.positionScreen.z)/3;for(k=0;3>k;k++)l=3*arguments[k],n=q.vertexNormalsModel[k],n.set(d[l+0],d[l+1],d[l+2]),n.applyMatrix3(f).normalize();q.vertexNormalsLength=3;q.material=e.material;G.elements.push(q)}}}};
|
|
s[a],f=s[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);w.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;G.elements.push(w)},pushTriangle:function(a,c,g){var k=s[a],l=s[c],n=s[g];if(!0===h(k,l,n)){q=b();q.id=e.id;q.v1.copy(k);q.v2.copy(l);q.v3.copy(n);q.z=(k.positionScreen.z+l.positionScreen.z+n.positionScreen.z)/3;for(k=0;3>k;k++)l=3*arguments[k],n=q.vertexNormalsModel[k],n.set(d[l+0],d[l+1],d[l+2]),n.applyMatrix3(f).normalize();q.vertexNormalsLength=3;q.material=e.material;G.elements.push(q)}}}};
|
|
this.projectScene=function(f,h,k,l){var p,r,v,x,y,z,C,L,A;E=t=u=0;G.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();Q.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Y.multiplyMatrices(h.projectionMatrix,Q);ga.setFromMatrix(Y);g=0;G.objects.length=0;G.lights.length=0;W(f);!0===k&&G.objects.sort(d);f=0;for(k=G.objects.length;f<k;f++)if(p=G.objects[f].object,r=p.geometry,N.setObject(p),R=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(r instanceof
|
|
this.projectScene=function(f,h,k,l){var p,r,v,x,y,z,C,L,A;E=t=u=0;G.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();Q.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Y.multiplyMatrices(h.projectionMatrix,Q);ga.setFromMatrix(Y);g=0;G.objects.length=0;G.lights.length=0;W(f);!0===k&&G.objects.sort(d);f=0;for(k=G.objects.length;f<k;f++)if(p=G.objects[f].object,r=p.geometry,N.setObject(p),R=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(r instanceof
|
|
THREE.BufferGeometry){if(z=r.attributes,p=r.offsets,void 0!==z.position){L=z.position.array;r=0;for(x=L.length;r<x;r+=3)N.pushVertex(L[r],L[r+1],L[r+2]);A=z.normal.array;r=0;for(x=A.length;r<x;r+=3)N.pushNormal(A[r],A[r+1],A[r+2]);if(void 0!==z.index)if(z=z.index.array,0<p.length)for(f=0;f<p.length;f++)for(x=p[f],L=x.index,r=x.start,x=x.start+x.count;r<x;r+=3)N.pushTriangle(z[r]+L,z[r+1]+L,z[r+2]+L);else for(r=0,x=z.length;r<x;r+=3)N.pushTriangle(z[r],z[r+1],z[r+2]);else for(r=0,x=L.length/3;r<x;r+=
|
|
THREE.BufferGeometry){if(z=r.attributes,p=r.offsets,void 0!==z.position){L=z.position.array;r=0;for(x=L.length;r<x;r+=3)N.pushVertex(L[r],L[r+1],L[r+2]);A=z.normal.array;r=0;for(x=A.length;r<x;r+=3)N.pushNormal(A[r],A[r+1],A[r+2]);if(void 0!==z.index)if(z=z.index.array,0<p.length)for(f=0;f<p.length;f++)for(x=p[f],L=x.index,r=x.start,x=x.start+x.count;r<x;r+=3)N.pushTriangle(z[r]+L,z[r+1]+L,z[r+2]+L);else for(r=0,x=z.length;r<x;r+=3)N.pushTriangle(z[r],z[r+1],z[r+2]);else for(r=0,x=L.length/3;r<x;r+=
|
|
-3)N.pushTriangle(r,r+1,r+2)}}else{if(r instanceof THREE.Geometry){v=r.vertices;x=r.faces;z=r.faceVertexUvs;V.getNormalMatrix(R);L=p.material instanceof THREE.MeshFaceMaterial;A=!0===L?p.material:null;for(var ka=0,Ka=v.length;ka<Ka;ka++){var la=v[ka];N.pushVertex(la.x,la.y,la.z)}ka=0;for(Ka=x.length;ka<Ka;ka++){v=x[ka];var Ba=!0===L?A.materials[v.materialIndex]:p.material;if(void 0!==Ba){C=Ba.side;var la=s[v.a],Ia=s[v.b],ma=s[v.c];if(!0===Ba.morphTargets){y=r.morphTargets;var Ca=p.morphTargetInfluences,
|
|
|
|
-ba=la.position,wa=Ia.position,xa=ma.position;I.set(0,0,0);O.set(0,0,0);K.set(0,0,0);for(var Da=0,Wa=y.length;Da<Wa;Da++){var La=Ca[Da];if(0!==La){var Ea=y[Da].vertices;I.x+=(Ea[v.a].x-ba.x)*La;I.y+=(Ea[v.a].y-ba.y)*La;I.z+=(Ea[v.a].z-ba.z)*La;O.x+=(Ea[v.b].x-wa.x)*La;O.y+=(Ea[v.b].y-wa.y)*La;O.z+=(Ea[v.b].z-wa.z)*La;K.x+=(Ea[v.c].x-xa.x)*La;K.y+=(Ea[v.c].y-xa.y)*La;K.z+=(Ea[v.c].z-xa.z)*La}}la.position.add(I);Ia.position.add(O);ma.position.add(K);N.projectVertex(la);N.projectVertex(Ia);N.projectVertex(ma)}Ca=
|
|
|
|
-N.checkTriangleVisibility(la,Ia,ma);if(!(!1===Ca&&C===THREE.FrontSide||!0===Ca&&C===THREE.BackSide)){q=b();q.id=p.id;q.v1.copy(la);q.v2.copy(Ia);q.v3.copy(ma);q.normalModel.copy(v.normal);!1!==Ca||C!==THREE.BackSide&&C!==THREE.DoubleSide||q.normalModel.negate();q.normalModel.applyMatrix3(V).normalize();q.centroidModel.copy(v.centroid).applyMatrix4(R);y=v.vertexNormals;ba=0;for(wa=Math.min(y.length,3);ba<wa;ba++)xa=q.vertexNormalsModel[ba],xa.copy(y[ba]),!1!==Ca||C!==THREE.BackSide&&C!==THREE.DoubleSide||
|
|
|
|
-xa.negate(),xa.applyMatrix3(V).normalize();q.vertexNormalsLength=y.length;y=0;for(Ca=Math.min(z.length,3);y<Ca;y++)if(C=z[y][ka],void 0!==C)for(ba=0,wa=C.length;ba<wa;ba++)q.uvs[y][ba]=C[ba];q.color=v.color;q.material=Ba;q.z=(la.positionScreen.z+Ia.positionScreen.z+ma.positionScreen.z)/3;G.elements.push(q)}}}}}else if(p instanceof THREE.Line)if(r instanceof THREE.BufferGeometry){if(z=r.attributes,void 0!==z.position){L=z.position.array;r=0;for(x=L.length;r<x;r+=3)N.pushVertex(L[r],L[r+1],L[r+2]);
|
|
|
|
-if(void 0!==z.index)for(z=z.index.array,r=0,x=z.length;r<x;r+=2)N.pushLine(z[r],z[r+1]);else for(r=0,x=L.length/3-1;r<x;r++)N.pushLine(r,r+1)}}else{if(r instanceof THREE.Geometry&&(fa.multiplyMatrices(Y,R),v=p.geometry.vertices,0!==v.length))for(la=a(),la.positionScreen.copy(v[0]).applyMatrix4(fa),r=p.type===THREE.LinePieces?2:1,ka=1,Ka=v.length;ka<Ka;ka++)la=a(),la.positionScreen.copy(v[ka]).applyMatrix4(fa),0<(ka+1)%r||(Ia=s[n-2],J.copy(la.positionScreen),da.copy(Ia.positionScreen),!0===e(J,da)&&
|
|
|
|
|
|
+3)N.pushTriangle(r,r+1,r+2)}}else{if(r instanceof THREE.Geometry){v=r.vertices;x=r.faces;z=r.faceVertexUvs;V.getNormalMatrix(R);L=p.material instanceof THREE.MeshFaceMaterial;A=!0===L?p.material:null;for(var ka=0,La=v.length;ka<La;ka++){var la=v[ka];N.pushVertex(la.x,la.y,la.z)}ka=0;for(La=x.length;ka<La;ka++){v=x[ka];var Ba=!0===L?A.materials[v.materialIndex]:p.material;if(void 0!==Ba){C=Ba.side;var la=s[v.a],Ja=s[v.b],ma=s[v.c];if(!0===Ba.morphTargets){y=r.morphTargets;var Ca=p.morphTargetInfluences,
|
|
|
|
+ba=la.position,wa=Ja.position,xa=ma.position;I.set(0,0,0);O.set(0,0,0);K.set(0,0,0);for(var Na=0,hb=y.length;Na<hb;Na++){var Ma=Ca[Na];if(0!==Ma){var Da=y[Na].vertices;I.x+=(Da[v.a].x-ba.x)*Ma;I.y+=(Da[v.a].y-ba.y)*Ma;I.z+=(Da[v.a].z-ba.z)*Ma;O.x+=(Da[v.b].x-wa.x)*Ma;O.y+=(Da[v.b].y-wa.y)*Ma;O.z+=(Da[v.b].z-wa.z)*Ma;K.x+=(Da[v.c].x-xa.x)*Ma;K.y+=(Da[v.c].y-xa.y)*Ma;K.z+=(Da[v.c].z-xa.z)*Ma}}la.position.add(I);Ja.position.add(O);ma.position.add(K);N.projectVertex(la);N.projectVertex(Ja);N.projectVertex(ma)}Ca=
|
|
|
|
+N.checkTriangleVisibility(la,Ja,ma);if(!(!1===Ca&&C===THREE.FrontSide||!0===Ca&&C===THREE.BackSide)){q=b();q.id=p.id;q.v1.copy(la);q.v2.copy(Ja);q.v3.copy(ma);q.normalModel.copy(v.normal);!1!==Ca||C!==THREE.BackSide&&C!==THREE.DoubleSide||q.normalModel.negate();q.normalModel.applyMatrix3(V).normalize();q.centroidModel.copy(v.centroid).applyMatrix4(R);y=v.vertexNormals;ba=0;for(wa=Math.min(y.length,3);ba<wa;ba++)xa=q.vertexNormalsModel[ba],xa.copy(y[ba]),!1!==Ca||C!==THREE.BackSide&&C!==THREE.DoubleSide||
|
|
|
|
+xa.negate(),xa.applyMatrix3(V).normalize();q.vertexNormalsLength=y.length;y=0;for(Ca=Math.min(z.length,3);y<Ca;y++)if(C=z[y][ka],void 0!==C)for(ba=0,wa=C.length;ba<wa;ba++)q.uvs[y][ba]=C[ba];q.color=v.color;q.material=Ba;q.z=(la.positionScreen.z+Ja.positionScreen.z+ma.positionScreen.z)/3;G.elements.push(q)}}}}}else if(p instanceof THREE.Line)if(r instanceof THREE.BufferGeometry){if(z=r.attributes,void 0!==z.position){L=z.position.array;r=0;for(x=L.length;r<x;r+=3)N.pushVertex(L[r],L[r+1],L[r+2]);
|
|
|
|
+if(void 0!==z.index)for(z=z.index.array,r=0,x=z.length;r<x;r+=2)N.pushLine(z[r],z[r+1]);else for(r=0,x=L.length/3-1;r<x;r++)N.pushLine(r,r+1)}}else{if(r instanceof THREE.Geometry&&(fa.multiplyMatrices(Y,R),v=p.geometry.vertices,0!==v.length))for(la=a(),la.positionScreen.copy(v[0]).applyMatrix4(fa),r=p.type===THREE.LinePieces?2:1,ka=1,La=v.length;ka<La;ka++)la=a(),la.positionScreen.copy(v[ka]).applyMatrix4(fa),0<(ka+1)%r||(Ja=s[n-2],J.copy(la.positionScreen),da.copy(Ja.positionScreen),!0===e(J,da)&&
|
|
(J.multiplyScalar(1/J.w),da.multiplyScalar(1/da.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(J),w.v2.positionScreen.copy(da),w.z=Math.max(J.z,da.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[ka]),w.vertexColors[1].copy(p.geometry.colors[ka-1])),G.elements.push(w)))}else p instanceof THREE.Sprite&&(F.set(R.elements[12],R.elements[13],R.elements[14],1),F.applyMatrix4(Y),r=1/F.w,F.z*=r,-1<=F.z&&1>=F.z&&(E===D?(x=new THREE.RenderableSprite,
|
|
(J.multiplyScalar(1/J.w),da.multiplyScalar(1/da.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(J),w.v2.positionScreen.copy(da),w.z=Math.max(J.z,da.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[ka]),w.vertexColors[1].copy(p.geometry.colors[ka-1])),G.elements.push(w)))}else p instanceof THREE.Sprite&&(F.set(R.elements[12],R.elements[13],R.elements[14],1),F.applyMatrix4(Y),r=1/F.w,F.z*=r,-1<=F.z&&1>=F.z&&(E===D?(x=new THREE.RenderableSprite,
|
|
H.push(x),D++,E++,B=x):B=H[E++],B.id=p.id,B.x=F.x*r,B.y=F.y*r,B.z=F.z,B.object=p,B.rotation=p.rotation,B.scale.x=p.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.elements[0])/(F.w+h.projectionMatrix.elements[12])),B.scale.y=p.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.elements[5])/(F.w+h.projectionMatrix.elements[13])),B.material=p.material,G.elements.push(B)));!0===l&&G.elements.sort(d);return G}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
H.push(x),D++,E++,B=x):B=H[E++],B.id=p.id,B.x=F.x*r,B.y=F.y*r,B.z=F.z,B.object=p,B.rotation=p.rotation,B.scale.x=p.scale.x*Math.abs(B.x-(F.x+h.projectionMatrix.elements[0])/(F.w+h.projectionMatrix.elements[12])),B.scale.y=p.scale.y*Math.abs(B.y-(F.y+h.projectionMatrix.elements[5])/(F.w+h.projectionMatrix.elements[13])),B.material=p.material,G.elements.push(B)));!0===l&&G.elements.sort(d);return G}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -189,9 +189,9 @@ return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sph
|
|
if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else for(a=0,b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0;var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,k,l,n,s,r=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;g=t[c].count;var x=
|
|
if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else for(a=0,b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0;var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,k,l,n,s,r=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;g=t[c].count;var x=
|
|
t[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],k=x+w[a+2],l=e[3*g],n=e[3*g+1],s=e[3*g+2],r.set(l,n,s),l=e[3*h],n=e[3*h+1],s=e[3*h+2],q.set(l,n,s),l=e[3*k],n=e[3*k+1],s=e[3*k+2],u.set(l,n,s),p.subVectors(u,q),v.subVectors(r,q),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*k]+=p.x,f[3*k+1]+=p.y,f[3*k+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],s=e[a+2],r.set(l,n,s),l=e[a+3],n=e[a+4],s=e[a+5],q.set(l,n,s),l=e[a+6],n=e[a+7],s=e[a+8],
|
|
t[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],k=x+w[a+2],l=e[3*g],n=e[3*g+1],s=e[3*g+2],r.set(l,n,s),l=e[3*h],n=e[3*h+1],s=e[3*h+2],q.set(l,n,s),l=e[3*k],n=e[3*k+1],s=e[3*k+2],u.set(l,n,s),p.subVectors(u,q),v.subVectors(r,q),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*k]+=p.x,f[3*k+1]+=p.y,f[3*k+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],s=e[a+2],r.set(l,n,s),l=e[a+3],n=e[a+4],s=e[a+5],q.set(l,n,s),l=e[a+6],n=e[a+7],s=e[a+8],
|
|
u.set(l,n,s),p.subVectors(u,q),v.subVectors(r,q),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a,b,c){s=d[3*a];r=d[3*a+1];q=d[3*a+2];u=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];
|
|
u.set(l,n,s),p.subVectors(u,q),v.subVectors(r,q),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a,b,c){s=d[3*a];r=d[3*a+1];q=d[3*a+2];u=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];
|
|
-t=d[3*c+1];x=d[3*c+2];z=f[2*a];B=f[2*a+1];E=f[2*b];H=f[2*b+1];D=f[2*c];G=f[2*c+1];I=u-s;O=w-s;K=p-r;y=t-r;F=v-q;C=x-q;A=E-z;L=D-z;Q=H-B;Y=G-B;R=1/(A*Y-L*Q);fa.set((Y*I-Q*O)*R,(Y*K-Q*y)*R,(Y*F-Q*C)*R);V.set((A*O-L*I)*R,(A*y-L*K)*R,(A*C-L*F)*R);k[a].add(fa);k[b].add(fa);k[c].add(fa);l[a].add(V);l[b].add(V);l[c].add(V)}function b(a){S.x=e[3*a];S.y=e[3*a+1];S.z=e[3*a+2];$.copy(S);ta=k[a];T.copy(ta);T.sub(S.multiplyScalar(S.dot(ta))).normalize();Ja.crossVectors($,ta);oa=Ja.dot(l[a]);Fa=0>oa?-1:1;h[4*a]=
|
|
|
|
-T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=Fa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*
|
|
|
|
-g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var s,r,q,u,p,v,w,t,x,z,B,E,H,D,G,I,O,K,y,F,C,A,L,Q,Y,R,fa=new THREE.Vector3,V=new THREE.Vector3,ga,J,da,W,N,ca=this.offsets,n=0;for(J=ca.length;n<J;++n){ga=ca[n].start;da=ca[n].count;var sa=ca[n].index,g=ga;for(ga+=da;g<ga;g+=3)da=sa+c[g],W=sa+c[g+1],N=sa+c[g+2],a(da,W,N)}var T=new THREE.Vector3,Ja=new THREE.Vector3,S=new THREE.Vector3,$=new THREE.Vector3,Fa,ta,oa,n=0;for(J=ca.length;n<
|
|
|
|
|
|
+t=d[3*c+1];x=d[3*c+2];z=f[2*a];B=f[2*a+1];E=f[2*b];H=f[2*b+1];D=f[2*c];G=f[2*c+1];I=u-s;O=w-s;K=p-r;y=t-r;F=v-q;C=x-q;A=E-z;L=D-z;Q=H-B;Y=G-B;R=1/(A*Y-L*Q);fa.set((Y*I-Q*O)*R,(Y*K-Q*y)*R,(Y*F-Q*C)*R);V.set((A*O-L*I)*R,(A*y-L*K)*R,(A*C-L*F)*R);k[a].add(fa);k[b].add(fa);k[c].add(fa);l[a].add(V);l[b].add(V);l[c].add(V)}function b(a){S.x=e[3*a];S.y=e[3*a+1];S.z=e[3*a+2];$.copy(S);ta=k[a];T.copy(ta);T.sub(S.multiplyScalar(S.dot(ta))).normalize();Ka.crossVectors($,ta);oa=Ka.dot(l[a]);Ea=0>oa?-1:1;h[4*a]=
|
|
|
|
+T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=Ea}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*
|
|
|
|
+g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var s,r,q,u,p,v,w,t,x,z,B,E,H,D,G,I,O,K,y,F,C,A,L,Q,Y,R,fa=new THREE.Vector3,V=new THREE.Vector3,ga,J,da,W,N,ca=this.offsets,n=0;for(J=ca.length;n<J;++n){ga=ca[n].start;da=ca[n].count;var sa=ca[n].index,g=ga;for(ga+=da;g<ga;g+=3)da=sa+c[g],W=sa+c[g+1],N=sa+c[g+2],a(da,W,N)}var T=new THREE.Vector3,Ka=new THREE.Vector3,S=new THREE.Vector3,$=new THREE.Vector3,Ea,ta,oa,n=0;for(J=ca.length;n<
|
|
J;++n)for(ga=ca[n].start,da=ca[n].count,sa=ca[n].index,g=ga,ga+=da;g<ga;g+=3)da=sa+c[g],W=sa+c[g+1],N=sa+c[g+2],b(da),b(W),b(N)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,n=0,s=new Int32Array(6),r=new Int32Array(c.length),q=new Int32Array(c.length),u=0;u<c.length;u++)r[u]=-1,q[u]=-1;for(c=0;c<d;c++){for(var p=n=
|
|
J;++n)for(ga=ca[n].start,da=ca[n].count,sa=ca[n].index,g=ga,ga+=da;g<ga;g+=3)da=sa+c[g],W=sa+c[g+1],N=sa+c[g+2],b(da),b(W),b(N)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,n=0,s=new Int32Array(6),r=new Int32Array(c.length),q=new Int32Array(c.length),u=0;u<c.length;u++)r[u]=-1,q[u]=-1;for(c=0;c<d;c++){for(var p=n=
|
|
0;3>p;p++)u=a[3*c+p],-1==r[u]?(s[2*p]=u,s[2*p+1]=-1,n++):r[u]<k.index?(s[2*p]=u,s[2*p+1]=-1,l++):(s[2*p]=u,s[2*p+1]=r[u]);if(g+n>k.index+b)for(k={start:f,count:0,index:g},h.push(k),n=0;6>n;n+=2)p=s[n+1],-1<p&&p<k.index&&(s[n+1]=-1);for(n=0;6>n;n+=2)u=s[n],p=s[n+1],-1===p&&(p=g++),r[u]=p,q[p]=u,e[f++]=p-k.index,k.count++}this.reorderBuffers(e,q,g);return this.offsets=h},reorderBuffers:function(a,b,c){var d={},e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,
|
|
0;3>p;p++)u=a[3*c+p],-1==r[u]?(s[2*p]=u,s[2*p+1]=-1,n++):r[u]<k.index?(s[2*p]=u,s[2*p+1]=-1,l++):(s[2*p]=u,s[2*p+1]=r[u]);if(g+n>k.index+b)for(k={start:f,count:0,index:g},h.push(k),n=0;6>n;n+=2)p=s[n+1],-1<p&&p<k.index&&(s[n+1]=-1);for(n=0;6>n;n+=2)u=s[n],p=s[n+1],-1===p&&(p=g++),r[u]=p,q[p]=u,e[f++]=p-k.index,k.count++}this.reorderBuffers(e,q,g);return this.offsets=h},reorderBuffers:function(a,b,c){var d={},e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,
|
|
Float64Array],f;for(f in this.attributes)if("index"!=f)for(var g=this.attributes[f].array,h=0,k=e.length;h<k;h++){var l=e[h];if(g instanceof l){d[f]=new l(this.attributes[f].itemSize*c);break}}for(e=0;e<c;e++)for(f in g=b[e],this.attributes)if("index"!=f)for(var h=this.attributes[f].array,k=this.attributes[f].itemSize,l=d[f],n=0;n<k;n++)l[e*k+n]=h[g*k+n];this.attributes.index.array=a;for(f in this.attributes)"index"!=f&&(this.attributes[f].array=d[f],this.attributes[f].numItems=this.attributes[f].itemSize*
|
|
Float64Array],f;for(f in this.attributes)if("index"!=f)for(var g=this.attributes[f].array,h=0,k=e.length;h<k;h++){var l=e[h];if(g instanceof l){d[f]=new l(this.attributes[f].itemSize*c);break}}for(e=0;e<c;e++)for(f in g=b[e],this.attributes)if("index"!=f)for(var h=this.attributes[f].array,k=this.attributes[f].itemSize,l=d[f],n=0;n<k;n++)l[e*k+n]=h[g*k+n];this.attributes.index.array=a;for(f in this.attributes)"index"!=f&&(this.attributes[f].array=d[f],this.attributes[f].numItems=this.attributes[f].itemSize*
|
|
@@ -208,8 +208,8 @@ d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__origin
|
|
l=f[0],n=f[1],s=f[2],f=h.x-g.x,r=k.x-g.x,q=h.y-g.y,u=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=n.x-l.x,p=s.x-l.x,n=n.y-l.y,l=s.y-l.y,s=1/(k*l-p*n),c.set((l*f-n*r)*s,(l*q-n*u)*s,(l*h-n*g)*s),x.set((k*r-p*f)*s,(k*u-p*q)*s,(k*g-p*h)*s),w[d].add(c),w[v].add(c),w[e].add(c),t[d].add(x),t[v].add(x),t[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)E.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],z.copy(v),z.sub(E.multiplyScalar(E.dot(v))).normalize(),
|
|
l=f[0],n=f[1],s=f[2],f=h.x-g.x,r=k.x-g.x,q=h.y-g.y,u=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=n.x-l.x,p=s.x-l.x,n=n.y-l.y,l=s.y-l.y,s=1/(k*l-p*n),c.set((l*f-n*r)*s,(l*q-n*u)*s,(l*h-n*g)*s),x.set((k*r-p*f)*s,(k*u-p*q)*s,(k*g-p*h)*s),w[d].add(c),w[v].add(c),w[e].add(c),t[d].add(x),t[v].add(x),t[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)E.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],z.copy(v),z.sub(E.multiplyScalar(E.dot(v))).normalize(),
|
|
B.crossVectors(e.vertexNormals[c],v),d=B.dot(t[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
B.crossVectors(e.vertexNormals[c],v),d=B.dot(t[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
|
|
this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
|
|
-a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},makeGroups:function(){var a=0;return function(b){var c,d,e,f,g={},h=this.morphTargets.length,k=this.morphNormals.length;this.geometryGroups={};c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e=b?e.materialIndex:0,e in g||(g[e]={hash:e,counter:0}),f=g[e].hash+"_"+g[e].counter,f in this.geometryGroups||(this.geometryGroups[f]={faces3:[],
|
|
|
|
-materialIndex:e,vertices:0,numMorphTargets:h,numMorphNormals:k}),65535<this.geometryGroups[f].vertices+3&&(g[e].counter+=1,f=g[e].hash+"_"+g[e].counter,f in this.geometryGroups||(this.geometryGroups[f]={faces3:[],materialIndex:e,vertices:0,numMorphTargets:h,numMorphNormals:k})),this.geometryGroups[f].faces3.push(c),this.geometryGroups[f].vertices+=3;this.geometryGroupsList=[];for(var l in this.geometryGroups)this.geometryGroups[l].id=a++,this.geometryGroupsList.push(this.geometryGroups[l])}}(),clone:function(){for(var a=
|
|
|
|
|
|
+a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},makeGroups:function(){var a=0;return function(b,c){var d,e,f,g,h={},k=this.morphTargets.length,l=this.morphNormals.length;this.geometryGroups={};d=0;for(e=this.faces.length;d<e;d++)f=this.faces[d],f=b?f.materialIndex:0,f in h||(h[f]={hash:f,counter:0}),g=h[f].hash+"_"+h[f].counter,g in this.geometryGroups||(this.geometryGroups[g]={faces3:[],
|
|
|
|
+materialIndex:f,vertices:0,numMorphTargets:k,numMorphNormals:l}),this.geometryGroups[g].vertices+3>c&&(h[f].counter+=1,g=h[f].hash+"_"+h[f].counter,g in this.geometryGroups||(this.geometryGroups[g]={faces3:[],materialIndex:f,vertices:0,numMorphTargets:k,numMorphNormals:l})),this.geometryGroups[g].faces3.push(d),this.geometryGroups[g].vertices+=3;this.geometryGroupsList=[];for(var n in this.geometryGroups)this.geometryGroups[n].id=a++,this.geometryGroupsList.push(this.geometryGroups[n])}}(),clone:function(){for(var a=
|
|
new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){THREE.BufferGeometry.call(this);this.vertices=this.addAttribute("position",Float32Array,a,3).array;this.normals=this.addAttribute("normal",Float32Array,a,3).array;this.uvs=this.addAttribute("uv",Float32Array,a,2).array;this.boundingSphere=this.boundingBox=null};THREE.Geometry2.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){THREE.BufferGeometry.call(this);this.vertices=this.addAttribute("position",Float32Array,a,3).array;this.normals=this.addAttribute("normal",Float32Array,a,3).array;this.uvs=this.addAttribute("uv",Float32Array,a,2).array;this.boundingSphere=this.boundingBox=null};THREE.Geometry2.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
THREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;return a};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
THREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;return a};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
@@ -315,30 +315,30 @@ THREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));this.dispatchEvent({type:"objectRemoved",object:a});a.dispatchEvent({type:"removedFromScene",scene:this});for(b=
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));this.dispatchEvent({type:"objectRemoved",object:a});a.dispatchEvent({type:"removedFromScene",scene:this});for(b=
|
|
-0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=E.length;d<e;d++){var f=E[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=Na.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ka.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=Na.setFromMatrixPosition(f.matrixWorld),h=b.dot(Na.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ka.multiplyScalar(h)))))}}
|
|
|
|
-function c(a,b,c,d){r(b);q(c);u(d);p(a.getStyle());y.stroke();Oa.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);la[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
|
-function g(a,b,c,d,g,h,k,m,l,n,p,r,q){if(!(q instanceof THREE.DataTexture)){!1===q.hasEventListener("update",e)&&(void 0!==q.image&&0<q.image.width&&f(q),q.addEventListener("update",e));var s=la[q.id];if(void 0!==s){v(s);var s=q.offset.x/q.repeat.x,u=q.offset.y/q.repeat.y,Nb=q.image.width*q.repeat.x;q=q.image.height*q.repeat.y;k=(k+s)*Nb;m=(m+u)*q;c-=a;d-=b;g-=a;h-=b;l=(l+s)*Nb-k;n=(n+u)*q-m;p=(p+s)*Nb-k;r=(r+u)*q-m;q=l*r-p*n;0!==q&&(s=1/q,q=(r*c-n*g)*s,n=(r*d-n*h)*s,c=(l*g-p*c)*s,d=(l*h-p*d)*s,a=
|
|
|
|
-a-q*k-c*m,b=b-n*k-d*m,y.save(),y.transform(q,n,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,k,m,l,n,p){var q,r;q=p.width-1;r=p.height-1;g*=q;h*=r;c-=a;d-=b;e-=a;f-=b;k=k*q-g;m=m*r-h;l=l*q-g;n=n*r-h;r=1/(k*n-l*m);q=(n*c-m*e)*r;m=(n*d-m*f)*r;c=(k*e-l*c)*r;d=(k*f-l*d)*r;a=a-q*g-c*h;b=b-m*g-d*h;y.save();y.transform(q,m,c,d,a,b);y.clip();y.drawImage(p,0,0);y.restore()}function k(a,b,c,d){qa[0]=255*a.r|0;qa[1]=255*a.g|0;qa[2]=255*a.b|0;qa[4]=255*b.r|0;qa[5]=
|
|
|
|
-255*b.g|0;qa[6]=255*b.b|0;qa[8]=255*c.r|0;qa[9]=255*c.g|0;qa[10]=255*c.b|0;qa[12]=255*d.r|0;qa[13]=255*d.g|0;qa[14]=255*d.b|0;Ma.putImageData(Pa,0,0);qb.drawImage(Qa,0,0);return cb}function l(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function n(a){A!==a&&(A=y.globalAlpha=a)}function s(a){L!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
|
|
|
+0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=E.length;d<e;d++){var f=E[d];La.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=Qa.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(La.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=Qa.setFromMatrixPosition(f.matrixWorld),h=b.dot(Qa.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(La.multiplyScalar(h)))))}}
|
|
|
|
+function c(a,b,c,d){r(b);q(c);u(d);p(a.getStyle());y.stroke();Ra.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);la[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
|
+function g(a,b,c,d,g,h,k,m,l,n,p,r,q){if(!(q instanceof THREE.DataTexture)){!1===q.hasEventListener("update",e)&&(void 0!==q.image&&0<q.image.width&&f(q),q.addEventListener("update",e));var s=la[q.id];if(void 0!==s){v(s);var s=q.offset.x/q.repeat.x,u=q.offset.y/q.repeat.y,t=q.image.width*q.repeat.x;q=q.image.height*q.repeat.y;k=(k+s)*t;m=(m+u)*q;c-=a;d-=b;g-=a;h-=b;l=(l+s)*t-k;n=(n+u)*q-m;p=(p+s)*t-k;r=(r+u)*q-m;q=l*r-p*n;0!==q&&(s=1/q,q=(r*c-n*g)*s,n=(r*d-n*h)*s,c=(l*g-p*c)*s,d=(l*h-p*d)*s,a=a-q*
|
|
|
|
+k-c*m,b=b-n*k-d*m,y.save(),y.transform(q,n,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,k,m,l,n,p){var q,r;q=p.width-1;r=p.height-1;g*=q;h*=r;c-=a;d-=b;e-=a;f-=b;k=k*q-g;m=m*r-h;l=l*q-g;n=n*r-h;r=1/(k*n-l*m);q=(n*c-m*e)*r;m=(n*d-m*f)*r;c=(k*e-l*c)*r;d=(k*f-l*d)*r;a=a-q*g-c*h;b=b-m*g-d*h;y.save();y.transform(q,m,c,d,a,b);y.clip();y.drawImage(p,0,0);y.restore()}function k(a,b,c,d){pa[0]=255*a.r|0;pa[1]=255*a.g|0;pa[2]=255*a.b|0;pa[4]=255*b.r|0;pa[5]=255*
|
|
|
|
+b.g|0;pa[6]=255*b.b|0;pa[8]=255*c.r|0;pa[9]=255*c.g|0;pa[10]=255*c.b|0;pa[12]=255*d.r|0;pa[13]=255*d.g|0;pa[14]=255*d.b|0;Oa.putImageData(Sa,0,0);Xa.drawImage(Ga,0,0);return Pa}function l(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function n(a){A!==a&&(A=y.globalAlpha=a)}function s(a){L!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
(y.globalCompositeOperation="darker"),L=a)}function r(a){R!==a&&(R=y.lineWidth=a)}function q(a){fa!==a&&(fa=y.lineCap=a)}function u(a){V!==a&&(V=y.lineJoin=a)}function p(a){Q!==a&&(Q=y.strokeStyle=a)}function v(a){Y!==a&&(Y=y.fillStyle=a)}function w(a,b){if(ga!==a||J!==b)y.setLineDash([a,b]),ga=a,J=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var t=THREE.Math.smoothstep;a=a||{};var x=this,z,B,E,H=new THREE.Projector,D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),G=D.width,I=
|
|
(y.globalCompositeOperation="darker"),L=a)}function r(a){R!==a&&(R=y.lineWidth=a)}function q(a){fa!==a&&(fa=y.lineCap=a)}function u(a){V!==a&&(V=y.lineJoin=a)}function p(a){Q!==a&&(Q=y.strokeStyle=a)}function v(a){Y!==a&&(Y=y.fillStyle=a)}function w(a,b){if(ga!==a||J!==b)y.setLineDash([a,b]),ga=a,J=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var t=THREE.Math.smoothstep;a=a||{};var x=this,z,B,E,H=new THREE.Projector,D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),G=D.width,I=
|
|
-D.height,O=Math.floor(G/2),K=Math.floor(I/2),y=D.getContext("2d",{alpha:!0===a.alpha}),F=new THREE.Color(0),C=0,A=1,L=0,Q=null,Y=null,R=null,fa=null,V=null,ga=null,J=0,da,W,N,ca;new THREE.RenderableVertex;new THREE.RenderableVertex;var sa,T,Ja,S,$,Fa,ta=new THREE.Color,oa=new THREE.Color,za=new THREE.Color,Aa=new THREE.Color,Ua=new THREE.Color,Va=new THREE.Color,ka=new THREE.Color,Ka=new THREE.Color,la={},Ba,Ia,ma,Ca,ba,wa,xa,Da,Wa,La,Ea=new THREE.Box2,na=new THREE.Box2,Oa=new THREE.Box2,hb=new THREE.Color,
|
|
|
|
-ya=new THREE.Color,ia=new THREE.Color,Na=new THREE.Vector3,ha=new THREE.Vector3,m=new THREE.Matrix3,Qa,Ma,Pa,qa,cb,qb,db=16;Qa=document.createElement("canvas");Qa.width=Qa.height=2;Ma=Qa.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Pa=Ma.getImageData(0,0,2,2);qa=Pa.data;cb=document.createElement("canvas");cb.width=cb.height=db;qb=cb.getContext("2d");qb.translate(-db/2,-db/2);qb.scale(db,db);db--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=
|
|
|
|
|
|
+D.height,O=Math.floor(G/2),K=Math.floor(I/2),y=D.getContext("2d",{alpha:!0===a.alpha}),F=new THREE.Color(0),C=0,A=1,L=0,Q=null,Y=null,R=null,fa=null,V=null,ga=null,J=0,da,W,N,ca;new THREE.RenderableVertex;new THREE.RenderableVertex;var sa,T,Ka,S,$,Ea,ta=new THREE.Color,oa=new THREE.Color,za=new THREE.Color,Aa=new THREE.Color,Wa=new THREE.Color,Fa=new THREE.Color,ka=new THREE.Color,La=new THREE.Color,la={},Ba,Ja,ma,Ca,ba,wa,xa,Na,hb,Ma,Da=new THREE.Box2,na=new THREE.Box2,Ra=new THREE.Box2,ib=new THREE.Color,
|
|
|
|
+ya=new THREE.Color,ia=new THREE.Color,Qa=new THREE.Vector3,ha=new THREE.Vector3,m=new THREE.Matrix3,Ga,Oa,Sa,pa,Pa,Xa,db=16;Ga=document.createElement("canvas");Ga.width=Ga.height=2;Oa=Ga.getContext("2d");Oa.fillStyle="rgba(0,0,0,1)";Oa.fillRect(0,0,2,2);Sa=Oa.getImageData(0,0,2,2);pa=Sa.data;Pa=document.createElement("canvas");Pa.width=Pa.height=db;Xa=Pa.getContext("2d");Xa.translate(-db/2,-db/2);Xa.scale(db,db);db--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=
|
|
null!==a[0]?a:null}:function(){});this.domElement=D;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){G=a*this.devicePixelRatio;I=b*this.devicePixelRatio;O=Math.floor(G/2);K=Math.floor(I/2);D.width=G;D.height=I;1!==this.devicePixelRatio&&
|
|
null!==a[0]?a:null}:function(){});this.domElement=D;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){G=a*this.devicePixelRatio;I=b*this.devicePixelRatio;O=Math.floor(G/2);K=Math.floor(I/2);D.width=G;D.height=I;1!==this.devicePixelRatio&&
|
|
-!1!==c&&(D.style.width=a+"px",D.style.height=b+"px");Ea.min.set(-O,-K);Ea.max.set(O,K);na.min.set(-O,-K);na.max.set(O,K);A=1;L=0;V=fa=R=Y=Q=null};this.setClearColor=function(a,b){F.set(a);C=void 0!==b?b:1;na.min.set(-O,-K);na.max.set(O,K)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,O,K);!1===na.empty()&&
|
|
|
|
-(na.intersect(Ea),na.expandByScalar(2),1>C&&y.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<C&&(s(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+C+")"),y.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,D){if(!1===D instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
-else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,O,K);x.info.render.vertices=0;x.info.render.faces=0;z=H.projectScene(a,D,this.sortObjects,this.sortElements);B=z.elements;E=z.lights;da=D;m.getNormalMatrix(D.matrixWorldInverse);hb.setRGB(0,0,0);ya.setRGB(0,0,0);ia.setRGB(0,0,0);for(var I=0,L=E.length;I<L;I++){var C=E[I],G=C.color;C instanceof THREE.AmbientLight?hb.add(G):C instanceof THREE.DirectionalLight?ya.add(G):C instanceof THREE.PointLight&&ia.add(G)}I=0;for(L=B.length;I<L;I++){var A=
|
|
|
|
-B[I],F=A.material;if(void 0!==F&&!1!==F.visible){Oa.makeEmpty();if(A instanceof THREE.RenderableSprite){W=A;W.x*=O;W.y*=K;C=W;G=F;n(G.opacity);s(G.blending);var J=A.scale.x*O,A=A.scale.y*K,F=0.5*Math.sqrt(J*J+A*A);Oa.min.set(C.x-F,C.y-F);Oa.max.set(C.x+F,C.y+F);if(G instanceof THREE.SpriteMaterial||G instanceof THREE.ParticleSystemMaterial){var Q=G.map;if(null!==Q){!1===Q.hasEventListener("update",e)&&(void 0!==Q.image&&0<Q.image.width&&f(Q),Q.addEventListener("update",e));F=la[Q.id];void 0!==F?v(F):
|
|
|
|
|
|
+!1!==c&&(D.style.width=a+"px",D.style.height=b+"px");Da.min.set(-O,-K);Da.max.set(O,K);na.min.set(-O,-K);na.max.set(O,K);A=1;L=0;V=fa=R=Y=Q=null};this.setClearColor=function(a,b){F.set(a);C=void 0!==b?b:1;na.min.set(-O,-K);na.max.set(O,K)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,O,K);!1===na.empty()&&
|
|
|
|
+(na.intersect(Da),na.expandByScalar(2),1>C&&y.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<C&&(s(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+C+")"),y.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,D){if(!1===D instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
+else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,O,K);x.info.render.vertices=0;x.info.render.faces=0;z=H.projectScene(a,D,this.sortObjects,this.sortElements);B=z.elements;E=z.lights;da=D;m.getNormalMatrix(D.matrixWorldInverse);ib.setRGB(0,0,0);ya.setRGB(0,0,0);ia.setRGB(0,0,0);for(var I=0,L=E.length;I<L;I++){var C=E[I],G=C.color;C instanceof THREE.AmbientLight?ib.add(G):C instanceof THREE.DirectionalLight?ya.add(G):C instanceof THREE.PointLight&&ia.add(G)}I=0;for(L=B.length;I<L;I++){var A=
|
|
|
|
+B[I],F=A.material;if(void 0!==F&&!1!==F.visible){Ra.makeEmpty();if(A instanceof THREE.RenderableSprite){W=A;W.x*=O;W.y*=K;C=W;G=F;n(G.opacity);s(G.blending);var J=A.scale.x*O,A=A.scale.y*K,F=0.5*Math.sqrt(J*J+A*A);Ra.min.set(C.x-F,C.y-F);Ra.max.set(C.x+F,C.y+F);if(G instanceof THREE.SpriteMaterial||G instanceof THREE.ParticleSystemMaterial){var Q=G.map;if(null!==Q){!1===Q.hasEventListener("update",e)&&(void 0!==Q.image&&0<Q.image.width&&f(Q),Q.addEventListener("update",e));F=la[Q.id];void 0!==F?v(F):
|
|
v("rgba( 0, 0, 0, 1 )");var R=Q.image,F=R.width*Q.offset.x,Y=R.height*Q.offset.y,V=R.width*Q.repeat.x,Q=R.height*Q.repeat.y,R=J/V,fa=A/Q;y.save();y.translate(C.x,C.y);0!==G.rotation&&y.rotate(G.rotation);y.translate(-J/2,-A/2);y.scale(R,fa);y.translate(-F,-Y);y.fillRect(F,Y,V,Q)}else v(G.color.getStyle()),y.save(),y.translate(C.x,C.y),0!==G.rotation&&y.rotate(G.rotation),y.scale(J,-A),y.fillRect(-0.5,-0.5,1,1);y.restore()}else G instanceof THREE.SpriteCanvasMaterial&&(p(G.color.getStyle()),v(G.color.getStyle()),
|
|
v("rgba( 0, 0, 0, 1 )");var R=Q.image,F=R.width*Q.offset.x,Y=R.height*Q.offset.y,V=R.width*Q.repeat.x,Q=R.height*Q.repeat.y,R=J/V,fa=A/Q;y.save();y.translate(C.x,C.y);0!==G.rotation&&y.rotate(G.rotation);y.translate(-J/2,-A/2);y.scale(R,fa);y.translate(-F,-Y);y.fillRect(F,Y,V,Q)}else v(G.color.getStyle()),y.save(),y.translate(C.x,C.y),0!==G.rotation&&y.rotate(G.rotation),y.scale(J,-A),y.fillRect(-0.5,-0.5,1,1);y.restore()}else G instanceof THREE.SpriteCanvasMaterial&&(p(G.color.getStyle()),v(G.color.getStyle()),
|
|
-y.save(),y.translate(C.x,C.y),0!==G.rotation&&y.rotate(G.rotation),y.scale(J,A),G.program(y),y.restore())}else if(A instanceof THREE.RenderableLine){if(W=A.v1,N=A.v2,W.positionScreen.x*=O,W.positionScreen.y*=K,N.positionScreen.x*=O,N.positionScreen.y*=K,Oa.setFromPoints([W.positionScreen,N.positionScreen]),!0===Ea.isIntersectionBox(Oa))if(C=W,G=N,J=A,A=F,n(A.opacity),s(A.blending),y.beginPath(),y.moveTo(C.positionScreen.x,C.positionScreen.y),y.lineTo(G.positionScreen.x,G.positionScreen.y),A instanceof
|
|
|
|
-THREE.LineBasicMaterial){r(A.linewidth);q(A.linecap);u(A.linejoin);if(A.vertexColors!==THREE.VertexColors)p(A.color.getStyle());else if(F=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),F===J)p(F);else{try{var ga=y.createLinearGradient(C.positionScreen.x,C.positionScreen.y,G.positionScreen.x,G.positionScreen.y);ga.addColorStop(0,F);ga.addColorStop(1,J)}catch(Nb){ga=F}p(ga)}y.stroke();Oa.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(r(A.linewidth),q(A.linecap),
|
|
|
|
-u(A.linejoin),p(A.color.getStyle()),w(A.dashSize,A.gapSize),y.stroke(),Oa.expandByScalar(2*A.linewidth),w(null,null))}else if(A instanceof THREE.RenderableFace){W=A.v1;N=A.v2;ca=A.v3;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;if(-1>N.positionScreen.z||1<N.positionScreen.z)continue;if(-1>ca.positionScreen.z||1<ca.positionScreen.z)continue;W.positionScreen.x*=O;W.positionScreen.y*=K;N.positionScreen.x*=O;N.positionScreen.y*=K;ca.positionScreen.x*=O;ca.positionScreen.y*=K;0<F.overdraw&&
|
|
|
|
-(l(W.positionScreen,N.positionScreen,F.overdraw),l(N.positionScreen,ca.positionScreen,F.overdraw),l(ca.positionScreen,W.positionScreen,F.overdraw));Oa.setFromPoints([W.positionScreen,N.positionScreen,ca.positionScreen]);if(!0===Ea.isIntersectionBox(Oa)){C=W;G=N;J=ca;x.info.render.vertices+=3;x.info.render.faces++;n(F.opacity);s(F.blending);sa=C.positionScreen.x;T=C.positionScreen.y;Ja=G.positionScreen.x;S=G.positionScreen.y;$=J.positionScreen.x;Fa=J.positionScreen.y;var Y=sa,V=T,Q=Ja,R=S,fa=$,tc=
|
|
|
|
-Fa;y.beginPath();y.moveTo(Y,V);y.lineTo(Q,R);y.lineTo(fa,tc);y.closePath();(F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial)&&null===F.map?(Va.copy(F.color),ka.copy(F.emissive),F.vertexColors===THREE.FaceColors&&Va.multiply(A.color),!1===F.wireframe&&F.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(oa.copy(hb),za.copy(hb),Aa.copy(hb),b(A.v1.positionWorld,A.vertexNormalsModel[0],oa),b(A.v2.positionWorld,A.vertexNormalsModel[1],za),b(A.v3.positionWorld,A.vertexNormalsModel[2],
|
|
|
|
-Aa),oa.multiply(Va).add(ka),za.multiply(Va).add(ka),Aa.multiply(Va).add(ka),Ua.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Ua),h(sa,T,Ja,S,$,Fa,0,0,1,0,0,1,ma)):(ta.copy(hb),b(A.centroidModel,A.normalModel,ta),ta.multiply(Va).add(ka),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta))):F instanceof THREE.MeshBasicMaterial||F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial?null!==F.map?F.map.mapping instanceof THREE.UVMapping&&
|
|
|
|
-(Ca=A.uvs[0],g(sa,T,Ja,S,$,Fa,Ca[0].x,Ca[0].y,Ca[1].x,Ca[1].y,Ca[2].x,Ca[2].y,F.map)):null!==F.envMap?F.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ha.copy(A.vertexNormalsModel[0]).applyMatrix3(m),ba=0.5*ha.x+0.5,wa=0.5*ha.y+0.5,ha.copy(A.vertexNormalsModel[1]).applyMatrix3(m),xa=0.5*ha.x+0.5,Da=0.5*ha.y+0.5,ha.copy(A.vertexNormalsModel[2]).applyMatrix3(m),Wa=0.5*ha.x+0.5,La=0.5*ha.y+0.5,g(sa,T,Ja,S,$,Fa,ba,wa,xa,Da,Wa,La,F.envMap)):(ta.copy(F.color),F.vertexColors===THREE.FaceColors&&
|
|
|
|
-ta.multiply(A.color),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta)):F instanceof THREE.MeshDepthMaterial?(Ba=da.near,Ia=da.far,oa.r=oa.g=oa.b=1-t(C.positionScreen.z*C.positionScreen.w,Ba,Ia),za.r=za.g=za.b=1-t(G.positionScreen.z*G.positionScreen.w,Ba,Ia),Aa.r=Aa.g=Aa.b=1-t(J.positionScreen.z*J.positionScreen.w,Ba,Ia),Ua.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Ua),h(sa,T,Ja,S,$,Fa,0,0,1,0,0,1,ma)):F instanceof THREE.MeshNormalMaterial&&(F.shading===
|
|
|
|
|
|
+y.save(),y.translate(C.x,C.y),0!==G.rotation&&y.rotate(G.rotation),y.scale(J,A),G.program(y),y.restore())}else if(A instanceof THREE.RenderableLine){if(W=A.v1,N=A.v2,W.positionScreen.x*=O,W.positionScreen.y*=K,N.positionScreen.x*=O,N.positionScreen.y*=K,Ra.setFromPoints([W.positionScreen,N.positionScreen]),!0===Da.isIntersectionBox(Ra))if(C=W,G=N,J=A,A=F,n(A.opacity),s(A.blending),y.beginPath(),y.moveTo(C.positionScreen.x,C.positionScreen.y),y.lineTo(G.positionScreen.x,G.positionScreen.y),A instanceof
|
|
|
|
+THREE.LineBasicMaterial){r(A.linewidth);q(A.linecap);u(A.linejoin);if(A.vertexColors!==THREE.VertexColors)p(A.color.getStyle());else if(F=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),F===J)p(F);else{try{var ga=y.createLinearGradient(C.positionScreen.x,C.positionScreen.y,G.positionScreen.x,G.positionScreen.y);ga.addColorStop(0,F);ga.addColorStop(1,J)}catch(pa){ga=F}p(ga)}y.stroke();Ra.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(r(A.linewidth),q(A.linecap),
|
|
|
|
+u(A.linejoin),p(A.color.getStyle()),w(A.dashSize,A.gapSize),y.stroke(),Ra.expandByScalar(2*A.linewidth),w(null,null))}else if(A instanceof THREE.RenderableFace){W=A.v1;N=A.v2;ca=A.v3;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;if(-1>N.positionScreen.z||1<N.positionScreen.z)continue;if(-1>ca.positionScreen.z||1<ca.positionScreen.z)continue;W.positionScreen.x*=O;W.positionScreen.y*=K;N.positionScreen.x*=O;N.positionScreen.y*=K;ca.positionScreen.x*=O;ca.positionScreen.y*=K;0<F.overdraw&&
|
|
|
|
+(l(W.positionScreen,N.positionScreen,F.overdraw),l(N.positionScreen,ca.positionScreen,F.overdraw),l(ca.positionScreen,W.positionScreen,F.overdraw));Ra.setFromPoints([W.positionScreen,N.positionScreen,ca.positionScreen]);if(!0===Da.isIntersectionBox(Ra)){C=W;G=N;J=ca;x.info.render.vertices+=3;x.info.render.faces++;n(F.opacity);s(F.blending);sa=C.positionScreen.x;T=C.positionScreen.y;Ka=G.positionScreen.x;S=G.positionScreen.y;$=J.positionScreen.x;Ea=J.positionScreen.y;var Y=sa,V=T,Q=Ka,R=S,fa=$,tc=
|
|
|
|
+Ea;y.beginPath();y.moveTo(Y,V);y.lineTo(Q,R);y.lineTo(fa,tc);y.closePath();(F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial)&&null===F.map?(Fa.copy(F.color),ka.copy(F.emissive),F.vertexColors===THREE.FaceColors&&Fa.multiply(A.color),!1===F.wireframe&&F.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(oa.copy(ib),za.copy(ib),Aa.copy(ib),b(A.v1.positionWorld,A.vertexNormalsModel[0],oa),b(A.v2.positionWorld,A.vertexNormalsModel[1],za),b(A.v3.positionWorld,A.vertexNormalsModel[2],
|
|
|
|
+Aa),oa.multiply(Fa).add(ka),za.multiply(Fa).add(ka),Aa.multiply(Fa).add(ka),Wa.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Wa),h(sa,T,Ka,S,$,Ea,0,0,1,0,0,1,ma)):(ta.copy(ib),b(A.centroidModel,A.normalModel,ta),ta.multiply(Fa).add(ka),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta))):F instanceof THREE.MeshBasicMaterial||F instanceof THREE.MeshLambertMaterial||F instanceof THREE.MeshPhongMaterial?null!==F.map?F.map.mapping instanceof THREE.UVMapping&&
|
|
|
|
+(Ca=A.uvs[0],g(sa,T,Ka,S,$,Ea,Ca[0].x,Ca[0].y,Ca[1].x,Ca[1].y,Ca[2].x,Ca[2].y,F.map)):null!==F.envMap?F.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ha.copy(A.vertexNormalsModel[0]).applyMatrix3(m),ba=0.5*ha.x+0.5,wa=0.5*ha.y+0.5,ha.copy(A.vertexNormalsModel[1]).applyMatrix3(m),xa=0.5*ha.x+0.5,Na=0.5*ha.y+0.5,ha.copy(A.vertexNormalsModel[2]).applyMatrix3(m),hb=0.5*ha.x+0.5,Ma=0.5*ha.y+0.5,g(sa,T,Ka,S,$,Ea,ba,wa,xa,Na,hb,Ma,F.envMap)):(ta.copy(F.color),F.vertexColors===THREE.FaceColors&&
|
|
|
|
+ta.multiply(A.color),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta)):F instanceof THREE.MeshDepthMaterial?(Ba=da.near,Ja=da.far,oa.r=oa.g=oa.b=1-t(C.positionScreen.z*C.positionScreen.w,Ba,Ja),za.r=za.g=za.b=1-t(G.positionScreen.z*G.positionScreen.w,Ba,Ja),Aa.r=Aa.g=Aa.b=1-t(J.positionScreen.z*J.positionScreen.w,Ba,Ja),Wa.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Wa),h(sa,T,Ka,S,$,Ea,0,0,1,0,0,1,ma)):F instanceof THREE.MeshNormalMaterial&&(F.shading===
|
|
THREE.FlatShading?(ha.copy(A.normalModel).applyMatrix3(m),ta.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta)):F.shading===THREE.SmoothShading&&(ha.copy(A.vertexNormalsModel[0]).applyMatrix3(m),oa.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),ha.copy(A.vertexNormalsModel[1]).applyMatrix3(m),za.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),ha.copy(A.vertexNormalsModel[2]).applyMatrix3(m),
|
|
THREE.FlatShading?(ha.copy(A.normalModel).applyMatrix3(m),ta.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),!0===F.wireframe?c(ta,F.wireframeLinewidth,F.wireframeLinecap,F.wireframeLinejoin):d(ta)):F.shading===THREE.SmoothShading&&(ha.copy(A.vertexNormalsModel[0]).applyMatrix3(m),oa.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),ha.copy(A.vertexNormalsModel[1]).applyMatrix3(m),za.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),ha.copy(A.vertexNormalsModel[2]).applyMatrix3(m),
|
|
-Aa.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),Ua.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Ua),h(sa,T,Ja,S,$,Fa,0,0,1,0,0,1,ma)))}}na.union(Oa)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
|
|
|
+Aa.setRGB(ha.x,ha.y,ha.z).multiplyScalar(0.5).addScalar(0.5),Wa.addColors(za,Aa).multiplyScalar(0.5),ma=k(oa,za,Aa,Wa),h(sa,T,Ka,S,$,Ea,0,0,1,0,0,1,ma)))}}na.union(Ra)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -385,26 +385,26 @@ THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=m.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=m.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.length,g=d(b,a),n=f(g),p=e(g),q=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);p&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));q&&(a.__colorArray=new Float32Array(3*h));n&&(0<c.faceVertexUvs.length&&(a.__uvArray=new Float32Array(2*h)),1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*h)));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&
|
|
function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.length,g=d(b,a),n=f(g),p=e(g),q=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);p&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));q&&(a.__colorArray=new Float32Array(3*h));n&&(0<c.faceVertexUvs.length&&(a.__uvArray=new Float32Array(2*h)),1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*h)));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&
|
|
-(a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*l);if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,n=a.numMorphTargets;c<n;c++)a.__morphTargetsArrays.push(new Float32Array(3*h));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,n=a.numMorphNormals;c<n;c++)a.__morphNormalsArrays.push(new Float32Array(3*h));a.__webglFaceCount=3*k;a.__webglLineCount=2*l;if(g.attributes){void 0===a.__webglCustomAttributesList&&
|
|
|
|
-(a.__webglCustomAttributesList=[]);for(var r in g.attributes){var k=g.attributes[r],l={},s;for(s in k)l[s]=k[s];if(!l.__webglInitialized||l.createUniqueBuffers)l.__webglInitialized=!0,c=1,"v2"===l.type?c=2:"v3"===l.type?c=3:"v4"===l.type?c=4:"c"===l.type&&(c=3),l.size=c,l.array=new Float32Array(h*c),l.buffer=m.createBuffer(),l.buffer.belongsToAttribute=r,k.needsUpdate=!0,l.__original=k;a.__webglCustomAttributesList.push(l)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
|
|
|
|
-a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c,d){var e,f,g,k;for(f in b)g=b[f],e=c[f],0<=g&&(e?(k=e.itemSize,m.bindBuffer(m.ARRAY_BUFFER,e.buffer),h(g),m.vertexAttribPointer(g,
|
|
|
|
-k,m.FLOAT,!1,0,d*k*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){0===Ea[a]&&(m.enableVertexAttribArray(a),Ea[a]=1)}function k(){for(var a in Ea)1===Ea[a]&&(m.disableVertexAttribArray(a),Ea[a]=0)}function l(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=
|
|
|
|
-a.length;d<e;d++)Fa=T=null,S=$=za=oa=la=Ka=Aa=-1,Na=!0,a[d].render(b,c,Wa,La),Fa=T=null,S=$=za=oa=la=Ka=Aa=-1,Na=!0}function r(a,b,c,d,e,f,g,h){var k,m,l,n;b?(m=a.length-1,n=b=-1):(m=0,b=a.length,n=1);for(var p=m;p!==b;p+=n)if(k=a[p],k.render){m=k.object;l=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&N.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);N.setDepthTest(k.depthTest);N.setDepthWrite(k.depthWrite);I(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}N.setMaterialFaces(k);
|
|
|
|
|
|
+(a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));c=Pa?Uint32Array:Uint16Array;a.__typeArray=c;a.__faceArray=new c(3*k);a.__lineArray=new c(2*l);if(a.numMorphTargets)for(a.__morphTargetsArrays=[],c=0,n=a.numMorphTargets;c<n;c++)a.__morphTargetsArrays.push(new Float32Array(3*h));if(a.numMorphNormals)for(a.__morphNormalsArrays=[],c=0,n=a.numMorphNormals;c<n;c++)a.__morphNormalsArrays.push(new Float32Array(3*h));a.__webglFaceCount=3*k;a.__webglLineCount=2*l;if(g.attributes){void 0===
|
|
|
|
+a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var r in g.attributes){var k=g.attributes[r],l={},s;for(s in k)l[s]=k[s];if(!l.__webglInitialized||l.createUniqueBuffers)l.__webglInitialized=!0,c=1,"v2"===l.type?c=2:"v3"===l.type?c=3:"v4"===l.type?c=4:"c"===l.type&&(c=3),l.size=c,l.array=new Float32Array(h*c),l.buffer=m.createBuffer(),l.buffer.belongsToAttribute=r,k.needsUpdate=!0,l.__original=k;a.__webglCustomAttributesList.push(l)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof
|
|
|
|
+THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c,d){var e,f,g,k;for(f in b)g=b[f],e=c[f],0<=g&&(e?(k=e.itemSize,m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+e.buffer),h(g),m.vertexAttribPointer(g,k,m.FLOAT,!1,0,d*k*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){0===Da[a]&&(m.enableVertexAttribArray(a),Da[a]=1)}function k(){for(var a in Da)1===Da[a]&&(m.disableVertexAttribArray(a),Da[a]=0)}function l(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function s(a,
|
|
|
|
+b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Ea=T=null,S=$=za=oa=la=La=Aa=-1,Qa=!0,a[d].render(b,c,hb,Ma),Ea=T=null,S=$=za=oa=la=La=Aa=-1,Qa=!0}function r(a,b,c,d,e,f,g,h){var k,m,l,n;b?(m=a.length-1,n=b=-1):(m=0,b=a.length,n=1);for(var p=m;p!==b;p+=n)if(k=a[p],k.render){m=k.object;l=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&N.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);N.setDepthTest(k.depthTest);N.setDepthWrite(k.depthWrite);I(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}N.setMaterialFaces(k);
|
|
l instanceof THREE.BufferGeometry?N.renderBufferDirect(d,e,f,k,l,m):N.renderBuffer(d,e,f,k,l,m)}}function q(a,b,c,d,e,f,g){for(var h,k,m=0,l=a.length;m<l;m++)if(h=a[m],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&N.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);N.setDepthTest(h.depthTest);N.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}N.renderImmediateObject(c,d,e,h,k)}}function u(a,d){var e,f,g;if(void 0===a.__webglInit&&
|
|
l instanceof THREE.BufferGeometry?N.renderBufferDirect(d,e,f,k,l,m):N.renderBuffer(d,e,f,k,l,m)}}function q(a,b,c,d,e,f,g){for(var h,k,m=0,l=a.length;m<l;m++)if(h=a[m],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&N.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);N.setDepthTest(h.depthTest);N.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}N.renderImmediateObject(c,d,e,h,k)}}function u(a,d){var e,f,g;if(void 0===a.__webglInit&&
|
|
-(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Kb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var h,k;for(g in f.attributes)k="index"===g?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,h=f.attributes[g],h.buffer=m.createBuffer(),m.bindBuffer(k,h.buffer),m.bufferData(k,h.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh)for(e in g=
|
|
|
|
-a.material,void 0===f.geometryGroups&&f.makeGroups(g instanceof THREE.MeshFaceMaterial),f.geometryGroups){if(g=f.geometryGroups[e],!g.__webglVertexBuffer){h=g;h.__webglVertexBuffer=m.createBuffer();h.__webglNormalBuffer=m.createBuffer();h.__webglTangentBuffer=m.createBuffer();h.__webglColorBuffer=m.createBuffer();h.__webglUVBuffer=m.createBuffer();h.__webglUV2Buffer=m.createBuffer();h.__webglSkinIndicesBuffer=m.createBuffer();h.__webglSkinWeightsBuffer=m.createBuffer();h.__webglFaceBuffer=m.createBuffer();
|
|
|
|
-h.__webglLineBuffer=m.createBuffer();var l=k=void 0;if(h.numMorphTargets)for(h.__webglMorphTargetsBuffers=[],k=0,l=h.numMorphTargets;k<l;k++)h.__webglMorphTargetsBuffers.push(m.createBuffer());if(h.numMorphNormals)for(h.__webglMorphNormalsBuffers=[],k=0,l=h.numMorphNormals;k<l;k++)h.__webglMorphNormalsBuffers.push(m.createBuffer());N.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=
|
|
|
|
-!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g.__webglLineDistanceBuffer=m.createBuffer(),N.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__lineDistanceArray=new Float32Array(1*h),g.__webglLineCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&
|
|
|
|
-!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),N.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__sortArray=[],g.__webglParticleCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)p(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=
|
|
|
|
|
|
+(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Ib)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry)for(g in f.attributes){var h="index"===g?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,k=f.attributes[g];k.buffer=m.createBuffer();m.bindBuffer(h,k.buffer);m.bufferData(h,k.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh)for(e in g=
|
|
|
|
+a.material,void 0===f.geometryGroups&&f.makeGroups(g instanceof THREE.MeshFaceMaterial,Pa?4294967296:65535),f.geometryGroups){if(g=f.geometryGroups[e],!g.__webglVertexBuffer){h=g;h.__webglVertexBuffer=m.createBuffer();h.__webglNormalBuffer=m.createBuffer();h.__webglTangentBuffer=m.createBuffer();h.__webglColorBuffer=m.createBuffer();h.__webglUVBuffer=m.createBuffer();h.__webglUV2Buffer=m.createBuffer();h.__webglSkinIndicesBuffer=m.createBuffer();h.__webglSkinWeightsBuffer=m.createBuffer();h.__webglFaceBuffer=
|
|
|
|
+m.createBuffer();h.__webglLineBuffer=m.createBuffer();var l=k=void 0;if(h.numMorphTargets)for(h.__webglMorphTargetsBuffers=[],k=0,l=h.numMorphTargets;k<l;k++)h.__webglMorphTargetsBuffers.push(m.createBuffer());if(h.numMorphNormals)for(h.__webglMorphNormalsBuffers=[],k=0,l=h.numMorphNormals;k<l;k++)h.__webglMorphNormalsBuffers.push(m.createBuffer());N.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;
|
|
|
|
+f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g.__webglLineDistanceBuffer=m.createBuffer(),N.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__lineDistanceArray=new Float32Array(1*h),g.__webglLineCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof
|
|
|
|
+THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),N.info.memory.geometries++,g=f,h=g.vertices.length,g.__vertexArray=new Float32Array(3*h),g.__colorArray=new Float32Array(3*h),g.__sortArray=[],g.__webglParticleCount=h,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)p(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=
|
|
f.geometryGroups[e],p(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,p(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function p(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,
|
|
f.geometryGroups[e],p(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,p(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function p(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,
|
|
z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function t(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?z(b.__webglSprites,a):a instanceof THREE.LensFlare?z(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}
|
|
z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function t(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?z(b.__webglSprites,a):a instanceof THREE.LensFlare?z(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}
|
|
-function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function B(a,b,c,d,e){ta=0;d.needsUpdate&&(d.program&&Eb(d),N.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==T&&(m.useProgram(g),T=g,f=!0);d.id!==S&&(S=d.id,f=!0);if(f||a!==Fa)m.uniformMatrix4fv(h.projectionMatrix,
|
|
|
|
-!1,a.projectionMatrix.elements),a!==Fa&&(Fa=a);if(d.skinning)if(ub&&e.useVertexTexture){if(null!==h.boneTexture){var l=E();m.uniform1i(h.boneTexture,l);N.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=
|
|
|
|
-c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Na){var n,p=l=0,q=0,r,s,u,t=ha,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,z=t.point.positions,B=t.point.distances,I=t.spot.colors,C=t.spot.positions,F=t.spot.distances,G=t.spot.directions,O=t.spot.anglesCos,J=t.spot.exponents,Q=t.hemi.skyColors,K=t.hemi.groundColors,ca=t.hemi.positions,R=0,Y=0,
|
|
|
|
-W=0,sa=0,cc=0,dc=0,Z=0,oa=0,V=n=0;c=u=V=0;for(f=b.length;c<f;c++)if(n=b[c],!n.onlyShadow)if(r=n.color,s=n.intensity,u=n.distance,n instanceof THREE.AmbientLight)n.visible&&(N.gammaInput?(l+=r.r*r.r,p+=r.g*r.g,q+=r.b*r.b):(l+=r.r,p+=r.g,q+=r.b));else if(n instanceof THREE.DirectionalLight){if(cc+=1,n.visible&&(ia.setFromMatrixPosition(n.matrixWorld),ya.setFromMatrixPosition(n.target.matrixWorld),ia.sub(ya),ia.normalize(),0!==ia.x||0!==ia.y||0!==ia.z))n=3*R,w[n]=ia.x,w[n+1]=ia.y,w[n+2]=ia.z,N.gammaInput?
|
|
|
|
-H(v,n,r,s*s):D(v,n,r,s),R+=1}else n instanceof THREE.PointLight?(dc+=1,n.visible&&(V=3*Y,N.gammaInput?H(x,V,r,s*s):D(x,V,r,s),ya.setFromMatrixPosition(n.matrixWorld),z[V]=ya.x,z[V+1]=ya.y,z[V+2]=ya.z,B[Y]=u,Y+=1)):n instanceof THREE.SpotLight?(Z+=1,n.visible&&(V=3*W,N.gammaInput?H(I,V,r,s*s):D(I,V,r,s),ya.setFromMatrixPosition(n.matrixWorld),C[V]=ya.x,C[V+1]=ya.y,C[V+2]=ya.z,F[W]=u,ia.copy(ya),ya.setFromMatrixPosition(n.target.matrixWorld),ia.sub(ya),ia.normalize(),G[V]=ia.x,G[V+1]=ia.y,G[V+2]=ia.z,
|
|
|
|
-O[W]=Math.cos(n.angle),J[W]=n.exponent,W+=1)):n instanceof THREE.HemisphereLight&&(oa+=1,n.visible&&(ia.setFromMatrixPosition(n.matrixWorld),ia.normalize(),0!==ia.x||0!==ia.y||0!==ia.z))&&(u=3*sa,ca[u]=ia.x,ca[u+1]=ia.y,ca[u+2]=ia.z,r=n.color,n=n.groundColor,N.gammaInput?(s*=s,H(Q,u,r,s),H(K,u,n,s)):(D(Q,u,r,s),D(K,u,n,s)),sa+=1);c=3*R;for(f=Math.max(v.length,3*cc);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(x.length,3*dc);c<f;c++)x[c]=0;c=3*W;for(f=Math.max(I.length,3*Z);c<f;c++)I[c]=0;c=3*sa;for(f=Math.max(Q.length,
|
|
|
|
-3*oa);c<f;c++)Q[c]=0;c=3*sa;for(f=Math.max(K.length,3*oa);c<f;c++)K[c]=0;t.directional.length=R;t.point.length=Y;t.spot.length=W;t.hemi.length=sa;t.ambient[0]=l;t.ambient[1]=p;t.ambient[2]=q;Na=!1}c=ha;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;
|
|
|
|
|
|
+function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function B(a,b,c,d,e){ta=0;d.needsUpdate&&(d.program&&Cb(d),N.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==T&&(m.useProgram(g),T=g,f=!0);d.id!==S&&(S=d.id,f=!0);if(f||a!==Ea)m.uniformMatrix4fv(h.projectionMatrix,
|
|
|
|
+!1,a.projectionMatrix.elements),a!==Ea&&(Ea=a);if(d.skinning)if(yb&&e.useVertexTexture){if(null!==h.boneTexture){var l=E();m.uniform1i(h.boneTexture,l);N.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=
|
|
|
|
+c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Qa){var n,p=l=0,q=0,r,s,u,t=ha,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,z=t.point.positions,B=t.point.distances,I=t.spot.colors,C=t.spot.positions,F=t.spot.distances,G=t.spot.directions,O=t.spot.anglesCos,J=t.spot.exponents,Q=t.hemi.skyColors,K=t.hemi.groundColors,ca=t.hemi.positions,R=0,Y=0,
|
|
|
|
+W=0,sa=0,ac=0,bc=0,Z=0,oa=0,V=n=0;c=u=V=0;for(f=b.length;c<f;c++)if(n=b[c],!n.onlyShadow)if(r=n.color,s=n.intensity,u=n.distance,n instanceof THREE.AmbientLight)n.visible&&(N.gammaInput?(l+=r.r*r.r,p+=r.g*r.g,q+=r.b*r.b):(l+=r.r,p+=r.g,q+=r.b));else if(n instanceof THREE.DirectionalLight){if(ac+=1,n.visible&&(ia.setFromMatrixPosition(n.matrixWorld),ya.setFromMatrixPosition(n.target.matrixWorld),ia.sub(ya),ia.normalize(),0!==ia.x||0!==ia.y||0!==ia.z))n=3*R,w[n]=ia.x,w[n+1]=ia.y,w[n+2]=ia.z,N.gammaInput?
|
|
|
|
+H(v,n,r,s*s):D(v,n,r,s),R+=1}else n instanceof THREE.PointLight?(bc+=1,n.visible&&(V=3*Y,N.gammaInput?H(x,V,r,s*s):D(x,V,r,s),ya.setFromMatrixPosition(n.matrixWorld),z[V]=ya.x,z[V+1]=ya.y,z[V+2]=ya.z,B[Y]=u,Y+=1)):n instanceof THREE.SpotLight?(Z+=1,n.visible&&(V=3*W,N.gammaInput?H(I,V,r,s*s):D(I,V,r,s),ya.setFromMatrixPosition(n.matrixWorld),C[V]=ya.x,C[V+1]=ya.y,C[V+2]=ya.z,F[W]=u,ia.copy(ya),ya.setFromMatrixPosition(n.target.matrixWorld),ia.sub(ya),ia.normalize(),G[V]=ia.x,G[V+1]=ia.y,G[V+2]=ia.z,
|
|
|
|
+O[W]=Math.cos(n.angle),J[W]=n.exponent,W+=1)):n instanceof THREE.HemisphereLight&&(oa+=1,n.visible&&(ia.setFromMatrixPosition(n.matrixWorld),ia.normalize(),0!==ia.x||0!==ia.y||0!==ia.z))&&(u=3*sa,ca[u]=ia.x,ca[u+1]=ia.y,ca[u+2]=ia.z,r=n.color,n=n.groundColor,N.gammaInput?(s*=s,H(Q,u,r,s),H(K,u,n,s)):(D(Q,u,r,s),D(K,u,n,s)),sa+=1);c=3*R;for(f=Math.max(v.length,3*ac);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(x.length,3*bc);c<f;c++)x[c]=0;c=3*W;for(f=Math.max(I.length,3*Z);c<f;c++)I[c]=0;c=3*sa;for(f=Math.max(Q.length,
|
|
|
|
+3*oa);c<f;c++)Q[c]=0;c=3*sa;for(f=Math.max(K.length,3*oa);c<f;c++)K[c]=0;t.directional.length=R;t.point.length=Y;t.spot.length=W;t.hemi.length=sa;t.ambient[0]=l;t.ambient[1]=p;t.ambient[2]=q;Qa=!1}c=ha;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances;k.spotLightColor.value=c.spot.colors;
|
|
k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;k.hemisphereLightSkyColor.value=c.hemi.skyColors;k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=
|
|
k.spotLightPosition.value=c.spot.positions;k.spotLightDistance.value=c.spot.distances;k.spotLightDirection.value=c.spot.directions;k.spotLightAngleCos.value=c.spot.anglesCos;k.spotLightExponent.value=c.spot.exponents;k.hemisphereLightSkyColor.value=c.hemi.skyColors;k.hemisphereLightGroundColor.value=c.hemi.groundColors;k.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){k.opacity.value=
|
|
d.opacity;N.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale);d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale));var $;d.map?$=d.map:d.specularMap?$=d.specularMap:d.normalMap?$=d.normalMap:d.bumpMap&&($=d.bumpMap);void 0!==$&&(c=$.offset,$=$.repeat,k.offsetRepeat.value.set(c.x,c.y,$.x,$.y));
|
|
d.opacity;N.gammaInput?k.diffuse.value.copyGammaToLinear(d.color):k.diffuse.value=d.color;k.map.value=d.map;k.lightMap.value=d.lightMap;k.specularMap.value=d.specularMap;d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale);d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale));var $;d.map?$=d.map:d.specularMap?$=d.specularMap:d.normalMap?$=d.normalMap:d.bumpMap&&($=d.bumpMap);void 0!==$&&(c=$.offset,$=$.repeat,k.offsetRepeat.value.set(c.x,c.y,$.x,$.y));
|
|
k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=
|
|
k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio;k.combine.value=d.combine;k.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=
|
|
@@ -413,112 +413,113 @@ d.wrapAround&&k.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMat
|
|
k.shadowMatrix)for(c=$=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[$]=l.shadowMap,k.shadowMapSize.value[$]=l.shadowMapSize,k.shadowMatrix.value[$]=l.shadowMatrix,k.shadowDarkness.value[$]=l.shadowDarkness,k.shadowBias.value[$]=l.shadowBias,$++);b=d.uniformsList;k=0;for($=b.length;k<$;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],p=c.type,l=c.value,"i"===p)m.uniform1i(f,l);else if("f"===p)m.uniform1f(f,
|
|
k.shadowMatrix)for(c=$=0,f=b.length;c<f;c++)l=b[c],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade)&&(k.shadowMap.value[$]=l.shadowMap,k.shadowMapSize.value[$]=l.shadowMapSize,k.shadowMatrix.value[$]=l.shadowMatrix,k.shadowDarkness.value[$]=l.shadowDarkness,k.shadowBias.value[$]=l.shadowBias,$++);b=d.uniformsList;k=0;for($=b.length;k<$;k++)if(f=g.uniforms[b[k][1]])if(c=b[k][0],p=c.type,l=c.value,"i"===p)m.uniform1i(f,l);else if("f"===p)m.uniform1f(f,
|
|
l);else if("v2"===p)m.uniform2f(f,l.x,l.y);else if("v3"===p)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===p)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===p)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===p)m.uniform1iv(f,l);else if("iv"===p)m.uniform3iv(f,l);else if("fv1"===p)m.uniform1fv(f,l);else if("fv"===p)m.uniform3fv(f,l);else if("v2v"===p){void 0===c._array&&(c._array=new Float32Array(2*l.length));p=0;for(q=l.length;p<q;p++)t=2*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y;m.uniform2fv(f,c._array)}else if("v3v"===
|
|
l);else if("v2"===p)m.uniform2f(f,l.x,l.y);else if("v3"===p)m.uniform3f(f,l.x,l.y,l.z);else if("v4"===p)m.uniform4f(f,l.x,l.y,l.z,l.w);else if("c"===p)m.uniform3f(f,l.r,l.g,l.b);else if("iv1"===p)m.uniform1iv(f,l);else if("iv"===p)m.uniform3iv(f,l);else if("fv1"===p)m.uniform1fv(f,l);else if("fv"===p)m.uniform3fv(f,l);else if("v2v"===p){void 0===c._array&&(c._array=new Float32Array(2*l.length));p=0;for(q=l.length;p<q;p++)t=2*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y;m.uniform2fv(f,c._array)}else if("v3v"===
|
|
p){void 0===c._array&&(c._array=new Float32Array(3*l.length));p=0;for(q=l.length;p<q;p++)t=3*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y,c._array[t+2]=l[p].z;m.uniform3fv(f,c._array)}else if("v4v"===p){void 0===c._array&&(c._array=new Float32Array(4*l.length));p=0;for(q=l.length;p<q;p++)t=4*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y,c._array[t+2]=l[p].z,c._array[t+3]=l[p].w;m.uniform4fv(f,c._array)}else if("m4"===p)void 0===c._array&&(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,
|
|
p){void 0===c._array&&(c._array=new Float32Array(3*l.length));p=0;for(q=l.length;p<q;p++)t=3*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y,c._array[t+2]=l[p].z;m.uniform3fv(f,c._array)}else if("v4v"===p){void 0===c._array&&(c._array=new Float32Array(4*l.length));p=0;for(q=l.length;p<q;p++)t=4*p,c._array[t]=l[p].x,c._array[t+1]=l[p].y,c._array[t+2]=l[p].z,c._array[t+3]=l[p].w;m.uniform4fv(f,c._array)}else if("m4"===p)void 0===c._array&&(c._array=new Float32Array(16)),l.flattenToArray(c._array),m.uniformMatrix4fv(f,
|
|
-!1,c._array);else if("m4v"===p){void 0===c._array&&(c._array=new Float32Array(16*l.length));p=0;for(q=l.length;p<q;p++)l[p].flattenToArrayOffset(c._array,16*p);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===p){if(t=l,l=E(),m.uniform1i(f,l),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Cb),c.image.__webglTextureCube=m.createTexture(),N.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);
|
|
|
|
-m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(p=0;6>p;p++)N.autoScaleCubemaps&&!f?(q=l,t=p,v=c.image[p],x=db,v.width<=x&&v.height<=x||(z=Math.max(v.width,v.height),w=Math.floor(v.width*x/z),x=Math.floor(v.height*x/z),z=document.createElement("canvas"),z.width=w,z.height=x,z.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=z),q[t]=v):l[p]=c.image[p];p=l[0];q=THREE.Math.isPowerOfTwo(p.width)&&
|
|
|
|
|
|
+!1,c._array);else if("m4v"===p){void 0===c._array&&(c._array=new Float32Array(16*l.length));p=0;for(q=l.length;p<q;p++)l[p].flattenToArrayOffset(c._array,16*p);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===p){if(t=l,l=E(),m.uniform1i(f,l),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=l,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",tb),c.image.__webglTextureCube=m.createTexture(),N.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);
|
|
|
|
+m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;l=[];for(p=0;6>p;p++)N.autoScaleCubemaps&&!f?(q=l,t=p,v=c.image[p],x=Wb,v.width<=x&&v.height<=x||(z=Math.max(v.width,v.height),w=Math.floor(v.width*x/z),x=Math.floor(v.height*x/z),z=document.createElement("canvas"),z.width=w,z.height=x,z.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=z),q[t]=v):l[p]=c.image[p];p=l[0];q=THREE.Math.isPowerOfTwo(p.width)&&
|
|
THREE.Math.isPowerOfTwo(p.height);t=A(c.format);v=A(c.type);y(m.TEXTURE_CUBE_MAP,c,q);for(p=0;6>p;p++)if(f)for(x=l[p].mipmaps,z=0,B=x.length;z<B;z++)w=x[z],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,z,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,z,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,t,t,v,l[p]);c.generateMipmaps&&q&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+
|
|
THREE.Math.isPowerOfTwo(p.height);t=A(c.format);v=A(c.type);y(m.TEXTURE_CUBE_MAP,c,q);for(p=0;6>p;p++)if(f)for(x=l[p].mipmaps,z=0,B=x.length;z<B;z++)w=x[z],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,z,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,z,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,t,t,v,l[p]);c.generateMipmaps&&q&&m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+
|
|
f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):N.setTexture(t,l)}else if("tv"===p){void 0===c._array&&(c._array=[]);p=0;for(q=c.value.length;p<q;p++)c._array[p]=E();m.uniform1iv(f,c._array);p=0;for(q=c.value.length;p<q;p++)t=c.value[p],l=c._array[p],t&&N.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+p);(d instanceof
|
|
f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):N.setTexture(t,l)}else if("tv"===p){void 0===c._array&&(c._array=[]);p=0;for(q=c.value.length;p<q;p++)c._array[p]=E();m.uniform1iv(f,c._array);p=0;for(q=c.value.length;p<q;p++)t=c.value[p],l=c._array[p],t&&N.setTexture(t,l)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+p);(d instanceof
|
|
THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(ya.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,ya.x,ya.y,ya.z));(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,
|
|
THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(ya.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,ya.x,ya.y,ya.z));(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,
|
|
-!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=ta;a>=cb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+cb);ta+=1;return a}function H(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function D(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function G(a){a!==Ca&&(m.lineWidth(a),Ca=a)}function I(a,b,c){Ba!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),
|
|
|
|
-Ba=a);!a||Ia===b&&ma===c||(m.polygonOffset(b,c),Ia=b,ma=c)}function O(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function K(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),console.error(O(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,A(b.wrapS)),
|
|
|
|
-m.texParameteri(a,m.TEXTURE_WRAP_T,A(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,A(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,A(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,C(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,C(b.minFilter)));Pa&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,Pa.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,
|
|
|
|
-Bb)),b.__oldAnisotropy=b.anisotropy)}function F(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,
|
|
|
|
|
|
+!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=ta;a>=Xa&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Xa);ta+=1;return a}function H(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function D(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function G(a){a!==Ca&&(m.lineWidth(a),Ca=a)}function I(a,b,c){Ba!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),
|
|
|
|
+Ba=a);!a||Ja===b&&ma===c||(m.polygonOffset(b,c),Ja=b,ma=c)}function O(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function K(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),console.error(O(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,A(b.wrapS)),
|
|
|
|
+m.texParameteri(a,m.TEXTURE_WRAP_T,A(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,A(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,A(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,C(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,C(b.minFilter)));Sa&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,Sa.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,
|
|
|
|
+Hb)),b.__oldAnisotropy=b.anisotropy)}function F(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,
|
|
m.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;
|
|
m.RGBA4,b.width,b.height)}function C(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;
|
|
if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;
|
|
if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;
|
|
if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===
|
|
if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===
|
|
THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;
|
|
THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;
|
|
-if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==qa){if(a===THREE.RGB_S3TC_DXT1_Format)return qa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return qa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return qa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return qa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);
|
|
|
|
|
|
+if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==pa){if(a===THREE.RGB_S3TC_DXT1_Format)return pa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return pa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return pa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return pa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);
|
|
a=a||{};var L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),Q=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,fa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,V=void 0!==a.antialias?a.antialias:!1,ga=void 0!==a.stencil?a.stencil:!0,J=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,da=new THREE.Color(0),W=0;this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:
|
|
a=a||{};var L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),Q=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,fa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,V=void 0!==a.antialias?a.antialias:!1,ga=void 0!==a.stencil?a.stencil:!0,J=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,da=new THREE.Color(0),W=0;this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:
|
|
void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=
|
|
void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=
|
|
-[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var N=this,ca=[],sa=0,T=null,Ja=null,S=-1,$=null,Fa=null,ta=0,oa=-1,za=-1,Aa=-1,Ua=-1,Va=-1,ka=-1,Ka=-1,la=-1,Ba=null,Ia=null,ma=null,Ca=null,ba=0,wa=0,xa=L.width,Da=L.height,Wa=0,La=0,Ea=new Uint8Array(16),na=new THREE.Frustum,Oa=new THREE.Matrix4,hb=new THREE.Matrix4,ya=new THREE.Vector3,ia=new THREE.Vector3,Na=!0,ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
|
-colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},m,Qa,Ma,Pa,qa;(function(){try{var a={alpha:R,premultipliedAlpha:fa,antialias:V,stencil:ga,preserveDrawingBuffer:J};m=Q||L.getContext("webgl",a)||L.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Qa=m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");
|
|
|
|
-Ma=m.getExtension("OES_standard_derivatives");Pa=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");qa=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Qa||console.log("THREE.WebGLRenderer: Float textures not supported.");Ma||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
|
-Pa||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");qa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})})();m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,
|
|
|
|
-m.ONE_MINUS_SRC_ALPHA);m.viewport(ba,wa,xa,Da);m.clearColor(da.r,da.g,da.b,W);this.context=m;var cb=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),qb=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var db=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Bb=Pa?m.getParameter(Pa.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,yb=0<qb,ub=yb&&Qa;qa&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var Yb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),Zb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
|
-m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var $b=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),ac=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,
|
|
|
|
-m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var bc=0<Yb.precision&&0<$b.precision,Jb=0<Zb.precision&&0<ac.precision;"highp"!==Y||bc||(Jb?(Y="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(Y="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"!==Y||Jb||(Y="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return m};this.supportsVertexTextures=function(){return yb};
|
|
|
|
-this.supportsFloatTextures=function(){return Qa};this.supportsStandardDerivatives=function(){return Ma};this.supportsCompressedTextureS3TC=function(){return qa};this.getMaxAnisotropy=function(){return Bb};this.getPrecision=function(){return Y};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ba=a*this.devicePixelRatio;
|
|
|
|
-wa=b*this.devicePixelRatio;xa=c*this.devicePixelRatio;Da=d*this.devicePixelRatio;m.viewport(ba,wa,xa,Da)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColor=function(a,b){da.set(a);W=void 0!==b?b:1;m.clearColor(da.r,da.g,da.b,W)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
|
-this.setClearColor(a,b)};this.getClearColor=function(){return da};this.getClearAlpha=function(){return W};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
|
-this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){T=null;S=$=la=Ka=Aa=-1;Na=!0;za=oa=-1;this.shadowMapPlugin.update(a,b)};var Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&m.deleteBuffer(b[c].buffer);N.info.memory.geometries--}else if(void 0!==
|
|
|
|
-a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);Db(c)}else Db(a)},Cb=function(a){a=a.target;a.removeEventListener("dispose",Cb);a.image&&a.image.__webglTextureCube?m.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,m.deleteTexture(a.__webglTexture));
|
|
|
|
-N.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);if(a&&a.__webglTexture)if(m.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);N.info.memory.textures--},Mb=function(a){a=a.target;a.removeEventListener("dispose",Mb);Eb(a)},Db=function(a){void 0!==
|
|
|
|
-a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&m.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&m.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&m.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&
|
|
|
|
-m.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&m.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&m.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&m.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[b].buffer);N.info.memory.geometries--},Eb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;
|
|
|
|
-a=0;for(c=ca.length;a<c;a++)if(d=ca[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ca.length;a<c;a++)d=ca[a],d.program!==b&&e.push(d);ca=e;m.deleteProgram(b);N.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&
|
|
|
|
-!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,k,l,n,p,q,r,s=3*a.count;for(r=0;r<s;r+=9)q=a.normalArray,d=q[r],e=q[r+1],f=q[r+2],
|
|
|
|
-g=q[r+3],k=q[r+4],n=q[r+5],h=q[r+6],l=q[r+7],p=q[r+8],d=(d+g+h)/3,e=(e+k+l)/3,f=(f+n+p)/3,q[r]=d,q[r+1]=e,q[r+2]=f,q[r+3]=d,q[r+4]=e,q[r+5]=f,q[r+6]=d,q[r+7]=e,q[r+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer),m.bufferData(m.ARRAY_BUFFER,a.uvArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,
|
|
|
|
-2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var l,n,p,q;l=B(a,b,c,d,f);a=l.attributes;b=e.attributes;c=!1;l=16777215*e.id+2*l.id+(d.wireframe?1:0);l!==$&&
|
|
|
|
-($=l,c=!0);c&&k();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var r=0,s=e.length;r<s;r++){var t=e[r].index;if(c){for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,t*q*4)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-f.buffer)}m.drawElements(m.TRIANGLES,e[r].count,m.UNSIGNED_SHORT,2*e[r].start);N.info.render.calls++;N.info.render.vertices+=e[r].count;N.info.render.faces+=e[r].count/3}}else{if(c)for(n in a)"index"!==n&&(p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&
|
|
|
|
-m.vertexAttrib3fv(p,d.defaultAttributeValues[n]))));d=e.attributes.position;m.drawArrays(m.TRIANGLES,0,d.array.length/3);N.info.render.calls++;N.info.render.vertices+=d.array.length/3;N.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?
|
|
|
|
-m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));d=b.position;m.drawArrays(m.POINTS,0,d.array.length/3);N.info.render.calls++;N.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(n=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,G(d.linewidth),f=b.index)for(e=e.offsets,1<e.length&&(c=!0),r=0,s=e.length;r<s;r++)t=e[r].index,c&&(g(d,a,b,t),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,
|
|
|
|
-e[r].count,m.UNSIGNED_SHORT,2*e[r].start),N.info.render.calls++,N.info.render.vertices+=e[r].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),N.info.render.calls++,N.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,l;c=B(a,b,c,d,f);a=c.attributes;b=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==$&&($=c,b=!0);b&&k();if(!d.morphTargets&&0<=a.position)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),m.vertexAttribPointer(a.position,
|
|
|
|
-3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var p=0;l=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;p<d.numSupportedMorphTargets&&
|
|
|
|
-p<l.length;)0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[p]]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[p]]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[l[p]],p++}else{l=[];g=f.morphTargetInfluences;var q,r=g.length;for(q=0;q<r;q++)p=g[q],0<p&&l.push([p,
|
|
|
|
-q]);l.length>d.numSupportedMorphTargets?(l.sort(n),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(n):0===l.length&&l.push([0,0]);for(p=0;p<d.numSupportedMorphTargets;)l[p]?(q=l[p][1],0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),h(c["morphNormal"+
|
|
|
|
-p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[q]):f.__webglMorphTargetInfluences[p]=0,p++}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList)for(g=0,l=e.__webglCustomAttributesList.length;g<l;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),
|
|
|
|
-m.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,m.FLOAT,!1,0,0));0<=a.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib3fv(a.color,d.defaultAttributeValues.color));0<=a.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));0<=a.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
-e.__webglTangentBuffer),h(a.tangent),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));0<=a.uv2&&(f.geometry.faceVertexUvs[1]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(a.uv2,
|
|
|
|
-d.defaultAttributeValues.uv2));d.skinning&&0<=a.skinIndex&&0<=a.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0));0<=a.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),m.vertexAttribPointer(a.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?
|
|
|
|
-(d.wireframe?(G(d.wireframeLinewidth),b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,0)):(b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),N.info.render.calls++,N.info.render.vertices+=e.__webglFaceCount,N.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,G(d.linewidth),m.drawArrays(f,0,
|
|
|
|
-e.__webglLineCount),N.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),N.info.render.calls++,N.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,k=a.__lights,p=a.fog;S=-1;Na=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
|
-Oa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(Oa);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);N.info.render.calls=0;N.info.render.vertices=0;N.info.render.faces=0;N.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof
|
|
|
|
-THREE.ParticleSystem)||!g.frustumCulled||na.intersectsObject(g))){var n=g;n._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,n.matrixWorld);n._normalMatrix.getNormalMatrix(n._modelViewMatrix);var n=f,t=n.object,u=n.buffer,v=t.geometry,t=t.material;t instanceof THREE.MeshFaceMaterial?(t=t.materials[v instanceof THREE.BufferGeometry?0:u.materialIndex],t.transparent?(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=null)):t&&(t.transparent?(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=
|
|
|
|
-null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ya.setFromMatrixPosition(g.matrixWorld),ya.applyProjection(Oa),f.z=ya.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?
|
|
|
|
-(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,k,p,!0,d),q(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,k,p,!1,d),q(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),r(a.__webglObjects,!1,"transparent",b,k,p,!0,d),q(a.__webglObjectsImmediate,
|
|
|
|
-"transparent",b,k,p,!0,d));s(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=
|
|
|
|
-function(a,b,c,d,e){var f=B(a,b,c,d,e);$=-1;N.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,na):e.render(function(a){N.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)u(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)t(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=
|
|
|
|
-0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&t(h,a),u(h,a));var k=h,l=k.geometry,p=void 0,q=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var s=m.DYNAMIC_DRAW,x=l.attributes,z=void 0,y=void 0;for(z in x)y=x[z],y.needsUpdate&&("index"===z?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,y.array,s)):(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,s)),y.needsUpdate=
|
|
|
|
-!1)}else if(k instanceof THREE.Mesh){for(var B=0,I=l.geometryGroupsList.length;B<I;B++)if(p=l.geometryGroupsList[B],r=d(k,p),l.buffersNeedUpdate&&c(p,k),q=r.attributes&&v(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||q){var A=p,D=k,C=m.DYNAMIC_DRAW,F=!l.dynamic,G=r;if(A.__inittedArrays){var H=e(G),O=G.vertexColors?G.vertexColors:!1,L=f(G),N=H===THREE.SmoothShading,E=void 0,J=void 0,Q=void 0,
|
|
|
|
-K=void 0,ca=void 0,R=void 0,Y=void 0,W=void 0,V=void 0,$=void 0,sa=void 0,S=void 0,T=void 0,Z=void 0,oa=void 0,ta=void 0,Fa=void 0,da=void 0,Ja=void 0,fa=void 0,ga=void 0,ha=void 0,za=void 0,ka=void 0,ia=void 0,la=void 0,na=void 0,qa=void 0,Aa=void 0,ba=void 0,Ea=void 0,Ca=void 0,Ka=void 0,Ia=void 0,ma=void 0,La=void 0,wa=void 0,xa=void 0,Ua=void 0,Va=void 0,Ba=0,Da=0,Na=0,Pa=0,Qa=0,ib=0,Ya=0,Ma=0,eb=0,va=0,Ga=0,P=0,Xa=void 0,jb=A.__vertexArray,cb=A.__uvArray,db=A.__uv2Array,Wa=A.__normalArray,Za=
|
|
|
|
-A.__tangentArray,kb=A.__colorArray,$a=A.__skinIndexArray,ab=A.__skinWeightArray,qb=A.__morphTargetsArrays,yb=A.__morphNormalsArrays,ub=A.__webglCustomAttributesList,M=void 0,Ob=A.__faceArray,vb=A.__lineArray,Ra=D.geometry,Cb=Ra.elementsNeedUpdate,Bb=Ra.uvsNeedUpdate,Jb=Ra.normalsNeedUpdate,Kb=Ra.tangentsNeedUpdate,Lb=Ra.colorsNeedUpdate,Mb=Ra.morphTargetsNeedUpdate,ec=Ra.vertices,ea=A.faces3,lb=Ra.faces,Db=Ra.faceVertexUvs[0],Eb=Ra.faceVertexUvs[1],fc=Ra.skinIndices,Pb=Ra.skinWeights,Qb=Ra.morphTargets,
|
|
|
|
-kc=Ra.morphNormals;if(Ra.verticesNeedUpdate){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],S=ec[K.a],T=ec[K.b],Z=ec[K.c],jb[Da]=S.x,jb[Da+1]=S.y,jb[Da+2]=S.z,jb[Da+3]=T.x,jb[Da+4]=T.y,jb[Da+5]=T.z,jb[Da+6]=Z.x,jb[Da+7]=Z.y,jb[Da+8]=Z.z,Da+=9;m.bindBuffer(m.ARRAY_BUFFER,A.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,jb,C)}if(Mb)for(ma=0,La=Qb.length;ma<La;ma++){E=Ga=0;for(J=ea.length;E<J;E++)Ua=ea[E],K=lb[Ua],S=Qb[ma].vertices[K.a],T=Qb[ma].vertices[K.b],Z=Qb[ma].vertices[K.c],wa=qb[ma],wa[Ga]=S.x,wa[Ga+
|
|
|
|
-1]=S.y,wa[Ga+2]=S.z,wa[Ga+3]=T.x,wa[Ga+4]=T.y,wa[Ga+5]=T.z,wa[Ga+6]=Z.x,wa[Ga+7]=Z.y,wa[Ga+8]=Z.z,G.morphNormals&&(N?(Va=kc[ma].vertexNormals[Ua],da=Va.a,Ja=Va.b,fa=Va.c):fa=Ja=da=kc[ma].faceNormals[Ua],xa=yb[ma],xa[Ga]=da.x,xa[Ga+1]=da.y,xa[Ga+2]=da.z,xa[Ga+3]=Ja.x,xa[Ga+4]=Ja.y,xa[Ga+5]=Ja.z,xa[Ga+6]=fa.x,xa[Ga+7]=fa.y,xa[Ga+8]=fa.z),Ga+=9;m.bindBuffer(m.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[ma]);m.bufferData(m.ARRAY_BUFFER,qb[ma],C);G.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglMorphNormalsBuffers[ma]),
|
|
|
|
-m.bufferData(m.ARRAY_BUFFER,yb[ma],C))}if(Pb.length){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],ka=Pb[K.a],ia=Pb[K.b],la=Pb[K.c],ab[va]=ka.x,ab[va+1]=ka.y,ab[va+2]=ka.z,ab[va+3]=ka.w,ab[va+4]=ia.x,ab[va+5]=ia.y,ab[va+6]=ia.z,ab[va+7]=ia.w,ab[va+8]=la.x,ab[va+9]=la.y,ab[va+10]=la.z,ab[va+11]=la.w,na=fc[K.a],qa=fc[K.b],Aa=fc[K.c],$a[va]=na.x,$a[va+1]=na.y,$a[va+2]=na.z,$a[va+3]=na.w,$a[va+4]=qa.x,$a[va+5]=qa.y,$a[va+6]=qa.z,$a[va+7]=qa.w,$a[va+8]=Aa.x,$a[va+9]=Aa.y,$a[va+10]=Aa.z,$a[va+11]=Aa.w,va+=12;
|
|
|
|
-0<va&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,$a,C),m.bindBuffer(m.ARRAY_BUFFER,A.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,ab,C))}if(Lb&&O){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],Y=K.vertexColors,W=K.color,3===Y.length&&O===THREE.VertexColors?(ga=Y[0],ha=Y[1],za=Y[2]):za=ha=ga=W,kb[eb]=ga.r,kb[eb+1]=ga.g,kb[eb+2]=ga.b,kb[eb+3]=ha.r,kb[eb+4]=ha.g,kb[eb+5]=ha.b,kb[eb+6]=za.r,kb[eb+7]=za.g,kb[eb+8]=za.b,eb+=9;0<eb&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
-A.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,kb,C))}if(Kb&&Ra.hasTangents){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],V=K.vertexTangents,oa=V[0],ta=V[1],Fa=V[2],Za[Ya]=oa.x,Za[Ya+1]=oa.y,Za[Ya+2]=oa.z,Za[Ya+3]=oa.w,Za[Ya+4]=ta.x,Za[Ya+5]=ta.y,Za[Ya+6]=ta.z,Za[Ya+7]=ta.w,Za[Ya+8]=Fa.x,Za[Ya+9]=Fa.y,Za[Ya+10]=Fa.z,Za[Ya+11]=Fa.w,Ya+=12;m.bindBuffer(m.ARRAY_BUFFER,A.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,Za,C)}if(Jb&&H){E=0;for(J=ea.length;E<J;E++)if(K=lb[ea[E]],ca=K.vertexNormals,R=K.normal,
|
|
|
|
-3===ca.length&&N)for(ba=0;3>ba;ba++)Ca=ca[ba],Wa[ib]=Ca.x,Wa[ib+1]=Ca.y,Wa[ib+2]=Ca.z,ib+=3;else for(ba=0;3>ba;ba++)Wa[ib]=R.x,Wa[ib+1]=R.y,Wa[ib+2]=R.z,ib+=3;m.bindBuffer(m.ARRAY_BUFFER,A.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Wa,C)}if(Bb&&Db&&L){E=0;for(J=ea.length;E<J;E++)if(Q=ea[E],$=Db[Q],void 0!==$)for(ba=0;3>ba;ba++)Ka=$[ba],cb[Na]=Ka.x,cb[Na+1]=Ka.y,Na+=2;0<Na&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,cb,C))}if(Bb&&Eb&&L){E=0;for(J=ea.length;E<
|
|
|
|
-J;E++)if(Q=ea[E],sa=Eb[Q],void 0!==sa)for(ba=0;3>ba;ba++)Ia=sa[ba],db[Pa]=Ia.x,db[Pa+1]=Ia.y,Pa+=2;0<Pa&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,db,C))}if(Cb){E=0;for(J=ea.length;E<J;E++)Ob[Qa]=Ba,Ob[Qa+1]=Ba+1,Ob[Qa+2]=Ba+2,Qa+=3,vb[Ma]=Ba,vb[Ma+1]=Ba+1,vb[Ma+2]=Ba,vb[Ma+3]=Ba+2,vb[Ma+4]=Ba+1,vb[Ma+5]=Ba+2,Ma+=6,Ba+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ob,C);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);
|
|
|
|
-m.bufferData(m.ELEMENT_ARRAY_BUFFER,vb,C)}if(ub)for(ba=0,Ea=ub.length;ba<Ea;ba++)if(M=ub[ba],M.__original.needsUpdate){P=0;if(1===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)K=lb[ea[E]],M.array[P]=M.value[K.a],M.array[P+1]=M.value[K.b],M.array[P+2]=M.value[K.c],P+=3;else{if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Xa=M.value[ea[E]],M.array[P]=Xa,M.array[P+1]=Xa,M.array[P+2]=Xa,P+=3}else if(2===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,
|
|
|
|
-J=ea.length;E<J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=T.x,M.array[P+3]=T.y,M.array[P+4]=Z.x,M.array[P+5]=Z.y,P+=6;else{if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Z=T=S=Xa=M.value[ea[E]],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=T.x,M.array[P+3]=T.y,M.array[P+4]=Z.x,M.array[P+5]=Z.y,P+=6}else if(3===M.size){var ua;ua="c"===M.type?["r","g","b"]:["x","y","z"];if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<
|
|
|
|
-J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],M.array[P+7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9;else if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Z=T=S=Xa=M.value[ea[E]],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],M.array[P+
|
|
|
|
-7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9;else if("faceVertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Xa=M.value[ea[E]],S=Xa[0],T=Xa[1],Z=Xa[2],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],M.array[P+7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9}else if(4===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=
|
|
|
|
-S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;else if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Z=T=S=Xa=M.value[ea[E]],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;else if("faceVertices"===
|
|
|
|
-M.boundTo)for(E=0,J=ea.length;E<J;E++)Xa=M.value[ea[E]],S=Xa[0],T=Xa[1],Z=Xa[2],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;m.bindBuffer(m.ARRAY_BUFFER,M.buffer);m.bufferData(m.ARRAY_BUFFER,M.array,C)}F&&(delete A.__inittedArrays,delete A.__colorArray,delete A.__normalArray,delete A.__tangentArray,delete A.__uvArray,delete A.__uv2Array,
|
|
|
|
-delete A.__faceArray,delete A.__vertexArray,delete A.__lineArray,delete A.__skinIndexArray,delete A.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;r.attributes&&w(r)}else if(k instanceof THREE.Line){r=d(k,l);q=r.attributes&&v(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||q){var bb=l,Rb=m.DYNAMIC_DRAW,Fb=void 0,
|
|
|
|
-Gb=void 0,Hb=void 0,Sb=void 0,ra=void 0,Tb=void 0,lc=bb.vertices,mc=bb.colors,nc=bb.lineDistances,Yb=lc.length,Zb=mc.length,$b=nc.length,Ub=bb.__vertexArray,Vb=bb.__colorArray,oc=bb.__lineDistanceArray,ac=bb.colorsNeedUpdate,bc=bb.lineDistancesNeedUpdate,gc=bb.__webglCustomAttributesList,Wb=void 0,pc=void 0,Ha=void 0,zb=void 0,Sa=void 0,pa=void 0;if(bb.verticesNeedUpdate){for(Fb=0;Fb<Yb;Fb++)Sb=lc[Fb],ra=3*Fb,Ub[ra]=Sb.x,Ub[ra+1]=Sb.y,Ub[ra+2]=Sb.z;m.bindBuffer(m.ARRAY_BUFFER,bb.__webglVertexBuffer);
|
|
|
|
-m.bufferData(m.ARRAY_BUFFER,Ub,Rb)}if(ac){for(Gb=0;Gb<Zb;Gb++)Tb=mc[Gb],ra=3*Gb,Vb[ra]=Tb.r,Vb[ra+1]=Tb.g,Vb[ra+2]=Tb.b;m.bindBuffer(m.ARRAY_BUFFER,bb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Vb,Rb)}if(bc){for(Hb=0;Hb<$b;Hb++)oc[Hb]=nc[Hb];m.bindBuffer(m.ARRAY_BUFFER,bb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,oc,Rb)}if(gc)for(Wb=0,pc=gc.length;Wb<pc;Wb++)if(pa=gc[Wb],pa.needsUpdate&&(void 0===pa.boundTo||"vertices"===pa.boundTo)){ra=0;zb=pa.value.length;if(1===pa.size)for(Ha=
|
|
|
|
-0;Ha<zb;Ha++)pa.array[Ha]=pa.value[Ha];else if(2===pa.size)for(Ha=0;Ha<zb;Ha++)Sa=pa.value[Ha],pa.array[ra]=Sa.x,pa.array[ra+1]=Sa.y,ra+=2;else if(3===pa.size)if("c"===pa.type)for(Ha=0;Ha<zb;Ha++)Sa=pa.value[Ha],pa.array[ra]=Sa.r,pa.array[ra+1]=Sa.g,pa.array[ra+2]=Sa.b,ra+=3;else for(Ha=0;Ha<zb;Ha++)Sa=pa.value[Ha],pa.array[ra]=Sa.x,pa.array[ra+1]=Sa.y,pa.array[ra+2]=Sa.z,ra+=3;else if(4===pa.size)for(Ha=0;Ha<zb;Ha++)Sa=pa.value[Ha],pa.array[ra]=Sa.x,pa.array[ra+1]=Sa.y,pa.array[ra+2]=Sa.z,pa.array[ra+
|
|
|
|
-3]=Sa.w,ra+=4;m.bindBuffer(m.ARRAY_BUFFER,pa.buffer);m.bufferData(m.ARRAY_BUFFER,pa.array,Rb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&w(r)}else if(k instanceof THREE.ParticleSystem){r=d(k,l);q=r.attributes&&v(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||q){var mb=l,hc=m.DYNAMIC_DRAW,Ib=k,Ta=void 0,nb=void 0,ob=void 0,X=void 0,pb=void 0,tb=void 0,Xb=mb.vertices,ic=Xb.length,jc=mb.colors,qc=jc.length,wb=mb.__vertexArray,xb=mb.__colorArray,
|
|
|
|
-rb=mb.__sortArray,rc=mb.verticesNeedUpdate,sc=mb.colorsNeedUpdate,sb=mb.__webglCustomAttributesList,fb=void 0,Ab=void 0,aa=void 0,gb=void 0,ja=void 0,U=void 0;if(Ib.sortParticles){hb.copy(Oa);hb.multiply(Ib.matrixWorld);for(Ta=0;Ta<ic;Ta++)ob=Xb[Ta],ya.copy(ob),ya.applyProjection(hb),rb[Ta]=[ya.z,Ta];rb.sort(n);for(Ta=0;Ta<ic;Ta++)ob=Xb[rb[Ta][1]],X=3*Ta,wb[X]=ob.x,wb[X+1]=ob.y,wb[X+2]=ob.z;for(nb=0;nb<qc;nb++)X=3*nb,tb=jc[rb[nb][1]],xb[X]=tb.r,xb[X+1]=tb.g,xb[X+2]=tb.b;if(sb)for(fb=0,Ab=sb.length;fb<
|
|
|
|
-Ab;fb++)if(U=sb[fb],void 0===U.boundTo||"vertices"===U.boundTo)if(X=0,gb=U.value.length,1===U.size)for(aa=0;aa<gb;aa++)pb=rb[aa][1],U.array[aa]=U.value[pb];else if(2===U.size)for(aa=0;aa<gb;aa++)pb=rb[aa][1],ja=U.value[pb],U.array[X]=ja.x,U.array[X+1]=ja.y,X+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)pb=rb[aa][1],ja=U.value[pb],U.array[X]=ja.r,U.array[X+1]=ja.g,U.array[X+2]=ja.b,X+=3;else for(aa=0;aa<gb;aa++)pb=rb[aa][1],ja=U.value[pb],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=
|
|
|
|
-ja.z,X+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)pb=rb[aa][1],ja=U.value[pb],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,U.array[X+3]=ja.w,X+=4}else{if(rc)for(Ta=0;Ta<ic;Ta++)ob=Xb[Ta],X=3*Ta,wb[X]=ob.x,wb[X+1]=ob.y,wb[X+2]=ob.z;if(sc)for(nb=0;nb<qc;nb++)tb=jc[nb],X=3*nb,xb[X]=tb.r,xb[X+1]=tb.g,xb[X+2]=tb.b;if(sb)for(fb=0,Ab=sb.length;fb<Ab;fb++)if(U=sb[fb],U.needsUpdate&&(void 0===U.boundTo||"vertices"===U.boundTo))if(gb=U.value.length,X=0,1===U.size)for(aa=0;aa<gb;aa++)U.array[aa]=U.value[aa];
|
|
|
|
-else if(2===U.size)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,X+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.r,U.array[X+1]=ja.g,U.array[X+2]=ja.b,X+=3;else for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,X+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,U.array[X+3]=ja.w,X+=4}if(rc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),
|
|
|
|
-m.bufferData(m.ARRAY_BUFFER,wb,hc);if(sc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,xb,hc);if(sb)for(fb=0,Ab=sb.length;fb<Ab;fb++)if(U=sb[fb],U.needsUpdate||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,U.buffer),m.bufferData(m.ARRAY_BUFFER,U.array,hc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&w(r)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Mb);var k,l,p,n,r;a instanceof THREE.MeshDepthMaterial?
|
|
|
|
-r="depth":a instanceof THREE.MeshNormalMaterial?r="normal":a instanceof THREE.MeshBasicMaterial?r="basic":a instanceof THREE.MeshLambertMaterial?r="lambert":a instanceof THREE.MeshPhongMaterial?r="phong":a instanceof THREE.LineBasicMaterial?r="basic":a instanceof THREE.LineDashedMaterial?r="dashed":a instanceof THREE.ParticleSystemMaterial&&(r="particle_basic");if(r){var q=THREE.ShaderLib[r];a.uniforms=THREE.UniformsUtils.clone(q.uniforms);a.vertexShader=q.vertexShader;a.fragmentShader=q.fragmentShader}var s=
|
|
|
|
-e=0,t=0,u=q=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||!1===g.visible||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&q++);f=s;g=t;h=q;t=q=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&q++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&q++);n=q;ub&&d&&d.useVertexTexture?p=1024:(b=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&
|
|
|
|
-d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),p=b);a:{t=a.fragmentShader;s=a.vertexShader;q=a.uniforms;b=a.attributes;u=a.defines;c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
|
-skinning:a.skinning,maxBones:p,useVertexTexture:ub&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow&&0<n,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,
|
|
|
|
-doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];r?e.push(r):(e.push(t),e.push(s));for(w in u)e.push(w),e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);r=e.join();v=0;for(w=ca.length;v<w;v++)if(e=ca[v],e.code===r){e.usedTimes++;l=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e=
|
|
|
|
-"#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+Y+" float;","precision "+Y+" int;",e,yb?"#define VERTEX_TEXTURES":"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
|
|
|
|
-"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",
|
|
|
|
-c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
|
|
+[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var N=this,ca=[],sa=0,T=null,Ka=null,S=-1,$=null,Ea=null,ta=0,oa=-1,za=-1,Aa=-1,Wa=-1,Fa=-1,ka=-1,La=-1,la=-1,Ba=null,Ja=null,ma=null,Ca=null,ba=0,wa=0,xa=L.width,Na=L.height,hb=0,Ma=0,Da=new Uint8Array(16),na=new THREE.Frustum,Ra=new THREE.Matrix4,ib=new THREE.Matrix4,ya=new THREE.Vector3,ia=new THREE.Vector3,Qa=!0,ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
|
+colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},m,Ga,Oa,Sa,pa,Pa;(function(){try{var a={alpha:R,premultipliedAlpha:fa,antialias:V,stencil:ga,preserveDrawingBuffer:J};m=Q||L.getContext("webgl",a)||L.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Ga=m.getExtension("OES_texture_float");m.getExtension("OES_texture_float_linear");
|
|
|
|
+Oa=m.getExtension("OES_standard_derivatives");Sa=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");pa=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Pa=m.getExtension("OES_element_index_uint");null===Ga&&console.log("THREE.WebGLRenderer: Float textures not supported.");null===Oa&&
|
|
|
|
+console.log("THREE.WebGLRenderer: Standard derivatives not supported.");null===Sa&&console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");null===pa&&console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");null===Pa&&console.log("THREE.WebGLRenderer: elementindex as unsigned integer not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})})();m.clearColor(0,0,0,1);m.clearDepth(1);
|
|
|
|
+m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(ba,wa,xa,Na);m.clearColor(da.r,da.g,da.b,W);this.context=m;var Xa=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),db=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var Wb=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Hb=Sa?m.getParameter(Sa.MAX_TEXTURE_MAX_ANISOTROPY_EXT):
|
|
|
|
+0,xb=0<db,yb=xb&&Ga;pa&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var Xb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),Yb=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var Zb=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),$b=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
|
+m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var sc=0<Xb.precision&&0<Zb.precision,Bb=0<Yb.precision&&0<$b.precision;"highp"!==Y||sc||(Bb?(Y="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(Y="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"!==
|
|
|
|
+Y||Bb||(Y="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return m};this.supportsVertexTextures=function(){return xb};this.supportsFloatTextures=function(){return Ga};this.supportsStandardDerivatives=function(){return Oa};this.supportsCompressedTextureS3TC=function(){return pa};this.getMaxAnisotropy=function(){return Hb};this.getPrecision=function(){return Y};this.setSize=function(a,b,c){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;
|
|
|
|
+1!==this.devicePixelRatio&&!1!==c&&(L.style.width=a+"px",L.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ba=a*this.devicePixelRatio;wa=b*this.devicePixelRatio;xa=c*this.devicePixelRatio;Na=d*this.devicePixelRatio;m.viewport(ba,wa,xa,Na)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};
|
|
|
|
+this.setClearColor=function(a,b){da.set(a);W=void 0!==b?b:1;m.clearColor(da.r,da.g,da.b,W)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return da};this.getClearAlpha=function(){return W};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=
|
|
|
|
+function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){T=null;S=$=la=La=Aa=-1;Qa=!0;za=oa=-1;this.shadowMapPlugin.update(a,b)};var Ib=function(a){a=
|
|
|
|
+a.target;a.removeEventListener("dispose",Ib);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&m.deleteBuffer(b[c].buffer);N.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);
|
|
|
|
+Lb(c)}else Lb(a)},tb=function(a){a=a.target;a.removeEventListener("dispose",tb);a.image&&a.image.__webglTextureCube?m.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,m.deleteTexture(a.__webglTexture));N.info.memory.textures--},Jb=function(a){a=a.target;a.removeEventListener("dispose",Jb);if(a&&a.__webglTexture)if(m.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
|
+else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);N.info.memory.textures--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);Cb(a)},Lb=function(a){void 0!==a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
|
+m.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&m.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&m.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&m.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&m.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&m.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&m.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[b].buffer);
|
|
|
|
+N.info.memory.geometries--},Cb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=ca.length;a<c;a++)if(d=ca[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ca.length;a<c;a++)d=ca[a],d.program!==b&&e.push(d);ca=e;m.deleteProgram(b);N.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
|
+m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
|
+e,f,g,h,k,l,n,p,q,r,s=3*a.count;for(r=0;r<s;r+=9)q=a.normalArray,d=q[r],e=q[r+1],f=q[r+2],g=q[r+3],k=q[r+4],n=q[r+5],h=q[r+6],l=q[r+7],p=q[r+8],d=(d+g+h)/3,e=(e+k+l)/3,f=(f+n+p)/3,q[r]=d,q[r+1]=e,q[r+2]=f,q[r+3]=d,q[r+4]=e,q[r+5]=f,q[r+6]=d,q[r+7]=e,q[r+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
|
|
+a.uvArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var l,
|
|
|
|
+n,p,q,r=B(a,b,c,d,f);a=r.attributes;b=e.attributes;c=!1;r=16777215*e.id+2*r.id+(d.wireframe?1:0);r!==$&&($=r,c=!0);c&&k();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;1<e.length&&(c=!0);for(var r=0,s=e.length;r<s;r++){var t=e[r].index;if(c){for(n in a)p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,t*q*4)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):
|
|
|
|
+3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)}null!==Pa&&f.array instanceof Uint32Array?(l=m.UNSIGNED_INT,p=4):(l=m.UNSIGNED_SHORT,p=2);m.drawElements(m.TRIANGLES,e[r].count,l,e[r].start*p);N.info.render.calls++;N.info.render.vertices+=e[r].count;N.info.render.faces+=e[r].count/3}}else{if(c)for(n in a)"index"!==n&&(p=a[n],l=b[n],0<=p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,
|
|
|
|
+q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n]))));d=e.attributes.position;m.drawArrays(m.TRIANGLES,0,d.array.length/3);N.info.render.calls++;N.info.render.vertices+=d.array.length/3;N.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(n in a)p=a[n],l=b[n],0<=
|
|
|
|
+p&&(l?(q=l.itemSize,m.bindBuffer(m.ARRAY_BUFFER,l.buffer),h(p),m.vertexAttribPointer(p,q,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));d=b.position;m.drawArrays(m.POINTS,0,d.array.length/3);N.info.render.calls++;N.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(n=f.type===
|
|
|
|
+THREE.LineStrip?m.LINE_STRIP:m.LINES,G(d.linewidth),f=b.index)for(e=e.offsets,1<e.length&&(c=!0),r=0,s=e.length;r<s;r++)t=e[r].index,c&&(g(d,a,b,t),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),null!==Pa&&f.array instanceof Uint32Array?(l=m.UNSIGNED_INT,p=4):(l=m.UNSIGNED_SHORT,p=2),m.drawElements(m.LINES,e[r].count,l,e[r].start*p),N.info.render.calls++,N.info.render.vertices+=e[r].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),N.info.render.calls++,N.info.render.points+=
|
|
|
|
+d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,l;c=B(a,b,c,d,f);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==$&&($=c,a=!0);a&&k();if(!d.morphTargets&&0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(b.position),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
|
+h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var p=0;l=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;p<d.numSupportedMorphTargets&&p<l.length;)0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[p]]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,
|
|
|
|
+!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[p]]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[l[p]],p++}else{l=[];g=f.morphTargetInfluences;var r,q=g.length;for(r=0;r<q;r++)p=g[r],0<p&&l.push([p,r]);l.length>d.numSupportedMorphTargets?(l.sort(n),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(n):0===l.length&&l.push([0,0]);for(p=0;p<
|
|
|
|
+d.numSupportedMorphTargets;)l[p]?(r=l[p][1],0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[r]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[r]):f.__webglMorphTargetInfluences[p]=0,p++}null!==d.program.uniforms.morphTargetInfluences&&
|
|
|
|
+m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,l=e.__webglCustomAttributesList.length;g<l;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,c.buffer),h(b[c.buffer.belongsToAttribute]),m.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,m.FLOAT,!1,0,0));0<=b.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),
|
|
|
|
+h(b.color),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),h(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),h(b.tangent),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));0<=b.uv&&(f.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),h(b.uv),m.vertexAttribPointer(b.uv,
|
|
|
|
+2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(f.geometry.faceVertexUvs[1]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),h(b.uv2),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(b.skinIndex),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
|
+e.__webglSkinWeightsBuffer),h(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(f=null!==Pa&&e.__typeArray instanceof Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(G(d.wireframeLinewidth),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,f,0)):
|
|
|
|
+(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,f,0)),N.info.render.calls++,N.info.render.vertices+=e.__webglFaceCount,N.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,G(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),N.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),N.info.render.calls++,N.info.render.points+=e.__webglParticleCount)}};
|
|
|
|
+this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,k=a.__lights,p=a.fog;S=-1;Qa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ra.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(Ra);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);N.info.render.calls=
|
|
|
|
+0;N.info.render.vertices=0;N.info.render.faces=0;N.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||na.intersectsObject(g))){var n=g;n._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,n.matrixWorld);n._normalMatrix.getNormalMatrix(n._modelViewMatrix);
|
|
|
|
+var n=f,t=n.object,u=n.buffer,v=t.geometry,t=t.material;t instanceof THREE.MeshFaceMaterial?(t=t.materials[v instanceof THREE.BufferGeometry?0:u.materialIndex],t.transparent?(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=null)):t&&(t.transparent?(n.transparent=t,n.opaque=null):(n.opaque=t,n.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ya.setFromMatrixPosition(g.matrixWorld),ya.applyProjection(Ra),f.z=ya.z))}this.sortObjects&&h.sort(l);h=
|
|
|
|
+a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
|
+d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,k,p,!0,d),q(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,k,p,!1,d),q(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),r(a.__webglObjects,!1,"transparent",b,k,p,!0,d),q(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));s(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?
|
|
|
|
+(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=B(a,b,c,d,e);$=-1;N.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,na):e.render(function(a){N.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=
|
|
|
|
+function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)u(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)t(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&t(h,a),u(h,a));var k=h,l=k.geometry,p=void 0,r=void 0,q=void 0;if(l instanceof
|
|
|
|
+THREE.BufferGeometry){var s=m.DYNAMIC_DRAW,x=l.attributes,z=void 0,y=void 0;for(z in x)y=x[z],y.needsUpdate&&("index"===z?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,y.array,s)):(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,s)),y.needsUpdate=!1)}else if(k instanceof THREE.Mesh){for(var B=0,I=l.geometryGroupsList.length;B<I;B++)if(p=l.geometryGroupsList[B],q=d(k,p),l.buffersNeedUpdate&&c(p,k),r=q.attributes&&v(q),l.verticesNeedUpdate||
|
|
|
|
+l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||r){var A=p,D=k,C=m.DYNAMIC_DRAW,F=!l.dynamic,G=q;if(A.__inittedArrays){var H=e(G),O=G.vertexColors?G.vertexColors:!1,L=f(G),N=H===THREE.SmoothShading,E=void 0,J=void 0,Q=void 0,K=void 0,ca=void 0,R=void 0,Y=void 0,W=void 0,V=void 0,$=void 0,sa=void 0,S=void 0,T=void 0,Z=void 0,oa=void 0,ta=void 0,Ea=void 0,da=void 0,Ka=void 0,fa=void 0,ga=void 0,ha=void 0,za=void 0,ka=void 0,
|
|
|
|
+ia=void 0,la=void 0,na=void 0,pa=void 0,Aa=void 0,ba=void 0,Da=void 0,Ca=void 0,La=void 0,Ja=void 0,ma=void 0,Ma=void 0,wa=void 0,xa=void 0,Pa=void 0,Wa=void 0,Fa=0,Ba=0,Na=0,Qa=0,Sa=0,Ga=0,Za=0,Oa=0,eb=0,va=0,Ha=0,P=0,Ya=void 0,jb=A.__vertexArray,db=A.__uvArray,hb=A.__uv2Array,Xa=A.__normalArray,$a=A.__tangentArray,kb=A.__colorArray,ab=A.__skinIndexArray,bb=A.__skinWeightArray,xb=A.__morphTargetsArrays,yb=A.__morphNormalsArrays,tb=A.__webglCustomAttributesList,M=void 0,Mb=A.__faceArray,ub=A.__lineArray,
|
|
|
|
+Ta=D.geometry,Hb=Ta.elementsNeedUpdate,Bb=Ta.uvsNeedUpdate,Ib=Ta.normalsNeedUpdate,Jb=Ta.tangentsNeedUpdate,Kb=Ta.colorsNeedUpdate,Lb=Ta.morphTargetsNeedUpdate,cc=Ta.vertices,ea=A.faces3,lb=Ta.faces,Cb=Ta.faceVertexUvs[0],ic=Ta.faceVertexUvs[1],dc=Ta.skinIndices,Nb=Ta.skinWeights,Ob=Ta.morphTargets,jc=Ta.morphNormals;if(Ta.verticesNeedUpdate){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],S=cc[K.a],T=cc[K.b],Z=cc[K.c],jb[Ba]=S.x,jb[Ba+1]=S.y,jb[Ba+2]=S.z,jb[Ba+3]=T.x,jb[Ba+4]=T.y,jb[Ba+5]=T.z,jb[Ba+6]=Z.x,
|
|
|
|
+jb[Ba+7]=Z.y,jb[Ba+8]=Z.z,Ba+=9;m.bindBuffer(m.ARRAY_BUFFER,A.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,jb,C)}if(Lb)for(ma=0,Ma=Ob.length;ma<Ma;ma++){E=Ha=0;for(J=ea.length;E<J;E++)Pa=ea[E],K=lb[Pa],S=Ob[ma].vertices[K.a],T=Ob[ma].vertices[K.b],Z=Ob[ma].vertices[K.c],wa=xb[ma],wa[Ha]=S.x,wa[Ha+1]=S.y,wa[Ha+2]=S.z,wa[Ha+3]=T.x,wa[Ha+4]=T.y,wa[Ha+5]=T.z,wa[Ha+6]=Z.x,wa[Ha+7]=Z.y,wa[Ha+8]=Z.z,G.morphNormals&&(N?(Wa=jc[ma].vertexNormals[Pa],da=Wa.a,Ka=Wa.b,fa=Wa.c):fa=Ka=da=jc[ma].faceNormals[Pa],
|
|
|
|
+xa=yb[ma],xa[Ha]=da.x,xa[Ha+1]=da.y,xa[Ha+2]=da.z,xa[Ha+3]=Ka.x,xa[Ha+4]=Ka.y,xa[Ha+5]=Ka.z,xa[Ha+6]=fa.x,xa[Ha+7]=fa.y,xa[Ha+8]=fa.z),Ha+=9;m.bindBuffer(m.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[ma]);m.bufferData(m.ARRAY_BUFFER,xb[ma],C);G.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglMorphNormalsBuffers[ma]),m.bufferData(m.ARRAY_BUFFER,yb[ma],C))}if(Nb.length){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],ka=Nb[K.a],ia=Nb[K.b],la=Nb[K.c],bb[va]=ka.x,bb[va+1]=ka.y,bb[va+2]=ka.z,bb[va+3]=ka.w,bb[va+
|
|
|
|
+4]=ia.x,bb[va+5]=ia.y,bb[va+6]=ia.z,bb[va+7]=ia.w,bb[va+8]=la.x,bb[va+9]=la.y,bb[va+10]=la.z,bb[va+11]=la.w,na=dc[K.a],pa=dc[K.b],Aa=dc[K.c],ab[va]=na.x,ab[va+1]=na.y,ab[va+2]=na.z,ab[va+3]=na.w,ab[va+4]=pa.x,ab[va+5]=pa.y,ab[va+6]=pa.z,ab[va+7]=pa.w,ab[va+8]=Aa.x,ab[va+9]=Aa.y,ab[va+10]=Aa.z,ab[va+11]=Aa.w,va+=12;0<va&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ab,C),m.bindBuffer(m.ARRAY_BUFFER,A.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,bb,C))}if(Kb&&
|
|
|
|
+O){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],Y=K.vertexColors,W=K.color,3===Y.length&&O===THREE.VertexColors?(ga=Y[0],ha=Y[1],za=Y[2]):za=ha=ga=W,kb[eb]=ga.r,kb[eb+1]=ga.g,kb[eb+2]=ga.b,kb[eb+3]=ha.r,kb[eb+4]=ha.g,kb[eb+5]=ha.b,kb[eb+6]=za.r,kb[eb+7]=za.g,kb[eb+8]=za.b,eb+=9;0<eb&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,kb,C))}if(Jb&&Ta.hasTangents){E=0;for(J=ea.length;E<J;E++)K=lb[ea[E]],V=K.vertexTangents,oa=V[0],ta=V[1],Ea=V[2],$a[Za]=oa.x,$a[Za+1]=oa.y,$a[Za+
|
|
|
|
+2]=oa.z,$a[Za+3]=oa.w,$a[Za+4]=ta.x,$a[Za+5]=ta.y,$a[Za+6]=ta.z,$a[Za+7]=ta.w,$a[Za+8]=Ea.x,$a[Za+9]=Ea.y,$a[Za+10]=Ea.z,$a[Za+11]=Ea.w,Za+=12;m.bindBuffer(m.ARRAY_BUFFER,A.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,$a,C)}if(Ib&&H){E=0;for(J=ea.length;E<J;E++)if(K=lb[ea[E]],ca=K.vertexNormals,R=K.normal,3===ca.length&&N)for(ba=0;3>ba;ba++)Ca=ca[ba],Xa[Ga]=Ca.x,Xa[Ga+1]=Ca.y,Xa[Ga+2]=Ca.z,Ga+=3;else for(ba=0;3>ba;ba++)Xa[Ga]=R.x,Xa[Ga+1]=R.y,Xa[Ga+2]=R.z,Ga+=3;m.bindBuffer(m.ARRAY_BUFFER,A.__webglNormalBuffer);
|
|
|
|
+m.bufferData(m.ARRAY_BUFFER,Xa,C)}if(Bb&&Cb&&L){E=0;for(J=ea.length;E<J;E++)if(Q=ea[E],$=Cb[Q],void 0!==$)for(ba=0;3>ba;ba++)La=$[ba],db[Na]=La.x,db[Na+1]=La.y,Na+=2;0<Na&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,db,C))}if(Bb&&ic&&L){E=0;for(J=ea.length;E<J;E++)if(Q=ea[E],sa=ic[Q],void 0!==sa)for(ba=0;3>ba;ba++)Ja=sa[ba],hb[Qa]=Ja.x,hb[Qa+1]=Ja.y,Qa+=2;0<Qa&&(m.bindBuffer(m.ARRAY_BUFFER,A.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,hb,C))}if(Hb){E=0;for(J=ea.length;E<
|
|
|
|
+J;E++)Mb[Sa]=Fa,Mb[Sa+1]=Fa+1,Mb[Sa+2]=Fa+2,Sa+=3,ub[Oa]=Fa,ub[Oa+1]=Fa+1,ub[Oa+2]=Fa,ub[Oa+3]=Fa+2,ub[Oa+4]=Fa+1,ub[Oa+5]=Fa+2,Oa+=6,Fa+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Mb,C);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,ub,C)}if(tb)for(ba=0,Da=tb.length;ba<Da;ba++)if(M=tb[ba],M.__original.needsUpdate){P=0;if(1===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<
|
|
|
|
+J;E++)K=lb[ea[E]],M.array[P]=M.value[K.a],M.array[P+1]=M.value[K.b],M.array[P+2]=M.value[K.c],P+=3;else{if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Ya=M.value[ea[E]],M.array[P]=Ya,M.array[P+1]=Ya,M.array[P+2]=Ya,P+=3}else if(2===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=T.x,M.array[P+3]=T.y,M.array[P+4]=Z.x,M.array[P+5]=Z.y,P+=6;else{if("faces"===M.boundTo)for(E=
|
|
|
|
+0,J=ea.length;E<J;E++)Z=T=S=Ya=M.value[ea[E]],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=T.x,M.array[P+3]=T.y,M.array[P+4]=Z.x,M.array[P+5]=Z.y,P+=6}else if(3===M.size){var ua;ua="c"===M.type?["r","g","b"]:["x","y","z"];if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],
|
|
|
|
+M.array[P+7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9;else if("faces"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Z=T=S=Ya=M.value[ea[E]],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],M.array[P+7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9;else if("faceVertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Ya=M.value[ea[E]],S=Ya[0],T=Ya[1],Z=Ya[2],M.array[P]=S[ua[0]],M.array[P+1]=S[ua[1]],M.array[P+2]=S[ua[2]],M.array[P+
|
|
|
|
+3]=T[ua[0]],M.array[P+4]=T[ua[1]],M.array[P+5]=T[ua[2]],M.array[P+6]=Z[ua[0]],M.array[P+7]=Z[ua[1]],M.array[P+8]=Z[ua[2]],P+=9}else if(4===M.size)if(void 0===M.boundTo||"vertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)K=lb[ea[E]],S=M.value[K.a],T=M.value[K.b],Z=M.value[K.c],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;else if("faces"===
|
|
|
|
+M.boundTo)for(E=0,J=ea.length;E<J;E++)Z=T=S=Ya=M.value[ea[E]],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;else if("faceVertices"===M.boundTo)for(E=0,J=ea.length;E<J;E++)Ya=M.value[ea[E]],S=Ya[0],T=Ya[1],Z=Ya[2],M.array[P]=S.x,M.array[P+1]=S.y,M.array[P+2]=S.z,M.array[P+3]=S.w,M.array[P+4]=T.x,M.array[P+5]=T.y,M.array[P+6]=T.z,M.array[P+
|
|
|
|
+7]=T.w,M.array[P+8]=Z.x,M.array[P+9]=Z.y,M.array[P+10]=Z.z,M.array[P+11]=Z.w,P+=12;m.bindBuffer(m.ARRAY_BUFFER,M.buffer);m.bufferData(m.ARRAY_BUFFER,M.array,C)}F&&(delete A.__inittedArrays,delete A.__colorArray,delete A.__normalArray,delete A.__tangentArray,delete A.__uvArray,delete A.__uv2Array,delete A.__faceArray,delete A.__vertexArray,delete A.__lineArray,delete A.__skinIndexArray,delete A.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=
|
|
|
|
+!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;q.attributes&&w(q)}else if(k instanceof THREE.Line){q=d(k,l);r=q.attributes&&v(q);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||r){var cb=l,Pb=m.DYNAMIC_DRAW,Db=void 0,Eb=void 0,Fb=void 0,Qb=void 0,ra=void 0,Rb=void 0,kc=cb.vertices,lc=cb.colors,mc=cb.lineDistances,Wb=kc.length,Xb=lc.length,Yb=mc.length,Sb=cb.__vertexArray,Tb=cb.__colorArray,nc=cb.__lineDistanceArray,Zb=cb.colorsNeedUpdate,
|
|
|
|
+$b=cb.lineDistancesNeedUpdate,ec=cb.__webglCustomAttributesList,Ub=void 0,oc=void 0,Ia=void 0,zb=void 0,Ua=void 0,qa=void 0;if(cb.verticesNeedUpdate){for(Db=0;Db<Wb;Db++)Qb=kc[Db],ra=3*Db,Sb[ra]=Qb.x,Sb[ra+1]=Qb.y,Sb[ra+2]=Qb.z;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Sb,Pb)}if(Zb){for(Eb=0;Eb<Xb;Eb++)Rb=lc[Eb],ra=3*Eb,Tb[ra]=Rb.r,Tb[ra+1]=Rb.g,Tb[ra+2]=Rb.b;m.bindBuffer(m.ARRAY_BUFFER,cb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Tb,Pb)}if($b){for(Fb=0;Fb<
|
|
|
|
+Yb;Fb++)nc[Fb]=mc[Fb];m.bindBuffer(m.ARRAY_BUFFER,cb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,nc,Pb)}if(ec)for(Ub=0,oc=ec.length;Ub<oc;Ub++)if(qa=ec[Ub],qa.needsUpdate&&(void 0===qa.boundTo||"vertices"===qa.boundTo)){ra=0;zb=qa.value.length;if(1===qa.size)for(Ia=0;Ia<zb;Ia++)qa.array[Ia]=qa.value[Ia];else if(2===qa.size)for(Ia=0;Ia<zb;Ia++)Ua=qa.value[Ia],qa.array[ra]=Ua.x,qa.array[ra+1]=Ua.y,ra+=2;else if(3===qa.size)if("c"===qa.type)for(Ia=0;Ia<zb;Ia++)Ua=qa.value[Ia],qa.array[ra]=
|
|
|
|
+Ua.r,qa.array[ra+1]=Ua.g,qa.array[ra+2]=Ua.b,ra+=3;else for(Ia=0;Ia<zb;Ia++)Ua=qa.value[Ia],qa.array[ra]=Ua.x,qa.array[ra+1]=Ua.y,qa.array[ra+2]=Ua.z,ra+=3;else if(4===qa.size)for(Ia=0;Ia<zb;Ia++)Ua=qa.value[Ia],qa.array[ra]=Ua.x,qa.array[ra+1]=Ua.y,qa.array[ra+2]=Ua.z,qa.array[ra+3]=Ua.w,ra+=4;m.bindBuffer(m.ARRAY_BUFFER,qa.buffer);m.bufferData(m.ARRAY_BUFFER,qa.array,Pb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;q.attributes&&w(q)}else if(k instanceof THREE.ParticleSystem){q=
|
|
|
|
+d(k,l);r=q.attributes&&v(q);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||r){var mb=l,fc=m.DYNAMIC_DRAW,Gb=k,Va=void 0,nb=void 0,ob=void 0,X=void 0,pb=void 0,sb=void 0,Vb=mb.vertices,gc=Vb.length,hc=mb.colors,pc=hc.length,vb=mb.__vertexArray,wb=mb.__colorArray,qb=mb.__sortArray,qc=mb.verticesNeedUpdate,rc=mb.colorsNeedUpdate,rb=mb.__webglCustomAttributesList,fb=void 0,Ab=void 0,aa=void 0,gb=void 0,ja=void 0,U=void 0;if(Gb.sortParticles){ib.copy(Ra);ib.multiply(Gb.matrixWorld);for(Va=
|
|
|
|
+0;Va<gc;Va++)ob=Vb[Va],ya.copy(ob),ya.applyProjection(ib),qb[Va]=[ya.z,Va];qb.sort(n);for(Va=0;Va<gc;Va++)ob=Vb[qb[Va][1]],X=3*Va,vb[X]=ob.x,vb[X+1]=ob.y,vb[X+2]=ob.z;for(nb=0;nb<pc;nb++)X=3*nb,sb=hc[qb[nb][1]],wb[X]=sb.r,wb[X+1]=sb.g,wb[X+2]=sb.b;if(rb)for(fb=0,Ab=rb.length;fb<Ab;fb++)if(U=rb[fb],void 0===U.boundTo||"vertices"===U.boundTo)if(X=0,gb=U.value.length,1===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],U.array[aa]=U.value[pb];else if(2===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ja=U.value[pb],
|
|
|
|
+U.array[X]=ja.x,U.array[X+1]=ja.y,X+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ja=U.value[pb],U.array[X]=ja.r,U.array[X+1]=ja.g,U.array[X+2]=ja.b,X+=3;else for(aa=0;aa<gb;aa++)pb=qb[aa][1],ja=U.value[pb],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,X+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)pb=qb[aa][1],ja=U.value[pb],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,U.array[X+3]=ja.w,X+=4}else{if(qc)for(Va=0;Va<gc;Va++)ob=Vb[Va],X=3*Va,vb[X]=ob.x,vb[X+1]=ob.y,
|
|
|
|
+vb[X+2]=ob.z;if(rc)for(nb=0;nb<pc;nb++)sb=hc[nb],X=3*nb,wb[X]=sb.r,wb[X+1]=sb.g,wb[X+2]=sb.b;if(rb)for(fb=0,Ab=rb.length;fb<Ab;fb++)if(U=rb[fb],U.needsUpdate&&(void 0===U.boundTo||"vertices"===U.boundTo))if(gb=U.value.length,X=0,1===U.size)for(aa=0;aa<gb;aa++)U.array[aa]=U.value[aa];else if(2===U.size)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,X+=2;else if(3===U.size)if("c"===U.type)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.r,U.array[X+1]=ja.g,U.array[X+2]=ja.b,X+=
|
|
|
|
+3;else for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,X+=3;else if(4===U.size)for(aa=0;aa<gb;aa++)ja=U.value[aa],U.array[X]=ja.x,U.array[X+1]=ja.y,U.array[X+2]=ja.z,U.array[X+3]=ja.w,X+=4}if(qc||Gb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,vb,fc);if(rc||Gb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,wb,fc);if(rb)for(fb=0,Ab=rb.length;fb<Ab;fb++)if(U=rb[fb],U.needsUpdate||
|
|
|
|
+Gb.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,U.buffer),m.bufferData(m.ARRAY_BUFFER,U.array,fc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;q.attributes&&w(q)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Kb);var k,l,p,n,r;a instanceof THREE.MeshDepthMaterial?r="depth":a instanceof THREE.MeshNormalMaterial?r="normal":a instanceof THREE.MeshBasicMaterial?r="basic":a instanceof THREE.MeshLambertMaterial?r="lambert":a instanceof THREE.MeshPhongMaterial?r="phong":a instanceof
|
|
|
|
+THREE.LineBasicMaterial?r="basic":a instanceof THREE.LineDashedMaterial?r="dashed":a instanceof THREE.ParticleSystemMaterial&&(r="particle_basic");if(r){var q=THREE.ShaderLib[r];a.uniforms=THREE.UniformsUtils.clone(q.uniforms);a.vertexShader=q.vertexShader;a.fragmentShader=q.fragmentShader}var s=e=0,t=0,u=q=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||!1===g.visible||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&
|
|
|
|
+q++);f=s;g=t;h=q;t=q=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&q++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&q++);n=q;yb&&d&&d.useVertexTexture?p=1024:(b=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),p=b);a:{t=a.fragmentShader;
|
|
|
|
+s=a.vertexShader;q=a.uniforms;b=a.attributes;u=a.defines;c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,
|
|
|
|
+maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow&&0<n,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];r?e.push(r):(e.push(t),e.push(s));for(w in u)e.push(w),e.push(u[w]);for(v in c)e.push(v),
|
|
|
|
+e.push(c[v]);r=e.join();v=0;for(w=ca.length;v<w;v++)if(e=ca[v],e.code===r){e.usedTimes++;l=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+Y+" float;","precision "+Y+" int;",e,xb?"#define VERTEX_TEXTURES":"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?
|
|
|
|
+"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":
|
|
|
|
+"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
|
+"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
v=["precision "+Y+" float;","precision "+Y+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&
|
|
v=["precision "+Y+" float;","precision "+Y+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&
|
|
c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:
|
|
c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:
|
|
"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=K("vertex",w+s);v=K("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d&&m.bindAttribLocation(x,0,d);m.linkProgram(x);!1===m.getProgramParameter(x,m.LINK_STATUS)&&(console.error("Could not initialise shader"),console.error("gl.VALIDATE_STATUS",m.getProgramParameter(x,m.VALIDATE_STATUS)),console.error("gl.getError()",
|
|
"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=K("vertex",w+s);v=K("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d&&m.bindAttribLocation(x,0,d);m.linkProgram(x);!1===m.getProgramParameter(x,m.LINK_STATUS)&&(console.error("Could not initialise shader"),console.error("gl.VALIDATE_STATUS",m.getProgramParameter(x,m.VALIDATE_STATUS)),console.error("gl.getError()",
|
|
m.getError()));""!==m.getProgramInfoLog(x)&&console.error("gl.getProgramInfoLog()",m.getProgramInfoLog(x));m.deleteShader(v);m.deleteShader(w);x.uniforms={};x.attributes={};var z;v="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(v.push("boneTexture"),v.push("boneTextureWidth"),v.push("boneTextureHeight")):v.push("boneGlobalMatrices");for(z in q)v.push(z);z=v;v=0;for(w=z.length;v<w;v++)q=z[v],x.uniforms[q]=m.getUniformLocation(x,
|
|
m.getError()));""!==m.getProgramInfoLog(x)&&console.error("gl.getProgramInfoLog()",m.getProgramInfoLog(x));m.deleteShader(v);m.deleteShader(w);x.uniforms={};x.attributes={};var z;v="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(v.push("boneTexture"),v.push("boneTextureWidth"),v.push("boneTextureHeight")):v.push("boneGlobalMatrices");for(z in q)v.push(z);z=v;v=0;for(w=z.length;v<w;v++)q=z[v],x.uniforms[q]=m.getUniformLocation(x,
|
|
q);v="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(z=0;z<c.maxMorphTargets;z++)v.push("morphTarget"+z);for(z=0;z<c.maxMorphNormals;z++)v.push("morphNormal"+z);for(l in b)v.push(l);l=v;z=0;for(b=l.length;z<b;z++)v=l[z],x.attributes[v]=m.getAttribLocation(x,v);x.id=sa++;ca.push({program:x,code:r,usedTimes:1});N.info.memory.programs=ca.length;l=x}a.program=l;z=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",l=0;l<this.maxMorphTargets;l++)x=
|
|
q);v="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(z=0;z<c.maxMorphTargets;z++)v.push("morphTarget"+z);for(z=0;z<c.maxMorphNormals;z++)v.push("morphNormal"+z);for(l in b)v.push(l);l=v;z=0;for(b=l.length;z<b;z++)v=l[z],x.attributes[v]=m.getAttribLocation(x,v);x.id=sa++;ca.push({program:x,code:r,usedTimes:1});N.info.memory.programs=ca.length;l=x}a.program=l;z=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",l=0;l<this.maxMorphTargets;l++)x=
|
|
b+l,0<=z[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=0,b="morphNormal",l=0;l<this.maxMorphNormals;l++)x=b+l,0<=z[x]&&a.numSupportedMorphNormals++;a.uniformsList=[];for(k in a.uniforms)a.uniformsList.push([a.uniforms[k],k])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a===THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),
|
|
b+l,0<=z[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=0,b="morphNormal",l=0;l<this.maxMorphNormals;l++)x=b+l,0<=z[x]&&a.numSupportedMorphNormals++;a.uniformsList=[];for(k in a.uniforms)a.uniformsList.push([a.uniforms[k],k])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a===THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),
|
|
-m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;oa!==b&&(b?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),oa=b);za!==a&&(a?m.frontFace(m.CW):m.frontFace(m.CCW),za=a)};this.setDepthTest=function(a){Ka!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),Ka=a)};this.setDepthWrite=function(a){la!==a&&(m.depthMask(a),la=a)};this.setBlending=function(a,b,c,d){a!==Aa&&(a===THREE.NoBlending?m.disable(m.BLEND):a===THREE.AdditiveBlending?
|
|
|
|
|
|
+m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide;a=a.side===THREE.BackSide;oa!==b&&(b?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),oa=b);za!==a&&(a?m.frontFace(m.CW):m.frontFace(m.CCW),za=a)};this.setDepthTest=function(a){La!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),La=a)};this.setDepthWrite=function(a){la!==a&&(m.depthMask(a),la=a)};this.setBlending=function(a,b,c,d){a!==Aa&&(a===THREE.NoBlending?m.disable(m.BLEND):a===THREE.AdditiveBlending?
|
|
(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.SRC_ALPHA,m.ONE)):a===THREE.SubtractiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.SRC_COLOR)):a===THREE.CustomBlending?m.enable(m.BLEND):(m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)),Aa=
|
|
(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.SRC_ALPHA,m.ONE)):a===THREE.SubtractiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.SRC_COLOR)):a===THREE.CustomBlending?m.enable(m.BLEND):(m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)),Aa=
|
|
-a);if(a===THREE.CustomBlending){if(b!==Ua&&(m.blendEquation(A(b)),Ua=b),c!==Va||d!==ka)m.blendFunc(A(c),A(d)),Va=c,ka=d}else ka=Va=Ua=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Cb),a.__webglTexture=m.createTexture(),N.info.memory.textures++);m.activeTexture(m.TEXTURE0+b);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);
|
|
|
|
|
|
+a);if(a===THREE.CustomBlending){if(b!==Wa&&(m.blendEquation(A(b)),Wa=b),c!==Fa||d!==ka)m.blendFunc(A(c),A(d)),Fa=c,ka=d}else ka=Fa=Wa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",tb),a.__webglTexture=m.createTexture(),N.info.memory.textures++);m.activeTexture(m.TEXTURE0+b);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);
|
|
m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=THREE.Math.isPowerOfTwo(c.width)&&THREE.Math.isPowerOfTwo(c.height),e=A(a.format),f=A(a.type);y(m.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture)for(h=0,k=g.length;h<
|
|
m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=THREE.Math.isPowerOfTwo(c.width)&&THREE.Math.isPowerOfTwo(c.height),e=A(a.format),f=A(a.type);y(m.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture)for(h=0,k=g.length;h<
|
|
k;h++)c=g[h],a.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,c.data):m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);else if(0<g.length&&d){h=0;for(k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else m.activeTexture(m.TEXTURE0+b),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)};
|
|
k;h++)c=g[h],a.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,c.data):m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);else if(0<g.length&&d){h=0;for(k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else m.activeTexture(m.TEXTURE0+b),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)};
|
|
-this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Lb);a.__webglTexture=m.createTexture();N.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);y(m.TEXTURE_CUBE_MAP,
|
|
|
|
|
|
+this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Jb);a.__webglTexture=m.createTexture();N.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);y(m.TEXTURE_CUBE_MAP,
|
|
a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);F(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=
|
|
a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);F(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=
|
|
a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),y(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&
|
|
a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),y(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&
|
|
-a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):F(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=Da,d=ba,e=wa);b!==Ja&&(m.bindFramebuffer(m.FRAMEBUFFER,b),
|
|
|
|
-m.viewport(d,e,c,a),Ja=b);Wa=c;La=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
|
|
|
+a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):F(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=Na,d=ba,e=wa);b!==Ka&&(m.bindFramebuffer(m.FRAMEBUFFER,b),
|
|
|
|
+m.viewport(d,e,c,a),Ka=b);hb=c;Ma=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;
|
|
return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.position=new THREE.Vector3;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.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var s=k.length;b<s;b++){var r=k[b].clone();d&&r.applyMatrix4(d);h.push(r)}b=0;for(s=n.length;b<s;b++){var r=n[b],q,u,p=r.vertexNormals,v=r.vertexColors;q=new THREE.Face3(r.a+
|
|
return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.position=new THREE.Vector3;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.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var s=k.length;b<s;b++){var r=k[b].clone();d&&r.applyMatrix4(d);h.push(r)}b=0;for(s=n.length;b<s;b++){var r=n[b],q,u,p=r.vertexNormals,v=r.vertexColors;q=new THREE.Face3(r.a+
|