Mr.doob 5 éve
szülő
commit
59d05c2d6a
3 módosított fájl, 14 hozzáadás és 10 törlés
  1. 3 1
      build/three.js
  2. 8 8
      build/three.min.js
  3. 3 1
      build/three.module.js

+ 3 - 1
build/three.js

@@ -24187,7 +24187,7 @@
 
 			if ( object.isInstancedMesh ) {
 
-				renderer.renderInstances( geometry, drawStart, drawCount, object.instanceMatrix.count );
+				renderer.renderInstances( geometry, drawStart, drawCount, object.count );
 
 			} else if ( geometry.isInstancedBufferGeometry ) {
 
@@ -27032,6 +27032,8 @@
 
 		this.instanceMatrix = new BufferAttribute( new Float32Array( count * 16 ), 16 );
 
+		this.count = count;
+
 	}
 
 	InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {

+ 8 - 8
build/three.min.js

@@ -217,7 +217,7 @@ for(w in l){var p=l[w];if(0<=p){var t=m[w];if(void 0!==t){var n=t.normalized,v=t
 (ba.enableAttributeAndDivisor(p,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ba.enableAttribute(p),J.bindBuffer(34962,y),J.vertexAttribPointer(p,v,z,n,0,0)}}else if("instanceMatrix"===w)x=pa.get(f.instanceMatrix),void 0!==x&&(y=x.buffer,z=x.type,ba.enableAttributeAndDivisor(p+0,1),ba.enableAttributeAndDivisor(p+1,1),ba.enableAttributeAndDivisor(p+2,1),ba.enableAttributeAndDivisor(p+3,1),J.bindBuffer(34962,y),J.vertexAttribPointer(p+0,4,z,!1,64,
 0),J.vertexAttribPointer(p+1,4,z,!1,64,16),J.vertexAttribPointer(p+2,4,z,!1,64,32),J.vertexAttribPointer(p+3,4,z,!1,64,48));else if(void 0!==r&&(n=r[w],void 0!==n))switch(n.length){case 2:J.vertexAttrib2fv(p,n);break;case 3:J.vertexAttrib3fv(p,n);break;case 4:J.vertexAttrib4fv(p,n);break;default:J.vertexAttrib1fv(p,n)}}}ba.disableUnusedAttributes()}null!==h&&J.bindBuffer(34963,u.buffer)}u=Infinity;null!==h?u=h.count:void 0!==q&&(u=q.count);h=d.drawRange.start*c;q=null!==g?g.start*c:0;var w=Math.max(h,
 q);g=Math.max(0,Math.min(u,h+d.drawRange.count*c,q+(null!==g?g.count*c:Infinity))-1-w+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ba.setLineWidth(e.wireframeLinewidth*(null===N?fa:1)),a.setMode(1);else switch(f.drawMode){case 0:a.setMode(4);break;case 1:a.setMode(5);break;case 2:a.setMode(6)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ba.setLineWidth(e*(null===N?fa:1)),f.isLineSegments?a.setMode(1):f.isLineLoop?a.setMode(2):a.setMode(3)):f.isPoints?a.setMode(0):f.isSprite&&a.setMode(4);f.isInstancedMesh?
-a.renderInstances(d,w,g,f.instanceMatrix.count):d.isInstancedBufferGeometry?a.renderInstances(d,w,g,d.maxInstancedCount):a.render(w,g)}};this.compile=function(a,b){D=ua.get(a,b);D.init();a.traverse(function(a){a.isLight&&(D.pushLight(a),a.castShadow&&D.pushShadow(a))});D.setupLights(b);a.traverse(function(b){if(b.material)if(Array.isArray(b.material))for(var c=0;c<b.material.length;c++)u(b.material[c],a.fog,b);else u(b.material,a.fog,b)})};var Ca=null,za=new Xf;za.setAnimationLoop(function(a){ka.isPresenting()||
+a.renderInstances(d,w,g,f.count):d.isInstancedBufferGeometry?a.renderInstances(d,w,g,d.maxInstancedCount):a.render(w,g)}};this.compile=function(a,b){D=ua.get(a,b);D.init();a.traverse(function(a){a.isLight&&(D.pushLight(a),a.castShadow&&D.pushShadow(a))});D.setupLights(b);a.traverse(function(b){if(b.material)if(Array.isArray(b.material))for(var c=0;c<b.material.length;c++)u(b.material[c],a.fog,b);else u(b.material,a.fog,b)})};var Ca=null,za=new Xf;za.setAnimationLoop(function(a){ka.isPresenting()||
 Ca&&Ca(a)});"undefined"!==typeof window&&za.setContext(window);this.setAnimationLoop=function(a){Ca=a;ka.setAnimationLoop(a);za.start()};this.render=function(a,c,d,e){if(void 0!==d){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");var f=d}if(void 0!==e){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");var g=e}c&&c.isCamera?O||(bc=b=null,S=!1,ha=-1,Q=null,!0===a.autoUpdate&&
 a.updateMatrixWorld(),null===c.parent&&c.updateMatrixWorld(),ka.enabled&&(c=ka.getCamera(c)),D=ua.get(a,c),D.init(),a.onBeforeRender(F,a,c,f||N),Id.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),cg.setFromMatrix(Id),qa=this.localClippingEnabled,He=Oa.init(this.clippingPlanes,qa,c),G=va.get(a,c),G.init(),l(a,c,0,F.sortObjects),!0===F.sortObjects&&G.sort(),He&&Oa.beginShadows(),Da.render(D.state.shadowsArray,a,c),D.setupLights(c),He&&Oa.endShadows(),this.info.autoReset&&this.info.reset(),
 void 0!==f&&this.setRenderTarget(f),ka.enabled&&ta.isAvailable()&&ta.attachCamera(c),ma.render(G,a,c,g),d=G.opaque,e=G.transparent,a.overrideMaterial?(f=a.overrideMaterial,d.length&&m(d,a,c,f),e.length&&m(e,a,c,f)):(d.length&&m(d,a,c),e.length&&m(e,a,c)),a.onAfterRender(F,a,c),null!==N&&(R.updateRenderTargetMipmap(N),R.updateMultisampleRenderTarget(N)),ba.buffers.depth.setTest(!0),ba.buffers.depth.setMask(!0),ba.buffers.color.setMask(!0),ba.setPolygonOffset(!1),ka.enabled&&(ta.isAvailable()&&ta.detachCamera(c),
@@ -230,13 +230,13 @@ this.copyFramebufferToTexture=function(a,b,c){var d=b.image.width,e=b.image.heig
 new H(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function Ld(a){B.call(this);this.type="Sprite";if(void 0===Ic){Ic=new E;var b=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new Gb(b,5);Ic.setIndex([0,1,2,0,2,3]);Ic.addAttribute("position",new Kd(b,3,0,!1));Ic.addAttribute("uv",new Kd(b,2,3,!1))}this.geometry=Ic;this.material=void 0!==a?a:new Hb;this.center=new w(.5,.5)}function Ke(a,b,c,d,e,f){Jc.subVectors(a,
 c).addScalar(.5).multiply(d);void 0!==e?(Md.x=f*Jc.x-e*Jc.y,Md.y=e*Jc.x+f*Jc.y):Md.copy(Jc);a.copy(b);a.x+=Md.x;a.y+=Md.y;a.applyMatrix4(Qh)}function Nd(){B.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}});this.autoUpdate=!0}function Od(a,b){a&&a.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");ja.call(this,a,b);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new U;this.bindMatrixInverse=
 new U}function Le(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);this.frame=-1;if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],a=0,b=this.bones.length;a<b;a++)this.boneInverses.push(new U)}function ig(){B.call(this);this.type="Bone"}function jg(a,b,c){ja.call(this,a,b);this.instanceMatrix=new O(new Float32Array(16*
-c),16)}function Q(a){M.call(this);this.type="LineBasicMaterial";this.color=new H(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(a)}function xa(a,b,c){1===c&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");B.call(this);this.type="Line";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Q({color:16777215*Math.random()})}function ca(a,b){xa.call(this,a,b);this.type="LineSegments"}function Me(a,
-b){xa.call(this,a,b);this.type="LineLoop"}function Qa(a){M.call(this);this.type="PointsMaterial";this.color=new H(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(a)}function Kc(a,b){B.call(this);this.type="Points";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Qa({color:16777215*Math.random()});this.updateMorphTargets()}function kg(a,b,c,d,e,f,g){var h=lg.distanceSqToPoint(a);h<c&&(c=new n,lg.closestPointToPoint(a,c),c.applyMatrix4(d),
-a=e.ray.origin.distanceTo(c),a<e.near||a>e.far||f.push({distance:a,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,object:g}))}function mg(a,b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,q,k){W.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a,b,c,d,e,f,g,h,l){W.call(this,
-a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Qd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);W.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){E.call(this);this.type="WireframeGeometry";var b=
-[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d=l.length;m<d;m++){var q=l[m];for(c=0;3>c;c++){var k=q[h[c]];var t=q[h[(c+1)%3]];f[0]=Math.min(k,t);f[1]=Math.max(k,t);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;q=a.index;var r=a.groups;0===r.length&&(r=[{start:0,
-count:q.count,materialIndex:0}]);a=0;for(e=r.length;a<e;++a)for(m=r[a],c=m.start,d=m.count,m=c,d=c+d;m<d;m+=3)for(c=0;3>c;c++)k=q.getX(m+c),t=q.getX(m+(c+1)%3),f[0]=Math.min(k,t),f[1]=Math.max(k,t),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;m<d;m++)for(c=0;3>c;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,
-h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new A(b,3))}function Rd(a,b,c){F.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Nc(a,b,c));this.mergeVertices()}function Nc(a,b,c){E.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,q=new n,k=new n,t,r;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
+c),16);this.count=c}function Q(a){M.call(this);this.type="LineBasicMaterial";this.color=new H(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(a)}function xa(a,b,c){1===c&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");B.call(this);this.type="Line";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Q({color:16777215*Math.random()})}function ca(a,b){xa.call(this,a,b);this.type="LineSegments"}
+function Me(a,b){xa.call(this,a,b);this.type="LineLoop"}function Qa(a){M.call(this);this.type="PointsMaterial";this.color=new H(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(a)}function Kc(a,b){B.call(this);this.type="Points";this.geometry=void 0!==a?a:new E;this.material=void 0!==b?b:new Qa({color:16777215*Math.random()});this.updateMorphTargets()}function kg(a,b,c,d,e,f,g){var h=lg.distanceSqToPoint(a);h<c&&(c=new n,lg.closestPointToPoint(a,
+c),c.applyMatrix4(d),a=e.ray.origin.distanceTo(c),a<e.near||a>e.far||f.push({distance:a,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,object:g}))}function mg(a,b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1}function Lc(a,b,c,d,e,f,g,h,l,m,q,k){W.call(this,null,f,g,h,l,m,d,e,q,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function Pd(a,
+b,c,d,e,f,g,h,l){W.call(this,a,b,c,d,e,f,g,h,l);this.needsUpdate=!0}function Qd(a,b,c,d,e,f,g,h,l,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===m&&(c=1012);void 0===c&&1027===m&&(c=1020);W.call(this,null,d,e,f,g,h,m,c,l);this.image={width:a,height:b};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mc(a){E.call(this);this.type=
+"WireframeGeometry";var b=[],c,d,e,f=[0,0],g={},h=["a","b","c"];if(a&&a.isGeometry){var l=a.faces;var m=0;for(d=l.length;m<d;m++){var q=l[m];for(c=0;3>c;c++){var k=q[h[c]];var t=q[h[(c+1)%3]];f[0]=Math.min(k,t);f[1]=Math.max(k,t);k=f[0]+","+f[1];void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]})}}for(k in g)m=g[k],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new n,null!==a.index){l=a.attributes.position;q=a.index;var r=a.groups;
+0===r.length&&(r=[{start:0,count:q.count,materialIndex:0}]);a=0;for(e=r.length;a<e;++a)for(m=r[a],c=m.start,d=m.count,m=c,d=c+d;m<d;m+=3)for(c=0;3>c;c++)k=q.getX(m+c),t=q.getX(m+(c+1)%3),f[0]=Math.min(k,t),f[1]=Math.max(k,t),k=f[0]+","+f[1],void 0===g[k]&&(g[k]={index1:f[0],index2:f[1]});for(k in g)m=g[k],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;m<d;m++)for(c=0;3>c;c++)g=3*m+c,h.fromBufferAttribute(l,
+g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new A(b,3))}function Rd(a,b,c){F.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Nc(a,b,c));this.mergeVertices()}function Nc(a,b,c){E.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new n,l=new n,m=new n,q=new n,k=new n,t,r;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
 var p=b+1;for(t=0;t<=c;t++){var v=t/c;for(r=0;r<=b;r++){var x=r/b;a(x,v,l);e.push(l.x,l.y,l.z);0<=x-1E-5?(a(x-1E-5,v,m),q.subVectors(l,m)):(a(x+1E-5,v,m),q.subVectors(m,l));0<=v-1E-5?(a(x,v-1E-5,m),k.subVectors(l,m)):(a(x,v+1E-5,m),k.subVectors(m,l));h.crossVectors(q,k).normalize();f.push(h.x,h.y,h.z);g.push(x,v)}}for(t=0;t<c;t++)for(r=0;r<b;r++)a=t*p+r+1,h=(t+1)*p+r+1,l=(t+1)*p+r,d.push(t*p+r,a,l),d.push(a,h,l);this.setIndex(d);this.addAttribute("position",new A(e,3));this.addAttribute("normal",
 new A(f,3));this.addAttribute("uv",new A(g,2))}function Sd(a,b,c,d){F.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};this.fromBufferGeometry(new Ca(a,b,c,d));this.mergeVertices()}function Ca(a,b,c,d){function e(a){h.push(a.x,a.y,a.z)}function f(b,c){b*=3;c.x=a[b+0];c.y=a[b+1];c.z=a[b+2]}function g(a,b,c,d){0>d&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}E.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,
 indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new n,d=new n,g=new n,h=0;h<b.length;h+=3){f(b[h+0],c);f(b[h+1],d);f(b[h+2],g);var l,m,k=c,z=d,y=g,w=Math.pow(2,a),P=[];for(m=0;m<=w;m++){P[m]=[];var C=k.clone().lerp(y,m/w),A=z.clone().lerp(y,m/w),B=w-m;for(l=0;l<=B;l++)P[m][l]=0===l&&m===w?C:C.clone().lerp(A,l/B)}for(m=0;m<w;m++)for(l=0;l<2*(w-m)-1;l++)k=Math.floor(l/2),0===l%2?(e(P[m][k+1]),e(P[m+1][k]),e(P[m][k])):(e(P[m][k+1]),e(P[m+1][k+1]),e(P[m+1][k]))}})(d);(function(a){for(var b=

+ 3 - 1
build/three.module.js

@@ -24174,7 +24174,7 @@ function WebGLRenderer( parameters ) {
 
 		if ( object.isInstancedMesh ) {
 
-			renderer.renderInstances( geometry, drawStart, drawCount, object.instanceMatrix.count );
+			renderer.renderInstances( geometry, drawStart, drawCount, object.count );
 
 		} else if ( geometry.isInstancedBufferGeometry ) {
 
@@ -27019,6 +27019,8 @@ function InstancedMesh( geometry, material, count ) {
 
 	this.instanceMatrix = new BufferAttribute( new Float32Array( count * 16 ), 16 );
 
+	this.count = count;
+
 }
 
 InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {