Browse Source

Updated builds.

Mr.doob 11 years ago
parent
commit
c3f82b7d20
2 changed files with 20 additions and 15 deletions
  1. 12 7
      build/three.js
  2. 8 8
      build/three.min.js

+ 12 - 7
build/three.js

@@ -8909,16 +8909,9 @@ THREE.BufferGeometry = function () {
 
 
 	this.name = '';
 	this.name = '';
 
 
-	// attributes
-
 	this.attributes = {};
 	this.attributes = {};
-
-	// offsets for chunks when using indexed elements
-
 	this.offsets = [];
 	this.offsets = [];
 
 
-	// boundings
-
 	this.boundingBox = null;
 	this.boundingBox = null;
 	this.boundingSphere = null;
 	this.boundingSphere = null;
 
 
@@ -8960,6 +8953,18 @@ THREE.BufferGeometry.prototype = {
 
 
 	},
 	},
 
 
+	addDrawCall: function ( start, count, indexOffset ) {
+
+		this.offsets.push( {
+
+			start: start,
+			count: count,
+			index: indexOffset !== undefined ? indexOffset : 0
+
+		} );
+
+	},
+
 	applyMatrix: function ( matrix ) {
 	applyMatrix: function ( matrix ) {
 
 
 		var position = this.attributes.position;
 		var position = this.attributes.position;

+ 8 - 8
build/three.min.js

@@ -182,14 +182,14 @@ x=D.length;r<x;r+=2)W.pushLine(D[r],D[r+1]);else for(r=0,x=C.length/3-1;r<x;r++)
 ba.w),w=c(),w.id=q.id,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(ba),w.z=Math.max(N.z,ba.z),w.material=q.material,q.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(q.geometry.colors[la]),w.vertexColors[1].copy(q.geometry.colors[la-1])),L.elements.push(w)))}else q instanceof THREE.Sprite&&(B.set(S.elements[12],S.elements[13],S.elements[14],1),B.applyMatrix4(X),r=1/B.w,B.z*=r,-1<=B.z&&1>=B.z&&(I===E?(x=new THREE.RenderableSprite,F.push(x),E++,I++,G=x):G=F[I++],G.id=q.id,
 ba.w),w=c(),w.id=q.id,w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(ba),w.z=Math.max(N.z,ba.z),w.material=q.material,q.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(q.geometry.colors[la]),w.vertexColors[1].copy(q.geometry.colors[la-1])),L.elements.push(w)))}else q instanceof THREE.Sprite&&(B.set(S.elements[12],S.elements[13],S.elements[14],1),B.applyMatrix4(X),r=1/B.w,B.z*=r,-1<=B.z&&1>=B.z&&(I===E?(x=new THREE.RenderableSprite,F.push(x),E++,I++,G=x):G=F[I++],G.id=q.id,
 G.x=B.x*r,G.y=B.y*r,G.z=B.z,G.object=q,G.rotation=q.rotation,G.scale.x=q.scale.x*Math.abs(G.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),G.scale.y=q.scale.y*Math.abs(G.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),G.material=q.material,L.elements.push(G)));!0===l&&L.elements.sort(d);return L}};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};
 G.x=B.x*r,G.y=B.y*r,G.z=B.z,G.object=q,G.rotation=q.rotation,G.scale.x=q.scale.x*Math.abs(G.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),G.scale.y=q.scale.y*Math.abs(G.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),G.material=q.material,L.elements.push(G)));!0===l&&L.elements.sort(d);return L}};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.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]},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,t=new THREE.Vector3,q=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var x=u[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],t.set(l,n,p),q.subVectors(t,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],t.set(l,n,p),q.subVectors(t,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];t=d[3*b];q=d[3*b+1];v=d[3*b+2];w=d[3*c];u=d[3*c+1];x=d[3*c+2];H=f[2*a];G=f[2*a+1];I=f[2*b];F=f[2*b+1];E=f[2*c];L=f[2*c+1];A=t-p;y=w-p;J=q-r;D=u-r;B=v-s;C=x-s;Q=I-H;z=E-H;K=F-G;X=L-G;S=1/(Q*X-z*K);ja.set((X*A-K*y)*S,(X*J-K*D)*S,(X*B-K*C)*S);ca.set((Q*y-z*A)*S,(Q*D-z*J)*S,(Q*C-z*B)*S);k[a].add(ja);k[b].add(ja);k[c].add(ja);
