提交 2c02b6df 编写于 作者: M Mr.doob

Updated builds.

上级 784dd66f
......@@ -9007,80 +9007,48 @@ THREE.BufferGeometry.prototype = {
computeBoundingBox: function () {
if ( this.boundingBox === null ) {
this.boundingBox = new THREE.Box3();
}
var vector = new THREE.Vector3();
var positions = this.attributes[ 'position' ].array;
return function () {
if ( positions ) {
if ( this.boundingBox === null ) {
var bb = this.boundingBox;
this.boundingBox = new THREE.Box3();
if ( positions.length >= 3 ) {
bb.min.x = bb.max.x = positions[ 0 ];
bb.min.y = bb.max.y = positions[ 1 ];
bb.min.z = bb.max.z = positions[ 2 ];
}
for ( var i = 3, il = positions.length; i < il; i += 3 ) {
var x = positions[ i ];
var y = positions[ i + 1 ];
var z = positions[ i + 2 ];
// bounding box
if ( x < bb.min.x ) {
bb.min.x = x;
} else if ( x > bb.max.x ) {
bb.max.x = x;
}
if ( y < bb.min.y ) {
bb.min.y = y;
} else if ( y > bb.max.y ) {
bb.max.y = y;
}
var positions = this.attributes[ 'position' ].array;
if ( z < bb.min.z ) {
if ( positions ) {
bb.min.z = z;
var bb = this.boundingBox;
bb.makeEmpty();
} else if ( z > bb.max.z ) {
for ( var i = 0, il = positions.length; i < il; i += 3 ) {
bb.max.z = z;
vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
bb.expandByPoint( vector );
}
}
}
if ( positions === undefined || positions.length === 0 ) {
if ( positions === undefined || positions.length === 0 ) {
this.boundingBox.min.set( 0, 0, 0 );
this.boundingBox.max.set( 0, 0, 0 );
this.boundingBox.min.set( 0, 0, 0 );
this.boundingBox.max.set( 0, 0, 0 );
}
}
if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
if ( 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.' );
console.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.' );
}
}
},
}(),
computeBoundingSphere: function () {
......
......@@ -193,20 +193,20 @@ THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:fu
b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0)},fromGeometry:function(a,b){b=b||{vertexColors:THREE.NoColors};var c=a.vertices,d=a.faces,e=a.faceVertexUvs,f=b.vertexColors,g=0<e[0].length,h=3==d[0].vertexNormals.length,k=new Float32Array(9*d.length);this.addAttribute("position",new THREE.BufferAttribute(k,3));var m=new Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(m,3));if(f!==
THREE.NoColors){var n=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(n,3))}if(!0===g){var p=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(p,2))}for(var r=0,q=0,t=0;r<d.length;r++,q+=6,t+=9){var s=d[r],v=c[s.a],x=c[s.b],u=c[s.c];k[t]=v.x;k[t+1]=v.y;k[t+2]=v.z;k[t+3]=x.x;k[t+4]=x.y;k[t+5]=x.z;k[t+6]=u.x;k[t+7]=u.y;k[t+8]=u.z;!0===h?(v=s.vertexNormals[0],x=s.vertexNormals[1],u=s.vertexNormals[2],m[t]=v.x,m[t+1]=v.y,m[t+2]=v.z,m[t+3]=x.x,
m[t+4]=x.y,m[t+5]=x.z,m[t+6]=u.x,m[t+7]=u.y,m[t+8]=u.z):(v=s.normal,m[t]=v.x,m[t+1]=v.y,m[t+2]=v.z,m[t+3]=v.x,m[t+4]=v.y,m[t+5]=v.z,m[t+6]=v.x,m[t+7]=v.y,m[t+8]=v.z);f===THREE.FaceColors?(s=s.color,n[t]=s.r,n[t+1]=s.g,n[t+2]=s.b,n[t+3]=s.r,n[t+4]=s.g,n[t+5]=s.b,n[t+6]=s.r,n[t+7]=s.g,n[t+8]=s.b):f===THREE.VertexColors&&(v=s.vertexColors[0],x=s.vertexColors[1],s=s.vertexColors[2],n[t]=v.r,n[t+1]=v.g,n[t+2]=v.b,n[t+3]=x.r,n[t+4]=x.g,n[t+5]=x.b,n[t+6]=s.r,n[t+7]=s.g,n[t+8]=s.b);!0===g&&(s=e[0][r][0],
v=e[0][r][1],x=e[0][r][2],p[q]=s.x,p[q+1]=s.y,p[q+2]=v.x,p[q+3]=v.y,p[q+4]=x.x,p[q+5]=x.y)}this.computeBoundingSphere();return this},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);(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,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(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);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(){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,m,n,p,r=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,v=new THREE.Vector3;
if(this.attributes.index){var x=this.attributes.index.array,u=0<this.offsets.length?this.offsets:[{start:0,count:x.length,index:0}];c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var G=u[c].index;a=b;for(b+=g;a<b;a+=3)g=G+x[a],h=G+x[a+1],k=G+x[a+2],m=e[3*g],n=e[3*g+1],p=e[3*g+2],r.set(m,n,p),m=e[3*h],n=e[3*h+1],p=e[3*h+2],q.set(m,n,p),m=e[3*k],n=e[3*k+1],p=e[3*k+2],t.set(m,n,p),s.subVectors(t,q),v.subVectors(r,q),s.cross(v),f[3*g]+=s.x,f[3*g+1]+=s.y,f[3*g+2]+=s.z,f[3*h]+=s.x,f[3*h+1]+=s.y,
f[3*h+2]+=s.z,f[3*k]+=s.x,f[3*k+1]+=s.y,f[3*k+2]+=s.z}}else for(a=0,b=e.length;a<b;a+=9)m=e[a],n=e[a+1],p=e[a+2],r.set(m,n,p),m=e[a+3],n=e[a+4],p=e[a+5],q.set(m,n,p),m=e[a+6],n=e[a+7],p=e[a+8],t.set(m,n,p),s.subVectors(t,q),v.subVectors(r,q),s.cross(v),f[a]=s.x,f[a+1]=s.y,f[a+2]=s.z,f[a+3]=s.x,f[a+4]=s.y,f[a+5]=s.z,f[a+6]=s.x,f[a+7]=s.y,f[a+8]=s.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},computeTangents:function(){function a(a,b,c){p=d[3*a];r=d[3*a+1];q=d[3*a+2];t=d[3*b];s=d[3*b+1];v=d[3*
b+2];x=d[3*c];u=d[3*c+1];G=d[3*c+2];y=f[2*a];B=f[2*a+1];C=f[2*b];A=f[2*b+1];w=f[2*c];z=f[2*c+1];D=t-p;Q=x-p;R=s-r;O=u-r;N=v-q;L=G-q;F=C-y;S=w-y;J=A-B;E=z-B;V=1/(F*E-S*J);P.set((E*D-J*Q)*V,(E*R-J*O)*V,(E*N-J*L)*V);ca.set((F*Q-S*D)*V,(F*O-S*R)*V,(F*L-S*N)*V);k[a].add(P);k[b].add(P);k[c].add(P);m[a].add(ca);m[b].add(ca);m[c].add(ca)}function b(a){La.x=e[3*a];La.y=e[3*a+1];La.z=e[3*a+2];Ma.copy(La);ya=k[a];Ja.copy(ya);Ja.sub(La.multiplyScalar(La.dot(ya))).normalize();Ka.crossVectors(Ma,ya);I=Ka.dot(m[a]);
ab=0>I?-1:1;h[4*a]=Ja.x;h[4*a+1]=Ja.y;h[4*a+2]=Ja.z;h[4*a+3]=ab}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=[],m=[],n=0;n<g;n++)k[n]=new THREE.Vector3,m[n]=new THREE.Vector3;var p,r,q,t,s,v,x,u,G,y,B,C,A,w,z,D,Q,R,O,N,L,F,S,J,E,V,P=new THREE.Vector3,ca=new THREE.Vector3,oa,K,aa,Z,ba,X=this.offsets,n=0;for(K=X.length;n<K;++n){oa=X[n].start;aa=X[n].count;var ta=X[n].index,g=oa;for(oa+=aa;g<oa;g+=3)aa=ta+c[g],Z=ta+c[g+1],ba=ta+c[g+2],a(aa,Z,ba)}var Ja=new THREE.Vector3,Ka=new THREE.Vector3,La=new THREE.Vector3,Ma=new THREE.Vector3,
ab,ya,I,n=0;for(K=X.length;n<K;++n)for(oa=X[n].start,aa=X[n].count,ta=X[n].index,g=oa,oa+=aa;g<oa;g+=3)aa=ta+c[g],Z=ta+c[g+1],ba=ta+c[g+2],b(aa),b(Z),b(ba)}},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],m=0,n=0,p=new Int32Array(6),r=new Int32Array(c.length),q=new Int32Array(c.length),t=0;t<c.length;t++)r[t]=-1,q[t]=-1;for(c=
0;c<d;c++){for(var s=n=0;3>s;s++)t=a[3*c+s],-1==r[t]?(p[2*s]=t,p[2*s+1]=-1,n++):r[t]<k.index?(p[2*s]=t,p[2*s+1]=-1,m++):(p[2*s]=t,p[2*s+1]=r[t]);if(g+n>k.index+b)for(k={start:f,count:0,index:g},h.push(k),n=0;6>n;n+=2)s=p[n+1],-1<s&&s<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)t=p[n],s=p[n+1],-1===s&&(s=g++),r[t]=s,q[s]=t,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,q,g);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,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},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 m=e[h];if(g instanceof m){d[f]=new m(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,m=d[f],n=0;n<k;n++)m[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);
v=e[0][r][1],x=e[0][r][2],p[q]=s.x,p[q+1]=s.y,p[q+2]=v.x,p[q+3]=v.y,p[q+4]=x.x,p[q+5]=x.y)}this.computeBoundingSphere();return this},computeBoundingBox:function(){var a=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty();for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===b||0===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,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(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);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(){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,m,n,p,r=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var x=this.attributes.index.array,u=0<this.offsets.length?this.offsets:
[{start:0,count:x.length,index:0}];c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var G=u[c].index;a=b;for(b+=g;a<b;a+=3)g=G+x[a],h=G+x[a+1],k=G+x[a+2],m=e[3*g],n=e[3*g+1],p=e[3*g+2],r.set(m,n,p),m=e[3*h],n=e[3*h+1],p=e[3*h+2],q.set(m,n,p),m=e[3*k],n=e[3*k+1],p=e[3*k+2],t.set(m,n,p),s.subVectors(t,q),v.subVectors(r,q),s.cross(v),f[3*g]+=s.x,f[3*g+1]+=s.y,f[3*g+2]+=s.z,f[3*h]+=s.x,f[3*h+1]+=s.y,f[3*h+2]+=s.z,f[3*k]+=s.x,f[3*k+1]+=s.y,f[3*k+2]+=s.z}}else for(a=0,b=e.length;a<b;a+=9)m=e[a],n=
e[a+1],p=e[a+2],r.set(m,n,p),m=e[a+3],n=e[a+4],p=e[a+5],q.set(m,n,p),m=e[a+6],n=e[a+7],p=e[a+8],t.set(m,n,p),s.subVectors(t,q),v.subVectors(r,q),s.cross(v),f[a]=s.x,f[a+1]=s.y,f[a+2]=s.z,f[a+3]=s.x,f[a+4]=s.y,f[a+5]=s.z,f[a+6]=s.x,f[a+7]=s.y,f[a+8]=s.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},computeTangents:function(){function a(a,b,c){p=d[3*a];r=d[3*a+1];q=d[3*a+2];t=d[3*b];s=d[3*b+1];v=d[3*b+2];x=d[3*c];u=d[3*c+1];G=d[3*c+2];y=f[2*a];B=f[2*a+1];C=f[2*b];A=f[2*b+1];w=f[2*c];z=f[2*c+1];
D=t-p;Q=x-p;R=s-r;O=u-r;N=v-q;L=G-q;F=C-y;S=w-y;J=A-B;E=z-B;V=1/(F*E-S*J);P.set((E*D-J*Q)*V,(E*R-J*O)*V,(E*N-J*L)*V);ca.set((F*Q-S*D)*V,(F*O-S*R)*V,(F*L-S*N)*V);k[a].add(P);k[b].add(P);k[c].add(P);m[a].add(ca);m[b].add(ca);m[c].add(ca)}function b(a){La.x=e[3*a];La.y=e[3*a+1];La.z=e[3*a+2];Ma.copy(La);ya=k[a];Ja.copy(ya);Ja.sub(La.multiplyScalar(La.dot(ya))).normalize();Ka.crossVectors(Ma,ya);I=Ka.dot(m[a]);ab=0>I?-1:1;h[4*a]=Ja.x;h[4*a+1]=Ja.y;h[4*a+2]=Ja.z;h[4*a+3]=ab}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=[],m=[],
n=0;n<g;n++)k[n]=new THREE.Vector3,m[n]=new THREE.Vector3;var p,r,q,t,s,v,x,u,G,y,B,C,A,w,z,D,Q,R,O,N,L,F,S,J,E,V,P=new THREE.Vector3,ca=new THREE.Vector3,oa,K,aa,Z,ba,X=this.offsets,n=0;for(K=X.length;n<K;++n){oa=X[n].start;aa=X[n].count;var ta=X[n].index,g=oa;for(oa+=aa;g<oa;g+=3)aa=ta+c[g],Z=ta+c[g+1],ba=ta+c[g+2],a(aa,Z,ba)}var Ja=new THREE.Vector3,Ka=new THREE.Vector3,La=new THREE.Vector3,Ma=new THREE.Vector3,ab,ya,I,n=0;for(K=X.length;n<K;++n)for(oa=X[n].start,aa=X[n].count,ta=X[n].index,g=
oa,oa+=aa;g<oa;g+=3)aa=ta+c[g],Z=ta+c[g+1],ba=ta+c[g+2],b(aa),b(Z),b(ba)}},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],m=0,n=0,p=new Int32Array(6),r=new Int32Array(c.length),q=new Int32Array(c.length),t=0;t<c.length;t++)r[t]=-1,q[t]=-1;for(c=0;c<d;c++){for(var s=n=0;3>s;s++)t=a[3*c+s],-1==r[t]?(p[2*s]=t,p[2*s+1]=-1,n++):
r[t]<k.index?(p[2*s]=t,p[2*s+1]=-1,m++):(p[2*s]=t,p[2*s+1]=r[t]);if(g+n>k.index+b)for(k={start:f,count:0,index:g},h.push(k),n=0;6>n;n+=2)s=p[n+1],-1<s&&s<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)t=p[n],s=p[n+1],-1===s&&(s=g++),r[t]=s,q[s]=t,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,q,g);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,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},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 m=e[h];if(g instanceof m){d[f]=new m(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,
m=d[f],n=0;n<k;n++)m[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.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,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()},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册