|
@@ -182,20 +182,20 @@ x=B.length;r<x;r+=2)I.pushLine(B[r],B[r+1]);else for(r=0,x=A.length/3-1;r<x;r++)
|
|
|
w=c(),w.id=q.id,w.v1.positionScreen.copy(O),w.v2.positionScreen.copy(S),w.z=Math.max(O.z,S.z),w.material=q.material,q.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(q.geometry.colors[ia]),w.vertexColors[1].copy(q.geometry.colors[ia-1])),K.elements.push(w)))}else q instanceof THREE.Sprite&&(N.set(R.elements[12],R.elements[13],R.elements[14],1),N.applyMatrix4(Y),r=1/N.w,N.z*=r,-1<=N.z&&1>=N.z&&(P===C?(x=new THREE.RenderableSprite,F.push(x),C++,P++,G=x):G=F[P++],G.id=q.id,G.x=N.x*
|
|
|
r,G.y=N.y*r,G.z=N.z,G.object=q,G.rotation=q.rotation,G.scale.x=q.scale.x*Math.abs(G.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),G.scale.y=q.scale.y*Math.abs(G.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),G.material=q.material,K.elements.push(G)));!0===l&&K.elements.sort(d);return K}};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};
|
|
|
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.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();return a}};THREE.Face4=function(a,b,c,d,e,f,g){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.offsets=[];this.boundingSphere=this.boundingBox=null};
|
|
|
-THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){4===arguments.length?(console.warn("DEPRECATED: BufferGeometry.addAttribute() now accepts only 3 arguments ( name, array, itemSize )"),this.attributes[arguments[0]]={array:new arguments[1](arguments[2]*arguments[3]),itemSize:arguments[3]}):this.attributes[a]={array:b,itemSize:c}},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.offsets.push({start:a,count:b,index:void 0!==
|
|
|
-c?c:0})},applyMatrix:function(a){var b=this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var c=3,d=a.length;c<
|
|
|
-d;c+=3){var e=a[c],f=a[c+1],g=a[c+2];e<b.min.x?b.min.x=e:e>b.max.x&&(b.max.x=e);f<b.min.y?b.min.y=f:f>b.max.y&&(b.max.y=f);g<b.min.z?b.min.z=g:g>b.max.z&&(b.max.z=g)}}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,
|
|
|
-e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;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,p,r=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3,q=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],p=e[3*g+2],r.set(l,n,p),l=e[3*h],n=e[3*h+1],p=e[3*h+2],s.set(l,n,p),l=e[3*k],n=e[3*k+1],p=e[3*k+2],u.set(l,
|
|
|
-n,p),q.subVectors(u,s),v.subVectors(r,s),q.cross(v),f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*k]+=q.x,f[3*k+1]+=q.y,f[3*k+2]+=q.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],p=e[a+2],r.set(l,n,p),l=e[a+3],n=e[a+4],p=e[a+5],s.set(l,n,p),l=e[a+6],n=e[a+7],p=e[a+8],u.set(l,n,p),q.subVectors(u,s),v.subVectors(r,s),q.cross(v),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.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){p=d[3*a];r=d[3*a+1];s=d[3*a+2];u=d[3*b];q=d[3*b+1];v=d[3*b+2];w=d[3*c];t=d[3*c+1];x=d[3*c+2];H=f[2*a];G=f[2*a+1];P=f[2*b];F=f[2*b+1];C=f[2*c];K=f[2*c+1];z=u-p;D=w-p;J=q-r;B=t-r;N=v-s;y=x-s;M=P-H;A=C-H;E=F-G;Y=K-G;R=1/(M*Y-A*E);ka.set((Y*z-E*D)*R,(Y*J-E*B)*R,(Y*N-E*y)*R);da.set((M*
|
|
|
-D-A*z)*R,(M*B-A*J)*R,(M*y-A*N)*R);k[a].add(ka);k[b].add(ka);k[c].add(ka);l[a].add(da);l[b].add(da);l[c].add(da)}function b(a){aa.x=e[3*a];aa.y=e[3*a+1];aa.z=e[3*a+2];Ga.copy(aa);Ca=k[a];T.copy(Ca);T.sub(aa.multiplyScalar(aa.dot(Ca))).normalize();xa.crossVectors(Ga,Ca);Ha=xa.dot(l[a]);Ja=0>Ha?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=Ja}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 p,r,s,u,q,v,w,t,x,H,G,P,F,C,K,z,D,J,B,N,y,M,A,E,Y,R,ka=new THREE.Vector3,da=new THREE.Vector3,X,O,S,fa,I,ha=this.offsets,n=0;for(O=ha.length;n<O;++n){X=
|
|
|
-ha[n].start;S=ha[n].count;var ta=ha[n].index,g=X;for(X+=S;g<X;g+=3)S=ta+c[g],fa=ta+c[g+1],I=ta+c[g+2],a(S,fa,I)}var T=new THREE.Vector3,xa=new THREE.Vector3,aa=new THREE.Vector3,Ga=new THREE.Vector3,Ja,Ca,Ha,n=0;for(O=ha.length;n<O;++n)for(X=ha[n].start,S=ha[n].count,ta=ha[n].index,g=X,X+=S;g<X;g+=3)S=ta+c[g],fa=ta+c[g+1],I=ta+c[g+2],b(S),b(fa),b(I)}},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,p=new Int32Array(6),r=new Int32Array(c.length),s=new Int32Array(c.length),u=0;u<c.length;u++)r[u]=-1,s[u]=-1;for(c=0;c<d;c++){for(var q=n=0;3>q;q++)u=a[3*c+q],-1==r[u]?(p[2*q]=u,p[2*q+1]=-1,n++):r[u]<k.index?(p[2*q]=u,p[2*q+1]=-1,l++):(p[2*q]=u,p[2*q+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)q=p[n+1],-1<q&&q<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)u=p[n],q=p[n+1],-1===q&&(q=g++),
|
|
|
-r[u]=q,s[q]=u,e[f++]=q-k.index,k.count++}this.reorderBuffers(e,s,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*c)},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,array:null},d=0,g=b.length;d<
|
|
|
-g;d++){var h=b[d];if(e instanceof h){f.array=new h(e);break}}a.attributes[c]=f}d=0;for(g=this.offsets.length;d<g;d++)b=this.offsets[d],a.offsets.push({start:b.start,index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
|
+THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={array:b,itemSize:c,count:void 0!==d?d:b.length}},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.offsets.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(a){var b=this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),
|
|
|
+b.needsUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var c=3,d=a.length;c<d;c+=3){var e=a[c],f=a[c+1],g=a[c+2];e<b.min.x?b.min.x=e:e>b.max.x&&(b.max.x=e);f<b.min.y?b.min.y=f:f>b.max.y&&(b.max.y=f);g<b.min.z?b.min.z=g:g>b.max.z&&(b.max.z=g)}}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,
|
|
|
+0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g)}}}(),
|
|
|
+computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;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,p,r=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3,q=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],p=e[3*g+2],r.set(l,n,p),l=e[3*h],n=e[3*h+1],p=e[3*h+2],s.set(l,n,p),l=e[3*k],n=e[3*k+1],p=e[3*k+2],u.set(l,n,p),q.subVectors(u,s),v.subVectors(r,s),q.cross(v),f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*k]+=q.x,f[3*k+1]+=q.y,f[3*k+2]+=q.z}}else for(a=0,b=e.length;a<b;a+=9)l=
|
|
|
+e[a],n=e[a+1],p=e[a+2],r.set(l,n,p),l=e[a+3],n=e[a+4],p=e[a+5],s.set(l,n,p),l=e[a+6],n=e[a+7],p=e[a+8],u.set(l,n,p),q.subVectors(u,s),v.subVectors(r,s),q.cross(v),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.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){p=d[3*a];r=d[3*a+1];s=d[3*a+2];u=d[3*b];q=d[3*b+1];v=d[3*b+2];w=d[3*c];t=d[3*c+1];x=d[3*c+2];H=f[2*a];G=f[2*a+1];P=f[2*b];F=f[2*b+1];C=f[2*c];K=f[2*c+1];z=u-p;D=w-p;J=q-r;B=t-r;N=v-s;y=x-s;M=P-H;A=C-H;E=F-G;Y=K-G;R=1/(M*Y-A*E);ka.set((Y*z-E*D)*R,(Y*J-E*B)*R,(Y*N-E*y)*R);da.set((M*D-A*z)*R,(M*B-A*J)*R,(M*y-A*N)*R);k[a].add(ka);k[b].add(ka);k[c].add(ka);l[a].add(da);l[b].add(da);l[c].add(da)}function b(a){aa.x=e[3*a];aa.y=e[3*a+1];aa.z=e[3*a+2];Ga.copy(aa);Ca=k[a];T.copy(Ca);T.sub(aa.multiplyScalar(aa.dot(Ca))).normalize();
|
|
|
+xa.crossVectors(Ga,Ca);Ha=xa.dot(l[a]);Ja=0>Ha?-1:1;h[4*a]=T.x;h[4*a+1]=T.y;h[4*a+2]=T.z;h[4*a+3]=Ja}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 p,r,s,u,q,v,w,t,x,H,G,P,F,C,K,z,D,J,B,N,y,M,A,E,Y,R,ka=new THREE.Vector3,da=new THREE.Vector3,X,O,S,fa,I,ha=this.offsets,n=0;for(O=ha.length;n<O;++n){X=ha[n].start;S=ha[n].count;var ta=ha[n].index,g=X;for(X+=S;g<X;g+=3)S=ta+c[g],fa=ta+c[g+1],I=ta+c[g+2],a(S,fa,I)}var T=new THREE.Vector3,xa=new THREE.Vector3,aa=new THREE.Vector3,
|
|
|
+Ga=new THREE.Vector3,Ja,Ca,Ha,n=0;for(O=ha.length;n<O;++n)for(X=ha[n].start,S=ha[n].count,ta=ha[n].index,g=X,X+=S;g<X;g+=3)S=ta+c[g],fa=ta+c[g+1],I=ta+c[g+2],b(S),b(fa),b(I)}},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,p=new Int32Array(6),r=new Int32Array(c.length),s=new Int32Array(c.length),u=0;u<c.length;u++)r[u]=
|
|
|
+-1,s[u]=-1;for(c=0;c<d;c++){for(var q=n=0;3>q;q++)u=a[3*c+q],-1==r[u]?(p[2*q]=u,p[2*q+1]=-1,n++):r[u]<k.index?(p[2*q]=u,p[2*q+1]=-1,l++):(p[2*q]=u,p[2*q+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)q=p[n+1],-1<q&&q<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)u=p[n],q=p[n+1],-1===q&&(q=g++),r[u]=q,s[q]=u,e[f++]=q-k.index,k.count++}this.reorderBuffers(e,s,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*c)},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,array:null},d=0,g=b.length;d<g;d++){var h=b[d];if(e instanceof h){f.array=new h(e);break}}a.attributes[c]=f}d=0;for(g=this.offsets.length;d<g;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
|
+index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},
|
|
|
computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,k=new THREE.Vector3;new THREE.Vector3;new THREE.Vector3;new THREE.Vector3;
|
|
@@ -209,7 +209,7 @@ this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoin
|
|
|
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,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.addAttribute("position",new Float32Array(3*a),3);this.addAttribute("normal",new Float32Array(3*a),3);this.addAttribute("uv",new Float32Array(2*a),2);this.vertices=this.getAttribute("position").array;this.normals=this.getAttribute("normal").array;this.uvs=this.getAttribute("uv").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)}}();
|
|
|
+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=new Float32Array(3*a);this.normals=new Float32Array(3*a);this.uvs=new Float32Array(2*a);this.addAttribute("position",this.vertices,3);this.addAttribute("normal",this.normals,3);this.addAttribute("uv",this.uvs,2);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.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.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
@@ -450,23 +450,23 @@ a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.ha
|
|
|
t[u+4],q=t[u+5],n=t[u+6],r=t[u+7],s=t[u+8],d=(d+g+n)/3,e=(e+p+r)/3,f=(f+q+s)/3,t[u]=d,t[u+1]=e,t[u+2]=f,t[u+3]=d,t[u+4]=e,t[u+5]=f,t[u+6]=d,t[u+7]=e,t[u+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);k(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),k(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),k(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));l();m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var k=P(a,b,c,d,f);a=k.attributes;b=e.attributes;c=!1;k=16777215*e.id+2*k.id+(d.wireframe?1:0);k!==aa&&(aa=k,c=!0);c&&h();if(f instanceof THREE.Mesh)if(f=b.index){var l;
|
|
|
f.array instanceof Uint32Array?(k=m.UNSIGNED_INT,l=4):(k=m.UNSIGNED_SHORT,l=2);e=e.offsets;if(0===e.length)c&&(g(d,a,b,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.TRIANGLES,f.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=f.array.length,I.info.render.faces+=f.array.length/3;else{c=!0;for(var n=0,p=e.length;n<p;n++){var r=e[n].index;c&&(g(d,a,b,r),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer));m.drawElements(m.TRIANGLES,e[n].count,k,e[n].start*l);I.info.render.calls++;
|
|
|
-I.info.render.vertices+=e[n].count;I.info.render.faces+=e[n].count/3}}}else c&&g(d,a,b,0),d=e.attributes.position,m.drawArrays(m.TRIANGLES,0,d.array.length/3),I.info.render.calls++,I.info.render.vertices+=d.array.length/3,I.info.render.faces+=d.array.length/3/3;else if(f instanceof THREE.ParticleSystem)c&&g(d,a,b,0),d=b.position,m.drawArrays(m.POINTS,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length/3;else if(f instanceof THREE.Line)if(k=f.type===THREE.LineStrip?m.LINE_STRIP:
|
|
|
-m.LINES,z(d.linewidth),f=b.index)if(f.array instanceof Uint32Array?(k=m.UNSIGNED_INT,l=4):(k=m.UNSIGNED_SHORT,l=2),e=e.offsets,0===e.length)c&&(g(d,a,b,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,f.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=f.array.length;else for(1<e.length&&(c=!0),n=0,p=e.length;n<p;n++)r=e[n].index,c&&(g(d,a,b,r),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,e[n].count,k,e[n].start*l),I.info.render.calls++,
|
|
|
-I.info.render.vertices+=e[n].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(k,0,d.array.length/3),I.info.render.calls++,I.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,n;c=P(a,b,c,d,f);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==aa&&(aa=c,a=!0);a&&h();if(!d.morphTargets&&0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),k(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]),k(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var r=0;n=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;r<d.numSupportedMorphTargets&&r<n.length;)0<=c["morphTarget"+r]&&
|
|
|
-(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[r]]),k(c["morphTarget"+r]),m.vertexAttribPointer(c["morphTarget"+r],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[r]]),k(c["morphNormal"+r]),m.vertexAttribPointer(c["morphNormal"+r],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[r]=g[n[r]],r++}else{n=[];g=f.morphTargetInfluences;var q,s=g.length;for(q=0;q<s;q++)r=g[q],0<r&&n.push([r,q]);n.length>d.numSupportedMorphTargets?
|
|
|
-(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(r=0;r<d.numSupportedMorphTargets;)n[r]?(q=n[r][1],0<=c["morphTarget"+r]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),k(c["morphTarget"+r]),m.vertexAttribPointer(c["morphTarget"+r],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),k(c["morphNormal"+r]),m.vertexAttribPointer(c["morphNormal"+
|
|
|
-r],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[r]=g[q]):f.__webglMorphTargetInfluences[r]=0,r++}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,n=e.__webglCustomAttributesList.length;g<n;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,c.buffer),k(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),k(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),k(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),k(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),k(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),k(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),k(b.skinIndex),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}l();f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?
|
|
|
-(z(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)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),I.info.render.calls++):
|
|
|
-f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.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,l=a.fog;xa=-1;Xa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Nb.multiplyMatrices(b.projectionMatrix,
|
|
|
-b.matrixWorldInverse);wb.setFromMatrix(Nb);this.autoUpdateObjects&&this.initWebGLObjects(a);r(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.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||
|
|
|
-wb.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,q=p.object,t=p.buffer,v=q.geometry,q=q.material;q instanceof THREE.MeshFaceMaterial?(q=q.materials[v instanceof THREE.BufferGeometry?0:t.materialIndex],q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null)):q&&(q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null));f.render=!0;!0===this.sortObjects&&
|
|
|
-(null!==g.renderDepth?f.z=g.renderDepth:(wa.setFromMatrixPosition(g.matrixWorld),wa.applyProjection(Nb),f.z=wa.z))}this.sortObjects&&h.sort(n);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),D(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,k,l,!0,d),u(a.__webglObjectsImmediate,"",b,k,l,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,k,l,!1,d),u(a.__webglObjectsImmediate,"opaque",b,k,l,!1,d),s(a.__webglObjects,!1,"transparent",b,k,l,!0,d),u(a.__webglObjectsImmediate,"transparent",b,k,l,!0,d));r(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=P(a,b,c,d,e);aa=-1;I.setMaterialFaces(d);
|
|
|
+I.info.render.vertices+=e[n].count;I.info.render.faces+=e[n].count/3}}}else c&&g(d,a,b,0),d=e.attributes.position,m.drawArrays(m.TRIANGLES,0,d.count/3),I.info.render.calls++,I.info.render.vertices+=d.count/3,I.info.render.faces+=d.count/9;else if(f instanceof THREE.ParticleSystem)c&&g(d,a,b,0),d=b.position,m.drawArrays(m.POINTS,0,d.count/3),I.info.render.calls++,I.info.render.points+=d.count/3;else if(f instanceof THREE.Line)if(k=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),f=b.index)if(f.array instanceof
|
|
|
+Uint32Array?(k=m.UNSIGNED_INT,l=4):(k=m.UNSIGNED_SHORT,l=2),e=e.offsets,0===e.length)c&&(g(d,a,b,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,f.array.length,k,0),I.info.render.calls++,I.info.render.vertices+=f.array.length;else for(1<e.length&&(c=!0),n=0,p=e.length;n<p;n++)r=e[n].index,c&&(g(d,a,b,r),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,e[n].count,k,e[n].start*l),I.info.render.calls++,I.info.render.vertices+=e[n].count;else c&&g(d,a,b,0),
|
|
|
+d=b.position,m.drawArrays(k,0,d.count/3),I.info.render.calls++,I.info.render.points+=d.count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,n;c=P(a,b,c,d,f);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==aa&&(aa=c,a=!0);a&&h();if(!d.morphTargets&&0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),k(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]),k(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var r=0;n=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;r<d.numSupportedMorphTargets&&r<n.length;)0<=c["morphTarget"+r]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[r]]),
|
|
|
+k(c["morphTarget"+r]),m.vertexAttribPointer(c["morphTarget"+r],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n[r]]),k(c["morphNormal"+r]),m.vertexAttribPointer(c["morphNormal"+r],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[r]=g[n[r]],r++}else{n=[];g=f.morphTargetInfluences;var q,s=g.length;for(q=0;q<s;q++)r=g[q],0<r&&n.push([r,q]);n.length>d.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>
|
|
|
+d.numSupportedMorphNormals?n.sort(p):0===n.length&&n.push([0,0]);for(r=0;r<d.numSupportedMorphTargets;)n[r]?(q=n[r][1],0<=c["morphTarget"+r]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),k(c["morphTarget"+r]),m.vertexAttribPointer(c["morphTarget"+r],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+r]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),k(c["morphNormal"+r]),m.vertexAttribPointer(c["morphNormal"+r],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[r]=
|
|
|
+g[q]):f.__webglMorphTargetInfluences[r]=0,r++}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,n=e.__webglCustomAttributesList.length;g<n;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,c.buffer),k(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),k(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),k(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),k(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),k(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),k(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),k(b.skinIndex),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}l();f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(z(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)),I.info.render.calls++,I.info.render.vertices+=e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,z(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),I.info.render.calls++):f instanceof THREE.ParticleSystem&&
|
|
|
+(m.drawArrays(m.POINTS,0,e.__webglParticleCount),I.info.render.calls++,I.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,l=a.fog;xa=-1;Xa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Nb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);
|
|
|
+wb.setFromMatrix(Nb);this.autoUpdateObjects&&this.initWebGLObjects(a);r(this.renderPluginsPre,a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;I.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||wb.intersectsObject(g))){var p=
|
|
|
+g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,q=p.object,t=p.buffer,v=q.geometry,q=q.material;q instanceof THREE.MeshFaceMaterial?(q=q.materials[v instanceof THREE.BufferGeometry?0:t.materialIndex],q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null)):q&&(q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?
|
|
|
+f.z=g.renderDepth:(wa.setFromMatrixPosition(g.matrixWorld),wa.applyProjection(Nb),f.z=wa.z))}this.sortObjects&&h.sort(n);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),D(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,k,l,!0,d),u(a.__webglObjectsImmediate,"",b,k,l,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,k,l,!1,d),u(a.__webglObjectsImmediate,"opaque",b,k,l,!1,d),s(a.__webglObjects,!1,"transparent",b,k,l,!0,d),u(a.__webglObjectsImmediate,"transparent",b,k,l,!0,d));r(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=P(a,b,c,d,e);aa=-1;I.setMaterialFaces(d);
|
|
|
e.immediateRenderCallback?e.immediateRenderCallback(f,m,wb):e.render(function(a){I.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)q(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)x(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&&x(h,a),q(h,a));var k=h,l=k.geometry,n=void 0,r=void 0,s=void 0;if(l instanceof THREE.BufferGeometry){var u=m.DYNAMIC_DRAW,v=l.attributes,z=void 0,y=void 0;for(z in v)y=v[z],y.needsUpdate&&("index"===z?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,y.array,u)):(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,u)),y.needsUpdate=!1)}else if(k instanceof THREE.Mesh){for(var H=0,D=l.geometryGroupsList.length;H<
|
|
|
D;H++)if(n=l.geometryGroupsList[H],s=d(k,n),l.buffersNeedUpdate&&c(n,k),r=s.attributes&&w(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||r){var A=n,G=k,F=m.DYNAMIC_DRAW,B=!l.dynamic,C=s;if(A.__inittedArrays){var K=e(C),M=C.vertexColors?C.vertexColors:!1,P=f(C),N=K===THREE.SmoothShading,E=void 0,I=void 0,O=void 0,J=void 0,ha=void 0,aa=void 0,R=void 0,Y=void 0,S=void 0,W=void 0,X=void 0,T=void 0,
|