-l[a].add(ca);l[b].add(ca);l[c].add(ca)}function b(a){ga.x=e[3*a];ga.y=e[3*a+1];ga.z=e[3*a+2];Oa.copy(ga);aa=k[a];ea.copy(aa);ea.sub(ga.multiplyScalar(ga.dot(aa))).normalize();Ja.crossVectors(Oa,aa);Ha=Ja.dot(l[a]);Ga=0>Ha?-1:1;h[4*a]=ea.x;h[4*a+1]=ea.y;h[4*a+2]=ea.z;h[4*a+3]=Ga}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()");
+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,t=new THREE.Vector3,q=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;g=u[c].count;var x=u[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],t.set(l,
+n,p),q.subVectors(t,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],t.set(l,n,p),q.subVectors(t,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];t=d[3*b];q=d[3*b+1];v=d[3*b+2];w=d[3*c];u=d[3*c+1];x=d[3*c+2];H=f[2*a];G=f[2*a+1];I=f[2*b];F=f[2*b+1];E=f[2*c];L=f[2*c+1];A=t-p;y=w-p;J=q-r;D=u-r;B=v-s;C=x-s;Q=I-H;z=E-H;K=F-G;X=L-G;S=1/(Q*X-z*K);ja.set((X*A-K*y)*S,(X*J-K*D)*S,(X*B-K*C)*S);ca.set((Q*
+y-z*A)*S,(Q*D-z*J)*S,(Q*C-z*B)*S);k[a].add(ja);k[b].add(ja);k[c].add(ja);l[a].add(ca);l[b].add(ca);l[c].add(ca)}function b(a){ga.x=e[3*a];ga.y=e[3*a+1];ga.z=e[3*a+2];Oa.copy(ga);aa=k[a];ea.copy(aa);ea.sub(ga.multiplyScalar(ga.dot(aa))).normalize();Ja.crossVectors(Oa,aa);Ha=Ja.dot(l[a]);Ga=0>Ha?-1:1;h[4*a]=ea.x;h[4*a+1]=ea.y;h[4*a+2]=ea.z;h[4*a+3]=Ga}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,t,q,v,w,u,x,H,G,I,F,E,L,A,y,J,D,B,C,Q,z,K,X,S,ja=new THREE.Vector3,ca=new THREE.Vector3,R,N,ba,ka,W,ta=this.offsets,n=0;for(N=ta.length;n<N;++n){R=
 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,t,q,v,w,u,x,H,G,I,F,E,L,A,y,J,D,B,C,Q,z,K,X,S,ja=new THREE.Vector3,ca=new THREE.Vector3,R,N,ba,ka,W,ta=this.offsets,n=0;for(N=ta.length;n<N;++n){R=
 ta[n].start;ba=ta[n].count;var P=ta[n].index,g=R;for(R+=ba;g<R;g+=3)ba=P+c[g],ka=P+c[g+1],W=P+c[g+2],a(ba,ka,W)}var ea=new THREE.Vector3,Ja=new THREE.Vector3,ga=new THREE.Vector3,Oa=new THREE.Vector3,Ga,aa,Ha,n=0;for(N=ta.length;n<N;++n)for(R=ta[n].start,ba=ta[n].count,P=ta[n].index,g=R,R+=ba;g<R;g+=3)ba=P+c[g],ka=P+c[g+1],W=P+c[g+2],b(ba),b(ka),b(W)}},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/
 ta[n].start;ba=ta[n].count;var P=ta[n].index,g=R;for(R+=ba;g<R;g+=3)ba=P+c[g],ka=P+c[g+1],W=P+c[g+2],a(ba,ka,W)}var ea=new THREE.Vector3,Ja=new THREE.Vector3,ga=new THREE.Vector3,Oa=new THREE.Vector3,Ga,aa,Ha,n=0;for(N=ta.length;n<N;++n)for(R=ta[n].start,ba=ta[n].count,P=ta[n].index,g=R,R+=ba;g<R;g+=3)ba=P+c[g],ka=P+c[g+1],W=P+c[g+2],b(ba),b(ka),b(W)}},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),t=0;t<c.length;t++)r[t]=-1,s[t]=-1;for(c=0;c<d;c++){for(var q=n=0;3>q;q++)t=a[3*c+q],-1==r[t]?(p[2*q]=t,p[2*q+1]=-1,n++):r[t]<k.index?(p[2*q]=t,p[2*q+1]=-1,l++):(p[2*q]=t,p[2*q+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)q=p[n+1],-1<q&&q<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)t=p[n],q=p[n+1],-1===q&&(q=g++),
 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),t=0;t<c.length;t++)r[t]=-1,s[t]=-1;for(c=0;c<d;c++){for(var q=n=0;3>q;q++)t=a[3*c+q],-1==r[t]?(p[2*q]=t,p[2*q+1]=-1,n++):r[t]<k.index?(p[2*q]=t,p[2*q+1]=-1,l++):(p[2*q]=t,p[2*q+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)q=p[n+1],-1<q&&q<k.index&&(p[n+1]=-1);for(n=0;6>n;n+=2)t=p[n],q=p[n+1],-1===q&&(q=g++),