浏览代码

Updated builds.

Mugen87 1 年之前
父节点
当前提交
a686f406b3
共有 3 个文件被更改,包括 210 次插入4 次删除
  1. 105 2
      build/three.cjs
  2. 105 2
      build/three.module.js
  3. 0 0
      build/three.module.min.js

+ 105 - 2
build/three.cjs

@@ -15655,12 +15655,48 @@ function WebGLBufferRenderer( gl, extensions, info ) {
 
 
 	}
 	}
 
 
+	function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
+
+		if ( drawCount === 0 ) return;
+
+		const extension = extensions.get( 'WEBGL_multi_draw' );
+
+		if ( extension === null ) {
+
+			for ( let i = 0; i < starts.length; i ++ ) {
+
+				renderInstances( starts[ i ], counts[ i ], primcount[ i ] );
+
+			}
+
+		} else {
+
+			extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );
+
+			let elementCount = 0;
+			for ( let i = 0; i < drawCount; i ++ ) {
+
+				elementCount += counts[ i ];
+
+			}
+
+			for ( let i = 0; i < primcount.length; i ++ ) {
+
+				info.update( elementCount, mode, primcount[ i ] );
+
+			}
+
+		}
+
+	}
+
 	//
 	//
 
 
 	this.setMode = setMode;
 	this.setMode = setMode;
 	this.render = render;
 	this.render = render;
 	this.renderInstances = renderInstances;
 	this.renderInstances = renderInstances;
 	this.renderMultiDraw = renderMultiDraw;
 	this.renderMultiDraw = renderMultiDraw;
+	this.renderMultiDrawInstances = renderMultiDrawInstances;
 
 
 }
 }
 
 
@@ -17571,6 +17607,41 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
 
 
 	}
 	}
 
 
+	function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
+
+		if ( drawCount === 0 ) return;
+
+		const extension = extensions.get( 'WEBGL_multi_draw' );
+
+		if ( extension === null ) {
+
+			for ( let i = 0; i < starts.length; i ++ ) {
+
+				renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );
+
+			}
+
+		} else {
+
+			extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );
+
+			let elementCount = 0;
+			for ( let i = 0; i < drawCount; i ++ ) {
+
+				elementCount += counts[ i ];
+
+			}
+
+			for ( let i = 0; i < primcount.length; i ++ ) {
+
+				info.update( elementCount, mode, primcount[ i ] );
+
+			}
+
+		}
+
+	}
+
 	//
 	//
 
 
 	this.setMode = setMode;
 	this.setMode = setMode;
@@ -17578,6 +17649,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
 	this.render = render;
 	this.render = render;
 	this.renderInstances = renderInstances;
 	this.renderInstances = renderInstances;
 	this.renderMultiDraw = renderMultiDraw;
 	this.renderMultiDraw = renderMultiDraw;
+	this.renderMultiDrawInstances = renderMultiDrawInstances;
 
 
 }
 }
 
 
@@ -25576,7 +25648,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 					}
 					}
 
 
-					if ( ignoreDepthValues === true ) {
+					if ( ignoreDepthValues === true && supportsInvalidateFramebuffer ) {
 
 
 						_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
@@ -29009,7 +29081,15 @@ class WebGLRenderer {
 
 
 			if ( object.isBatchedMesh ) {
 			if ( object.isBatchedMesh ) {
 
 
-				renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
+				if ( object._multiDrawInstances !== null ) {
+
+					renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
+
+				} else {
+
+					renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
+
+				}
 
 
 			} else if ( object.isInstancedMesh ) {
 			} else if ( object.isInstancedMesh ) {
 
 
@@ -32780,6 +32860,7 @@ class BatchedMesh extends Mesh {
 		this._multiDrawCounts = new Int32Array( maxGeometryCount );
 		this._multiDrawCounts = new Int32Array( maxGeometryCount );
 		this._multiDrawStarts = new Int32Array( maxGeometryCount );
 		this._multiDrawStarts = new Int32Array( maxGeometryCount );
 		this._multiDrawCount = 0;
 		this._multiDrawCount = 0;
+		this._multiDrawInstances = null;
 		this._visibilityChanged = true;
 		this._visibilityChanged = true;
 
 
 		// Local matrix per geometry by using data texture
 		// Local matrix per geometry by using data texture
@@ -33221,6 +33302,28 @@ class BatchedMesh extends Mesh {
 
 
 	}
 	}
 
 
+	getInstanceCountAt( id ) {
+
+		if ( this._multiDrawInstances === null ) return null;
+
+		return this._multiDrawInstances[ id ];
+
+	}
+
+	setInstanceCountAt( id, instanceCount ) {
+
+		if ( this._multiDrawInstances === null ) {
+
+			this._multiDrawInstances = new Int32Array( this._maxGeometryCount ).fill( 1 );
+
+		}
+
+		this._multiDrawInstances[ id ] = instanceCount;
+
+		return id;
+
+	}
+
 	// get bounding box and compute it if it doesn't exist
 	// get bounding box and compute it if it doesn't exist
 	getBoundingBoxAt( id, target ) {
 	getBoundingBoxAt( id, target ) {
 
 

+ 105 - 2
build/three.module.js

@@ -15653,12 +15653,48 @@ function WebGLBufferRenderer( gl, extensions, info ) {
 
 
 	}
 	}
 
 
+	function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
+
+		if ( drawCount === 0 ) return;
+
+		const extension = extensions.get( 'WEBGL_multi_draw' );
+
+		if ( extension === null ) {
+
+			for ( let i = 0; i < starts.length; i ++ ) {
+
+				renderInstances( starts[ i ], counts[ i ], primcount[ i ] );
+
+			}
+
+		} else {
+
+			extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );
+
+			let elementCount = 0;
+			for ( let i = 0; i < drawCount; i ++ ) {
+
+				elementCount += counts[ i ];
+
+			}
+
+			for ( let i = 0; i < primcount.length; i ++ ) {
+
+				info.update( elementCount, mode, primcount[ i ] );
+
+			}
+
+		}
+
+	}
+
 	//
 	//
 
 
 	this.setMode = setMode;
 	this.setMode = setMode;
 	this.render = render;
 	this.render = render;
 	this.renderInstances = renderInstances;
 	this.renderInstances = renderInstances;
 	this.renderMultiDraw = renderMultiDraw;
 	this.renderMultiDraw = renderMultiDraw;
+	this.renderMultiDrawInstances = renderMultiDrawInstances;
 
 
 }
 }
 
 
@@ -17569,6 +17605,41 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
 
 
 	}
 	}
 
 
