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

Updated builds.

上级 14d1b9f5
......@@ -10642,6 +10642,12 @@ THREE.BufferGeometry.prototype = {
var direct = geometry.__directGeometry;
if ( direct === undefined ) {
return this.fromGeometry( geometry );
}
direct.verticesNeedUpdate = geometry.verticesNeedUpdate;
direct.normalsNeedUpdate = geometry.normalsNeedUpdate;
direct.colorsNeedUpdate = geometry.colorsNeedUpdate;
......
......@@ -229,21 +229,21 @@ THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.Geo
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute&&!1===b instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):this.attributes[a]=b},getAttribute:function(a){return this.attributes[a]},get offsets(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .drawcalls.");return this.drawcalls},
addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},clearDrawCalls:function(){this.drawcalls=[]},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);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();
var a=this.boundingBox.center().negate();this.applyMatrix((new THREE.Matrix4).setPosition(a));return a},setFromObject:function(a){console.log("THREE.BufferGeometry.setFromObject(). Converting",a,this);var b=a.geometry;if(a instanceof THREE.PointCloud||a instanceof THREE.Line){a=new THREE.Float32Attribute(3*b.vertices.length,3);var c=new THREE.Float32Attribute(3*b.colors.length,3);this.addAttribute("position",a.copyVector3sArray(b.vertices));this.addAttribute("color",c.copyColorsArray(b.colors));b.lineDistances&&
b.lineDistances.length===b.vertices.length&&(a=new THREE.Float32Attribute(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances)));null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone());null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a instanceof THREE.Mesh&&b instanceof THREE.Geometry&&this.fromGeometry(b);return this},updateFromObject:function(a){var b=a.geometry;a instanceof THREE.Mesh&&(a=b.__directGeometry,a.verticesNeedUpdate=
b.verticesNeedUpdate,a.normalsNeedUpdate=b.normalsNeedUpdate,a.colorsNeedUpdate=b.colorsNeedUpdate,a.uvsNeedUpdate=b.uvsNeedUpdate,a.tangentsNeedUpdate=b.tangentsNeedUpdate,b.verticesNeedUpdate=!1,b.normalsNeedUpdate=!1,b.colorsNeedUpdate=!1,b.uvsNeedUpdate=!1,b.tangentsNeedUpdate=!1,b=a);!0===b.verticesNeedUpdate&&(a=this.attributes.position,void 0!==a&&(a.copyVector3sArray(b.vertices),a.needsUpdate=!0),b.verticesNeedUpdate=!1);!0===b.normalsNeedUpdate&&(a=this.attributes.normal,void 0!==a&&(a.copyVector3sArray(b.normals),
a.needsUpdate=!0),b.normalsNeedUpdate=!1);!0===b.colorsNeedUpdate&&(a=this.attributes.color,void 0!==a&&(a.copyColorsArray(b.colors),a.needsUpdate=!0),b.colorsNeedUpdate=!1);!0===b.tangentsNeedUpdate&&(a=this.attributes.tangent,void 0!==a&&(a.copyVector4sArray(b.tangents),a.needsUpdate=!0),b.tangentsNeedUpdate=!1);b.lineDistancesNeedUpdate&&(a=this.attributes.lineDistance,void 0!==a&&(a.copyArray(b.lineDistances),a.needsUpdate=!0),b.lineDistancesNeedUpdate=!1);return this},fromGeometry:function(a){a.__directGeometry=
(new THREE.DirectGeometry).fromGeometry(a);return this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){var b=new Float32Array(3*a.vertices.length);this.addAttribute("position",(new THREE.BufferAttribute(b,3)).copyVector3sArray(a.vertices));0<a.normals.length&&(b=new Float32Array(3*a.normals.length),this.addAttribute("normal",(new THREE.BufferAttribute(b,3)).copyVector3sArray(a.normals)));0<a.colors.length&&(b=new Float32Array(3*a.colors.length),this.addAttribute("color",(new THREE.BufferAttribute(b,
3)).copyColorsArray(a.colors)));0<a.uvs.length&&(b=new Float32Array(2*a.uvs.length),this.addAttribute("uv",(new THREE.BufferAttribute(b,2)).copyVector2sArray(a.uvs)));0<a.uvs2.length&&(b=new Float32Array(2*a.uvs2.length),this.addAttribute("uv2",(new THREE.BufferAttribute(b,2)).copyVector2sArray(a.uvs2)));0<a.tangents.length&&(b=new Float32Array(4*a.tangents.length),this.addAttribute("tangent",(new THREE.BufferAttribute(b,4)).copyVector4sArray(a.tangents)));0<a.indices.length&&(b=new Uint16Array(3*
a.indices.length),this.addAttribute("index",(new THREE.BufferAttribute(b,1)).copyIndicesArray(a.indices)));if(0<a.morphTargets.length)for(var b=a.morphTargets,c=0,d=b.length;c<d;c++){var e=b[c],g=new THREE.Float32Attribute(3*e.length,3);this.morphAttributes.push(g.copyVector3sArray(e))}0<a.skinIndices.length&&(b=new THREE.Float32Attribute(4*a.skinIndices.length,4),this.addAttribute("skinIndex",b.copyVector4sArray(a.skinIndices)));0<a.skinWeights.length&&(b=new THREE.Float32Attribute(4*a.skinWeights.length,
4),this.addAttribute("skinWeight",b.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());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.fromArray(b,d),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.',this)}}(),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.fromArray(c,e),a.expandByPoint(b);a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.fromArray(c,e),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.',this)}}}(),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=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;if(a.index){var q=a.index.array;0===this.drawcalls.length&&this.addDrawCall(0,q.length);for(var t=0,s=this.drawcalls.length;t<s;++t){e=this.drawcalls[t].start;
g=this.drawcalls[t].count;for(var u=this.drawcalls[t].index,d=e,e=e+g;d<e;d+=3)g=3*(u+q[d]),f=3*(u+q[d+1]),h=3*(u+q[d+2]),k.fromArray(b,g),l.fromArray(b,f),m.fromArray(b,h),p.subVectors(m,l),n.subVectors(k,l),p.cross(n),c[g]+=p.x,c[g+1]+=p.y,c[g+2]+=p.z,c[f]+=p.x,c[f+1]+=p.y,c[f+2]+=p.z,c[h]+=p.x,c[h+1]+=p.y,c[h+2]+=p.z}}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),l.fromArray(b,d+3),m.fromArray(b,d+6),p.subVectors(m,l),n.subVectors(k,l),p.cross(n),c[d]=p.x,c[d+1]=p.y,c[d+2]=p.z,c[d+3]=p.x,c[d+
4]=p.y,c[d+5]=p.z,c[d+6]=p.x,c[d+7]=p.y,c[d+8]=p.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){p.fromArray(d,3*a);n.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);s.fromArray(g,2*b);u.fromArray(g,2*c);x=n.x-p.x;v=q.x-p.x;A=n.y-p.y;y=q.y-p.y;G=n.z-p.z;H=q.z-p.z;w=s.x-t.x;B=u.x-t.x;I=s.y-t.y;D=u.y-t.y;z=1/(w*D-B*I);Q.set((D*x-I*v)*z,(D*A-I*y)*z,(D*G-I*H)*z);F.set((w*v-B*x)*z,(w*y-B*A)*z,(w*H-B*G)*z);k[a].add(Q);k[b].add(Q);k[c].add(Q);l[a].add(F);
l[b].add(F);l[c].add(F)}function b(a){qa.fromArray(e,3*a);$.copy(qa);ga=k[a];T.copy(ga);T.sub(qa.multiplyScalar(qa.dot(ga))).normalize();K.crossVectors($,ga);ra=K.dot(l[a]);ja=0>ra?-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("THREE.BufferGeometry: 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=[],l=[],m=0;m<f;m++)k[m]=new THREE.Vector3,l[m]=new THREE.Vector3;var p=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,x,v,A,y,G,H,w,B,I,D,z,Q=
new THREE.Vector3,F=new THREE.Vector3,E,C,J,M,R;0===this.drawcalls.length&&this.addDrawCall(0,c.length);var U=this.drawcalls,m=0;for(C=U.length;m<C;++m){E=U[m].start;J=U[m].count;var S=U[m].index,f=E;for(E+=J;f<E;f+=3)J=S+c[f],M=S+c[f+1],R=S+c[f+2],a(J,M,R)}var T=new THREE.Vector3,K=new THREE.Vector3,qa=new THREE.Vector3,$=new THREE.Vector3,ja,ga,ra,m=0;for(C=U.length;m<C;++m)for(E=U[m].start,J=U[m].count,S=U[m].index,f=E,E+=J;f<E;f+=3)J=S+c[f],M=S+c[f+1],R=S+c[f+2],b(J),b(M),b(R)}},computeOffsets:function(a){void 0===
b.lineDistances.length===b.vertices.length&&(a=new THREE.Float32Attribute(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances)));null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone());null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a instanceof THREE.Mesh&&b instanceof THREE.Geometry&&this.fromGeometry(b);return this},updateFromObject:function(a){var b=a.geometry;if(a instanceof THREE.Mesh){a=b.__directGeometry;if(void 0===a)return this.fromGeometry(b);
a.verticesNeedUpdate=b.verticesNeedUpdate;a.normalsNeedUpdate=b.normalsNeedUpdate;a.colorsNeedUpdate=b.colorsNeedUpdate;a.uvsNeedUpdate=b.uvsNeedUpdate;a.tangentsNeedUpdate=b.tangentsNeedUpdate;b.verticesNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.tangentsNeedUpdate=!1;b=a}!0===b.verticesNeedUpdate&&(a=this.attributes.position,void 0!==a&&(a.copyVector3sArray(b.vertices),a.needsUpdate=!0),b.verticesNeedUpdate=!1);!0===b.normalsNeedUpdate&&(a=this.attributes.normal,
void 0!==a&&(a.copyVector3sArray(b.normals),a.needsUpdate=!0),b.normalsNeedUpdate=!1);!0===b.colorsNeedUpdate&&(a=this.attributes.color,void 0!==a&&(a.copyColorsArray(b.colors),a.needsUpdate=!0),b.colorsNeedUpdate=!1);!0===b.tangentsNeedUpdate&&(a=this.attributes.tangent,void 0!==a&&(a.copyVector4sArray(b.tangents),a.needsUpdate=!0),b.tangentsNeedUpdate=!1);b.lineDistancesNeedUpdate&&(a=this.attributes.lineDistance,void 0!==a&&(a.copyArray(b.lineDistances),a.needsUpdate=!0),b.lineDistancesNeedUpdate=
!1);return this},fromGeometry:function(a){a.__directGeometry=(new THREE.DirectGeometry).fromGeometry(a);return this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){var b=new Float32Array(3*a.vertices.length);this.addAttribute("position",(new THREE.BufferAttribute(b,3)).copyVector3sArray(a.vertices));0<a.normals.length&&(b=new Float32Array(3*a.normals.length),this.addAttribute("normal",(new THREE.BufferAttribute(b,3)).copyVector3sArray(a.normals)));0<a.colors.length&&(b=new Float32Array(3*
a.colors.length),this.addAttribute("color",(new THREE.BufferAttribute(b,3)).copyColorsArray(a.colors)));0<a.uvs.length&&(b=new Float32Array(2*a.uvs.length),this.addAttribute("uv",(new THREE.BufferAttribute(b,2)).copyVector2sArray(a.uvs)));0<a.uvs2.length&&(b=new Float32Array(2*a.uvs2.length),this.addAttribute("uv2",(new THREE.BufferAttribute(b,2)).copyVector2sArray(a.uvs2)));0<a.tangents.length&&(b=new Float32Array(4*a.tangents.length),this.addAttribute("tangent",(new THREE.BufferAttribute(b,4)).copyVector4sArray(a.tangents)));
0<a.indices.length&&(b=new Uint16Array(3*a.indices.length),this.addAttribute("index",(new THREE.BufferAttribute(b,1)).copyIndicesArray(a.indices)));if(0<a.morphTargets.length)for(var b=a.morphTargets,c=0,d=b.length;c<d;c++){var e=b[c],g=new THREE.Float32Attribute(3*e.length,3);this.morphAttributes.push(g.copyVector3sArray(e))}0<a.skinIndices.length&&(b=new THREE.Float32Attribute(4*a.skinIndices.length,4),this.addAttribute("skinIndex",b.copyVector4sArray(a.skinIndices)));0<a.skinWeights.length&&(b=
new THREE.Float32Attribute(4*a.skinWeights.length,4),this.addAttribute("skinWeight",b.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());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.fromArray(b,d),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.',this)}}(),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.fromArray(c,e),a.expandByPoint(b);a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.fromArray(c,e),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.',
this)}}}(),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=new THREE.Vector3,l=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3;if(a.index){var q=a.index.array;0===this.drawcalls.length&&this.addDrawCall(0,
q.length);for(var t=0,s=this.drawcalls.length;t<s;++t){e=this.drawcalls[t].start;g=this.drawcalls[t].count;for(var u=this.drawcalls[t].index,d=e,e=e+g;d<e;d+=3)g=3*(u+q[d]),f=3*(u+q[d+1]),h=3*(u+q[d+2]),k.fromArray(b,g),l.fromArray(b,f),m.fromArray(b,h),p.subVectors(m,l),n.subVectors(k,l),p.cross(n),c[g]+=p.x,c[g+1]+=p.y,c[g+2]+=p.z,c[f]+=p.x,c[f+1]+=p.y,c[f+2]+=p.z,c[h]+=p.x,c[h+1]+=p.y,c[h+2]+=p.z}}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),l.fromArray(b,d+3),m.fromArray(b,d+6),p.subVectors(m,
l),n.subVectors(k,l),p.cross(n),c[d]=p.x,c[d+1]=p.y,c[d+2]=p.z,c[d+3]=p.x,c[d+4]=p.y,c[d+5]=p.z,c[d+6]=p.x,c[d+7]=p.y,c[d+8]=p.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){p.fromArray(d,3*a);n.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);s.fromArray(g,2*b);u.fromArray(g,2*c);x=n.x-p.x;v=q.x-p.x;A=n.y-p.y;y=q.y-p.y;G=n.z-p.z;H=q.z-p.z;w=s.x-t.x;B=u.x-t.x;I=s.y-t.y;D=u.y-t.y;z=1/(w*D-B*I);Q.set((D*x-I*v)*z,(D*A-I*y)*z,(D*G-I*H)*z);F.set((w*
v-B*x)*z,(w*y-B*A)*z,(w*H-B*G)*z);k[a].add(Q);k[b].add(Q);k[c].add(Q);l[a].add(F);l[b].add(F);l[c].add(F)}function b(a){qa.fromArray(e,3*a);$.copy(qa);ga=k[a];T.copy(ga);T.sub(qa.multiplyScalar(qa.dot(ga))).normalize();K.crossVectors($,ga);ra=K.dot(l[a]);ja=0>ra?-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("THREE.BufferGeometry: 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=[],l=[],m=0;m<f;m++)k[m]=new THREE.Vector3,l[m]=new THREE.Vector3;var p=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,x,v,A,y,G,H,
w,B,I,D,z,Q=new THREE.Vector3,F=new THREE.Vector3,E,C,J,M,R;0===this.drawcalls.length&&this.addDrawCall(0,c.length);var U=this.drawcalls,m=0;for(C=U.length;m<C;++m){E=U[m].start;J=U[m].count;var S=U[m].index,f=E;for(E+=J;f<E;f+=3)J=S+c[f],M=S+c[f+1],R=S+c[f+2],a(J,M,R)}var T=new THREE.Vector3,K=new THREE.Vector3,qa=new THREE.Vector3,$=new THREE.Vector3,ja,ga,ra,m=0;for(C=U.length;m<C;++m)for(E=U[m].start,J=U[m].count,S=U[m].index,f=E,E+=J;f<E;f+=3)J=S+c[f],M=S+c[f+1],R=S+c[f+2],b(J),b(M),b(R)}},computeOffsets:function(a){void 0===
a&&(a=THREE.BufferGeometry.MaxIndex);for(var b=this.attributes.index.array,c=this.attributes.position.array,d=b.length/3,e=new (65535<c.length/3&&65535<THREE.BufferGeometry.MaxIndex?Uint32Array:Uint16Array)(b.length),g=0,f=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,m=0,p=new Int32Array(6),n=new Int32Array(c.length),q=new Int32Array(c.length),t=0;t<c.length;t++)n[t]=-1,q[t]=-1;for(c=0;c<d;c++){for(var s=m=0;3>s;s++)t=b[3*c+s],-1===n[t]?(p[2*s]=t,p[2*s+1]=-1,m++):n[t]<k.index?(p[2*s]=t,p[2*s+1]=-1,
l++):(p[2*s]=t,p[2*s+1]=n[t]);if(f+m>k.index+a)for(k={start:g,count:0,index:f},h.push(k),m=0;6>m;m+=2)s=p[m+1],-1<s&&s<k.index&&(p[m+1]=-1);for(m=0;6>m;m+=2)t=p[m],s=p[m+1],-1===s&&(s=f++),n[t]=s,q[s]=t,e[g++]=s-k.index,k.count++}this.reorderBuffers(e,q,f);this.clearDrawCalls();for(a=0;a<h.length;a++)b=h[a],this.addDrawCall(b.start,b.count,b.index)},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",
a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,g=a.attributes[d],f=g.array,h=0,g=g.itemSize*b;h<f.length;h++,g++)e[g]=f[h];return this}},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*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册