提交 7ff5c411 编写于 作者: M Mr.doob

Updated builds.

上级 23613093
......@@ -8556,40 +8556,40 @@ THREE.BufferGeometry.prototype = {
for ( var i = start, il = start + count; i < il; i += 3 ) {
vA = index + indices[ i ];
vB = index + indices[ i + 1 ];
vC = index + indices[ i + 2 ];
vA = ( index + indices[ i ] ) * 3;
vB = ( index + indices[ i + 1 ] ) * 3;
vC = ( index + indices[ i + 2 ] ) * 3;
x = positions[ vA * 3 ];
y = positions[ vA * 3 + 1 ];
z = positions[ vA * 3 + 2 ];
x = positions[ vA ];
y = positions[ vA + 1 ];
z = positions[ vA + 2 ];
pA.set( x, y, z );
x = positions[ vB * 3 ];
y = positions[ vB * 3 + 1 ];
z = positions[ vB * 3 + 2 ];
x = positions[ vB ];
y = positions[ vB + 1 ];
z = positions[ vB + 2 ];
pB.set( x, y, z );
x = positions[ vC * 3 ];
y = positions[ vC * 3 + 1 ];
z = positions[ vC * 3 + 2 ];
x = positions[ vC ];
y = positions[ vC + 1 ];
z = positions[ vC + 2 ];
pC.set( x, y, z );
cb.subVectors( pC, pB );
ab.subVectors( pA, pB );
cb.cross( ab );
normals[ vA * 3 ] += cb.x;
normals[ vA * 3 + 1 ] += cb.y;
normals[ vA * 3 + 2 ] += cb.z;
normals[ vA ] += cb.x;
normals[ vA + 1 ] += cb.y;
normals[ vA + 2 ] += cb.z;
normals[ vB * 3 ] += cb.x;
normals[ vB * 3 + 1 ] += cb.y;
normals[ vB * 3 + 2 ] += cb.z;
normals[ vB ] += cb.x;
normals[ vB + 1 ] += cb.y;
normals[ vB + 2 ] += cb.z;
normals[ vC * 3 ] += cb.x;
normals[ vC * 3 + 1 ] += cb.y;
normals[ vC * 3 + 2 ] += cb.z;
normals[ vC ] += cb.x;
normals[ vC + 1 ] += cb.y;
normals[ vC + 2 ] += cb.z;
}
......@@ -8601,7 +8601,7 @@ THREE.BufferGeometry.prototype = {
for ( var i = 0, il = positions.length; i < il; i += 9 ) {
x = positions[ i ];
x = positions[ i ];
y = positions[ i + 1 ];
z = positions[ i + 2 ];
pA.set( x, y, z );
......
......@@ -186,16 +186,16 @@ u=p.vertexNormals[2],m[s]=v.x,m[s+1]=v.y,m[s+2]=v.z,m[s+3]=w.x,m[s+4]=w.y,m[s+5]
b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),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,g=c.length;e<g;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.set(c[e],c[e+1],c[e+2]),f=Math.max(f,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(f);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=
this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,g,f,h,k,m,n,q=new THREE.Vector3,r=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,p=new THREE.Vector3;if(a.index)for(var v=a.index.array,w=0<this.offsets.length?this.offsets:[{start:0,count:v.length,index:0}],u=0,z=w.length;u<z;++u){e=w[u].start;g=w[u].count;
for(var x=w[u].index,d=e,e=e+g;d<e;d+=3)g=x+v[d],f=x+v[d+1],h=x+v[d+2],k=b[3*g],m=b[3*g+1],n=b[3*g+2],q.set(k,m,n),k=b[3*f],m=b[3*f+1],n=b[3*f+2],r.set(k,m,n),k=b[3*h],m=b[3*h+1],n=b[3*h+2],t.set(k,m,n),s.subVectors(t,r),p.subVectors(q,r),s.cross(p),c[3*g]+=s.x,c[3*g+1]+=s.y,c[3*g+2]+=s.z,c[3*f]+=s.x,c[3*f+1]+=s.y,c[3*f+2]+=s.z,c[3*h]+=s.x,c[3*h+1]+=s.y,c[3*h+2]+=s.z}else for(d=0,e=b.length;d<e;d+=9)k=b[d],m=b[d+1],n=b[d+2],q.set(k,m,n),k=b[d+3],m=b[d+4],n=b[d+5],r.set(k,m,n),k=b[d+6],m=b[d+7],n=
b[d+8],t.set(k,m,n),s.subVectors(t,r),p.subVectors(q,r),s.cross(p),c[d]=s.x,c[d+1]=s.y,c[d+2]=s.z,c[d+3]=s.x,c[d+4]=s.y,c[d+5]=s.z,c[d+6]=s.x,c[d+7]=s.y,c[d+8]=s.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q=d[3*a];r=d[3*a+1];t=d[3*a+2];s=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];u=d[3*c+1];z=d[3*c+2];x=g[2*a];G=g[2*a+1];C=g[2*b];B=g[2*b+1];y=g[2*c];D=g[2*c+1];J=s-q;N=w-q;Q=p-r;E=u-r;da=v-t;V=z-t;R=C-x;S=y-x;L=B-G;xa=D-G;P=1/(R*xa-S*L);ya.set((xa*J-
L*N)*P,(xa*Q-L*E)*P,(xa*da-L*V)*P);la.set((R*N-S*J)*P,(R*E-S*Q)*P,(R*V-S*da)*P);k[a].add(ya);k[b].add(ya);k[c].add(ya);m[a].add(la);m[b].add(la);m[c].add(la)}function b(a){Ca.x=e[3*a];Ca.y=e[3*a+1];Ca.z=e[3*a+2];hb.copy(Ca);I=k[a];Ga.copy(I);Ga.sub(Ca.multiplyScalar(Ca.dot(I))).normalize();Ta.crossVectors(hb,I);Na=Ta.dot(m[a]);Ra=0>Na?-1:1;h[4*a]=Ga.x;h[4*a+1]=Ga.y;h[4*a+2]=Ga.z;h[4*a+3]=Ra}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,g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],m=[],n=0;n<f;n++)k[n]=new THREE.Vector3,m[n]=new THREE.Vector3;var q,
r,t,s,p,v,w,u,z,x,G,C,B,y,D,J,N,Q,E,da,V,R,S,L,xa,P,ya=new THREE.Vector3,la=new THREE.Vector3,sa,K,ha,ra,Ia;0===this.drawcalls.length&&this.addDrawCall(0,c.length,0);var ta=this.drawcalls,n=0;for(K=ta.length;n<K;++n){sa=ta[n].start;ha=ta[n].count;var Ja=ta[n].index,f=sa;for(sa+=ha;f<sa;f+=3)ha=Ja+c[f],ra=Ja+c[f+1],Ia=Ja+c[f+2],a(ha,ra,Ia)}var Ga=new THREE.Vector3,Ta=new THREE.Vector3,Ca=new THREE.Vector3,hb=new THREE.Vector3,Ra,I,Na,n=0;for(K=ta.length;n<K;++n)for(sa=ta[n].start,ha=ta[n].count,Ja=
ta[n].index,f=sa,sa+=ha;f<sa;f+=3)ha=Ja+c[f],ra=Ja+c[f+1],Ia=Ja+c[f+2],b(ha),b(ra),b(Ia)}},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),g=0,f=0,h=[{start:0,count:0,index:0}],k=h[0],m=0,n=0,q=new Int32Array(6),r=new Int32Array(c.length),t=new Int32Array(c.length),s=0;s<c.length;s++)r[s]=-1,t[s]=-1;for(c=0;c<d;c++){for(var p=n=0;3>p;p++)s=a[3*c+p],-1==r[s]?(q[2*p]=s,
q[2*p+1]=-1,n++):r[s]<k.index?(q[2*p]=s,q[2*p+1]=-1,m++):(q[2*p]=s,q[2*p+1]=r[s]);if(f+n>k.index+b)for(k={start:g,count:0,index:f},h.push(k),n=0;6>n;n+=2)p=q[n+1],-1<p&&p<k.index&&(q[n+1]=-1);for(n=0;6>n;n+=2)s=q[n],p=q[n+1],-1===p&&(p=f++),r[s]=p,t[p]=s,e[g++]=p-k.index,k.count++}this.reorderBuffers(e,t,f);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,g=a.length;e<g;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},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*c));for(var g=0;g<c;g++){var f=b[g];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,m=d[e],n=0;n<k;n++)m[g*k+n]=h[f*k+n]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=
this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,c=this.offsets,d=this.boundingSphere,e;for(e in b){for(var g=b[e],f=[],h=g.array,k=0,m=h.length;k<m;k++)f[k]=h[k];a.data.attributes[e]={itemSize:g.itemSize,type:g.array.constructor.name,array:f}}0<c.length&&(a.data.offsets=JSON.parse(JSON.stringify(c)));null!==d&&(a.data.boundingSphere={center:d.center.toArray(),
radius:d.radius});return a},clone:function(){var a=new THREE.BufferGeometry,b;for(b in this.attributes)a.addAttribute(b,this.attributes[b].clone());b=0;for(var c=this.offsets.length;b<c;b++){var d=this.offsets[b];a.offsets.push({start:d.start,index:d.index,count:d.count})}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);
for(var x=w[u].index,d=e,e=e+g;d<e;d+=3)g=3*(x+v[d]),f=3*(x+v[d+1]),h=3*(x+v[d+2]),k=b[g],m=b[g+1],n=b[g+2],q.set(k,m,n),k=b[f],m=b[f+1],n=b[f+2],r.set(k,m,n),k=b[h],m=b[h+1],n=b[h+2],t.set(k,m,n),s.subVectors(t,r),p.subVectors(q,r),s.cross(p),c[g]+=s.x,c[g+1]+=s.y,c[g+2]+=s.z,c[f]+=s.x,c[f+1]+=s.y,c[f+2]+=s.z,c[h]+=s.x,c[h+1]+=s.y,c[h+2]+=s.z}else for(d=0,e=b.length;d<e;d+=9)k=b[d],m=b[d+1],n=b[d+2],q.set(k,m,n),k=b[d+3],m=b[d+4],n=b[d+5],r.set(k,m,n),k=b[d+6],m=b[d+7],n=b[d+8],t.set(k,m,n),s.subVectors(t,
r),p.subVectors(q,r),s.cross(p),c[d]=s.x,c[d+1]=s.y,c[d+2]=s.z,c[d+3]=s.x,c[d+4]=s.y,c[d+5]=s.z,c[d+6]=s.x,c[d+7]=s.y,c[d+8]=s.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){q=d[3*a];r=d[3*a+1];t=d[3*a+2];s=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];u=d[3*c+1];z=d[3*c+2];x=g[2*a];G=g[2*a+1];C=g[2*b];B=g[2*b+1];y=g[2*c];D=g[2*c+1];J=s-q;N=w-q;Q=p-r;E=u-r;da=v-t;V=z-t;R=C-x;S=y-x;L=B-G;xa=D-G;P=1/(R*xa-S*L);ya.set((xa*J-L*N)*P,(xa*Q-L*E)*P,(xa*da-L*V)*P);
la.set((R*N-S*J)*P,(R*E-S*Q)*P,(R*V-S*da)*P);k[a].add(ya);k[b].add(ya);k[c].add(ya);m[a].add(la);m[b].add(la);m[c].add(la)}function b(a){Ca.x=e[3*a];Ca.y=e[3*a+1];Ca.z=e[3*a+2];hb.copy(Ca);I=k[a];Ga.copy(I);Ga.sub(Ca.multiplyScalar(Ca.dot(I))).normalize();Ta.crossVectors(hb,I);Na=Ta.dot(m[a]);Ra=0>Na?-1:1;h[4*a]=Ga.x;h[4*a+1]=Ga.y;h[4*a+2]=Ga.z;h[4*a+3]=Ra}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,g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],m=[],n=0;n<f;n++)k[n]=new THREE.Vector3,m[n]=new THREE.Vector3;var q,r,t,s,p,v,w,u,z,x,G,C,B,y,D,J,N,Q,E,da,V,R,S,L,xa,P,ya=new THREE.Vector3,la=new THREE.Vector3,sa,K,ha,ra,Ia;0===this.drawcalls.length&&
this.addDrawCall(0,c.length,0);var ta=this.drawcalls,n=0;for(K=ta.length;n<K;++n){sa=ta[n].start;ha=ta[n].count;var Ja=ta[n].index,f=sa;for(sa+=ha;f<sa;f+=3)ha=Ja+c[f],ra=Ja+c[f+1],Ia=Ja+c[f+2],a(ha,ra,Ia)}var Ga=new THREE.Vector3,Ta=new THREE.Vector3,Ca=new THREE.Vector3,hb=new THREE.Vector3,Ra,I,Na,n=0;for(K=ta.length;n<K;++n)for(sa=ta[n].start,ha=ta[n].count,Ja=ta[n].index,f=sa,sa+=ha;f<sa;f+=3)ha=Ja+c[f],ra=Ja+c[f+1],Ia=Ja+c[f+2],b(ha),b(ra),b(Ia)}},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),g=0,f=0,h=[{start:0,count:0,index:0}],k=h[0],m=0,n=0,q=new Int32Array(6),r=new Int32Array(c.length),t=new Int32Array(c.length),s=0;s<c.length;s++)r[s]=-1,t[s]=-1;for(c=0;c<d;c++){for(var p=n=0;3>p;p++)s=a[3*c+p],-1==r[s]?(q[2*p]=s,q[2*p+1]=-1,n++):r[s]<k.index?(q[2*p]=s,q[2*p+1]=-1,m++):(q[2*p]=s,q[2*p+1]=r[s]);if(f+n>k.index+b)for(k={start:g,count:0,index:f},h.push(k),
n=0;6>n;n+=2)p=q[n+1],-1<p&&p<k.index&&(q[n+1]=-1);for(n=0;6>n;n+=2)s=q[n],p=q[n+1],-1===p&&(p=f++),r[s]=p,t[p]=s,e[g++]=p-k.index,k.count++}this.reorderBuffers(e,t,f);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,g=a.length;e<g;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},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=
e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*c));for(var g=0;g<c;g++){var f=b[g];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,m=d[e],n=0;n<k;n++)m[g*k+n]=h[f*k+n]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},
uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,c=this.offsets,d=this.boundingSphere,e;for(e in b){for(var g=b[e],f=[],h=g.array,k=0,m=h.length;k<m;k++)f[k]=h[k];a.data.attributes[e]={itemSize:g.itemSize,type:g.array.constructor.name,array:f}}0<c.length&&(a.data.offsets=JSON.parse(JSON.stringify(c)));null!==d&&(a.data.boundingSphere={center:d.center.toArray(),radius:d.radius});return a},clone:function(){var a=new THREE.BufferGeometry,b;for(b in this.attributes)a.addAttribute(b,
this.attributes[b].clone());b=0;for(var c=this.offsets.length;b<c;b++){var d=this.offsets[b];a.offsets.push({start:d.start,index:d.index,count:d.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.type="Geometry";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.groupsNeedUpdate=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,g=a.vertexNormals.length;e<g;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof THREE.Sphere&&this.computeBoundingSphere()},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册