From 45c1747176cd533cf6eb2c55cb65d5c16dc9b0e4 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 28 Apr 2014 12:50:18 -0400 Subject: [PATCH] Updated builds. --- build/three.js | 60 ++++++++++++++++++++++++++++------------------ build/three.min.js | 18 +++++++------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/build/three.js b/build/three.js index 483a932462..af62100c8e 100644 --- a/build/three.js +++ b/build/three.js @@ -9014,24 +9014,32 @@ THREE.BufferAttribute.prototype = { this.array.set( value ); + return this; + }, setX: function ( index, x ) { this.array[ index * this.itemSize ] = x; + return this; + }, setY: function ( index, y ) { this.array[ index * this.itemSize + 1 ] = y; + return this; + }, setZ: function ( index, z ) { this.array[ index * this.itemSize + 2 ] = z; + return this; + }, setXY: function ( index, x, y ) { @@ -9041,6 +9049,8 @@ THREE.BufferAttribute.prototype = { this.array[ index ] = x; this.array[ index + 1 ] = y; + return this; + }, setXYZ: function ( index, x, y, z ) { @@ -9051,6 +9061,8 @@ THREE.BufferAttribute.prototype = { this.array[ index + 1 ] = y; this.array[ index + 2 ] = z; + return this; + }, setXYZW: function ( index, x, y, z, w ) { @@ -9062,87 +9074,89 @@ THREE.BufferAttribute.prototype = { this.array[ index + 2 ] = z; this.array[ index + 3 ] = w; + return this; + } }; // -THREE.Int8Attribute = function ( size, itemSize ) { +THREE.Int8Attribute = function ( data, itemSize ) { - this.array = new Int8Array( size * itemSize ); + this.array = new Int8Array( data ); this.itemSize = itemSize; }; THREE.Int8Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Uint8Attribute = function ( size, itemSize ) { +THREE.Uint8Attribute = function ( data, itemSize ) { - this.array = new Uint8Array( size * itemSize ); + this.array = new Uint8Array( data ); this.itemSize = itemSize; }; THREE.Uint8Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Uint8ClampedAttribute = function ( size, itemSize ) { +THREE.Uint8ClampedAttribute = function ( data, itemSize ) { - this.array = new Uint8ClampedArray( size * itemSize ); + this.array = new Uint8ClampedArray( data ); this.itemSize = itemSize; }; THREE.Uint8ClampedAttribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Int16Attribute = function ( size, itemSize ) { +THREE.Int16Attribute = function ( data, itemSize ) { - this.array = new Int16Array( size * itemSize ); + this.array = new Int16Array( data ); this.itemSize = itemSize; }; THREE.Int16Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Uint16Attribute = function ( size, itemSize ) { +THREE.Uint16Attribute = function ( data, itemSize ) { - this.array = new Uint16Array( size * itemSize ); + this.array = new Uint16Array( data ); this.itemSize = itemSize; }; THREE.Uint16Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Int32Attribute = function ( size, itemSize ) { +THREE.Int32Attribute = function ( data, itemSize ) { - this.array = new Int32Array( size * itemSize ); + this.array = new Int32Array( data ); this.itemSize = itemSize; }; THREE.Int32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Uint32Attribute = function ( size, itemSize ) { +THREE.Uint32Attribute = function ( data, itemSize ) { - this.array = new Uint32Array( size * itemSize ); + this.array = new Uint32Array( data ); this.itemSize = itemSize; }; THREE.Uint32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Float32Attribute = function ( size, itemSize ) { +THREE.Float32Attribute = function ( data, itemSize ) { - this.array = new Float32Array( size * itemSize ); + this.array = new Float32Array( data ); this.itemSize = itemSize; }; THREE.Float32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype ); -THREE.Float64Attribute = function ( size, itemSize ) { +THREE.Float64Attribute = function ( data, itemSize ) { - this.array = new Float64Array( size * itemSize ); + this.array = new Float64Array( data ); this.itemSize = itemSize; }; @@ -16311,7 +16325,7 @@ THREE.LOD.prototype.clone = function ( object ) { THREE.Sprite = ( function () { - var vertices = new THREE.Float32Attribute( 3, 3 ); + var vertices = new THREE.Float32Attribute( 3 * 3, 3 ); vertices.set( [ - 0.5, - 0.5, 0, 0.5, - 0.5, 0, 0.5, 0.5, 0 ] ); var geometry = new THREE.BufferGeometry(); @@ -35673,7 +35687,7 @@ THREE.EdgesHelper = function ( object, hex ) { } - geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2, 3 ) ); + geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2 * 3, 3 ) ); var coords = geometry.attributes.position.array; @@ -36331,7 +36345,7 @@ THREE.WireframeHelper = function ( object, hex ) { } - geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2, 3 ) ); + geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2 * 3, 3 ) ); var coords = geometry.attributes.position.array; @@ -36391,7 +36405,7 @@ THREE.WireframeHelper = function ( object, hex ) { } - geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2, 3 ) ); + geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2 * 3, 3 ) ); var coords = geometry.attributes.position.array; @@ -36415,7 +36429,7 @@ THREE.WireframeHelper = function ( object, hex ) { var numEdges = vertices.length / 3; var numTris = numEdges / 3; - geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2, 3 ) ); + geometry.addAttribute( 'position', new THREE.Float32Attribute( numEdges * 2 * 3, 3 ) ); var coords = geometry.attributes.position.array; diff --git a/build/three.min.js b/build/three.min.js index f11235a2e1..0e64587d80 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -182,11 +182,11 @@ ma;s.z=(ia.positionScreen.z+Z.positionScreen.z+qa.positionScreen.z)/3;K.elements w.vertexColors[1].copy(r.geometry.colors[H-1])),K.elements.push(w)))}else r instanceof THREE.Sprite&&(F.set(U.elements[12],U.elements[13],U.elements[14],1),F.applyMatrix4(Y),p=1/F.w,F.z*=p,-1<=F.z&&1>=F.z&&(N===B?(y=new THREE.RenderableSprite,J.push(y),B++,N++,x=y):x=J[N++],x.id=r.id,x.x=F.x*p,x.y=F.y*p,x.z=F.z,x.object=r,x.rotation=r.rotation,x.scale.x=r.scale.x*Math.abs(x.x-(F.x+h.projectionMatrix.elements[0])/(F.w+h.projectionMatrix.elements[12])),x.scale.y=r.scale.y*Math.abs(x.y-(F.y+h.projectionMatrix.elements[5])/ (F.w+h.projectionMatrix.elements[13])),x.material=r.material,K.elements.push(x)));!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;bb.max.x&&(b.max.x=e);fb.max.y&&(b.max.y=f);gb.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=== @@ -322,7 +322,7 @@ THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/th (this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b}; THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=0;c=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;dt;t++){d[0]=s[g[t]];d[1]=s[g[(t+1)%3]];d.sort(f);var r=d.toString();void 0===e[r]?(e[r]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[r].face2=q}h.addAttribute("position",new THREE.Float32Attribute(2*n,3));d=h.attributes.position.array; +THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var l=k.vertices,k=k.faces,n=0,q=0,p=k.length;qt;t++){d[0]=s[g[t]];d[1]=s[g[(t+1)%3]];d.sort(f);var r=d.toString();void 0===e[r]?(e[r]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[r].face2=q}h.addAttribute("position",new THREE.Float32Attribute(6*n,3));d=h.attributes.position.array; f=0;for(r in e)if(g=e[r],void 0===g.face2||0.9999>k[g.face1].normal.dot(k[g.face2].normal))n=l[g.vert1],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z,n=l[g.vert2],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;cb;b++)a.faces[b].color=this.colors[4>b?0:1];b=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(a,b);this.add(this.lightSphere); @@ -689,9 +689,9 @@ THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype); THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;kr;r++){d[0]=t[g[r]];d[1]=t[g[(r+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",new THREE.Float32Attribute(2*n,3));d= +h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,l=a.geometry.faces,n=0,q=new Uint32Array(6*l.length),p=0,s=l.length;pr;r++){d[0]=t[g[r]];d[1]=t[g[(r+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",new THREE.Float32Attribute(6*n,3));d= h.attributes.position.array;p=0;for(s=n;pr;r++)n=k[q[2*p+r]],g=6*p+3*r,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,s=a.geometry.attributes.index.array,l=a.geometry.offsets,n=0,q=new Uint32Array(2*s.length),t=0,w=l.length;tr;r++)d[0]=g+s[p+r],d[1]=g+s[p+(r+1)%3],d.sort(f),v=d.toString(), -void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",new THREE.Float32Attribute(2*n,3));d=h.attributes.position.array;p=0;for(s=n;pr;r++)g=6*p+3*r,n=3*q[2*p+r],d[g+0]=k[n],d[g+1]=k[n+1],d[g+2]=k[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,n=k.length/3,q=n/3,h.addAttribute("position",new THREE.Float32Attribute(2*n,3)),d=h.attributes.position.array,p=0,s=q;pr;r++)g=18*p+6*r,q=9*p+3*r, +void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",new THREE.Float32Attribute(6*n,3));d=h.attributes.position.array;p=0;for(s=n;pr;r++)g=6*p+3*r,n=3*q[2*p+r],d[g+0]=k[n],d[g+1]=k[n+1],d[g+2]=k[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,n=k.length/3,q=n/3,h.addAttribute("position",new THREE.Float32Attribute(6*n,3)),d=h.attributes.position.array,p=0,s=q;pr;r++)g=18*p+6*r,q=9*p+3*r, d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],n=9*p+(r+1)%3*3,d[g+3]=k[n],d[g+4]=k[n+1],d[g+5]=k[n+2];THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype); THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})}; THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a