+	function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
+
+		if ( drawCount === 0 ) return;
+
+		const extension = extensions.get( 'WEBGL_multi_draw' );
+
+		if ( extension === null ) {
+
+			for ( let i = 0; i < starts.length; i ++ ) {
+
+				renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );
+
+			}
+
+		} else {
+
+			extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );
+
+			let elementCount = 0;
+			for ( let i = 0; i < drawCount; i ++ ) {
+
+				elementCount += counts[ i ];
+
+			}
+
+			for ( let i = 0; i < primcount.length; i ++ ) {
+
+				info.update( elementCount, mode, primcount[ i ] );
+
+			}
+
+		}
+
+	}
+
 	//
 	//
 
 
 	this.setMode = setMode;
 	this.setMode = setMode;
@@ -17576,6 +17647,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
 	this.render = render;
 	this.render = render;
 	this.renderInstances = renderInstances;
 	this.renderInstances = renderInstances;
 	this.renderMultiDraw = renderMultiDraw;
 	this.renderMultiDraw = renderMultiDraw;
+	this.renderMultiDrawInstances = renderMultiDrawInstances;
 
 
 }
 }
 
 
@@ -25574,7 +25646,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 					}
 					}
 
 
-					if ( ignoreDepthValues === true ) {
+					if ( ignoreDepthValues === true && supportsInvalidateFramebuffer ) {
 
 
 						_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
 						_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );
@@ -29007,7 +29079,15 @@ class WebGLRenderer {
 
 
 			if ( object.isBatchedMesh ) {
 			if ( object.isBatchedMesh ) {
 
 
-				renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
+				if ( object._multiDrawInstances !== null ) {
+
+					renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
+
+				} else {
+
+					renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
+
+				}
 
 
 			} else if ( object.isInstancedMesh ) {
 			} else if ( object.isInstancedMesh ) {
 
 
@@ -32778,6 +32858,7 @@ class BatchedMesh extends Mesh {
 		this._multiDrawCounts = new Int32Array( maxGeometryCount );
 		this._multiDrawCounts = new Int32Array( maxGeometryCount );
 		this._multiDrawStarts = new Int32Array( maxGeometryCount );
 		this._multiDrawStarts = new Int32Array( maxGeometryCount );
 		this._multiDrawCount = 0;
 		this._multiDrawCount = 0;
+		this._multiDrawInstances = null;
 		this._visibilityChanged = true;
 		this._visibilityChanged = true;
 
 
 		// Local matrix per geometry by using data texture
 		// Local matrix per geometry by using data texture
@@ -33219,6 +33300,28 @@ class BatchedMesh extends Mesh {
 
 
 	}
 	}
 
 
+	getInstanceCountAt( id ) {
+
+		if ( this._multiDrawInstances === null ) return null;
+
+		return this._multiDrawInstances[ id ];
+
+	}
+
+	setInstanceCountAt( id, instanceCount ) {
+
+		if ( this._multiDrawInstances === null ) {
+
+			this._multiDrawInstances = new Int32Array( this._maxGeometryCount ).fill( 1 );
+
+		}
+
+		this._multiDrawInstances[ id ] = instanceCount;
+
+		return id;
+
+	}
+
 	// get bounding box and compute it if it doesn't exist
 	// get bounding box and compute it if it doesn't exist
 	getBoundingBoxAt( id, target ) {
 	getBoundingBoxAt( id, target ) {
 
 

文件差异内容过多而无法显示
+ 0 - 0
build/three.module.min.js


部分文件因为文件数量过多而无法显示