Bladeren bron

GLTFExporter: Remove truncateDrawRange option. (#24625)

* GLTFExporter: Remove truncateDrawRange option.

* Update screenshot.

* GLTFExporter: Clean up.
Michael Herzog 2 jaren geleden
bovenliggende
commit
c00709a895

+ 0 - 1
docs/examples/en/exporters/GLTFExporter.html

@@ -117,7 +117,6 @@
 		<ul>
 			<li>trs - bool. Export position, rotation and scale instead of matrix per node. Default is false</li>
 			<li>onlyVisible - bool. Export only visible objects. Default is true.</li>
-			<li>truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.</li>
 			<li>binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.</li>
 			<li>maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. Default is Infinity.</li>
 			<li>animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.</li>

+ 0 - 1
docs/examples/zh/exporters/GLTFExporter.html

@@ -117,7 +117,6 @@
 		<ul>
 			<li>trs - bool. Export position, rotation and scale instead of matrix per node. Default is false</li>
 			<li>onlyVisible - bool. Export only visible objects. Default is true.</li>
-			<li>truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.</li>
 			<li>binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.</li>
 			<li>maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. Default is Infinity.</li>
 			<li>animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.</li>

+ 0 - 17
examples/jsm/exporters/GLTFExporter.js

@@ -438,7 +438,6 @@ class GLTFWriter {
 			binary: false,
 			trs: false,
 			onlyVisible: true,
-			truncateDrawRange: true,
 			maxTextureSize: Infinity,
 			animations: [],
 			includeCustomExtensions: false
@@ -987,7 +986,6 @@ class GLTFWriter {
 	 */
 	processAccessor( attribute, geometry, start, count ) {
 
-		const options = this.options;
 		const json = this.json;
 
 		const types = {
@@ -1028,21 +1026,6 @@ class GLTFWriter {
 		if ( start === undefined ) start = 0;
 		if ( count === undefined ) count = attribute.count;
 
-		// @TODO Indexed buffer geometry with drawRange not supported yet
-		if ( options.truncateDrawRange && geometry !== undefined && geometry.index === null ) {
-
-			const end = start + count;
-			const end2 = geometry.drawRange.count === Infinity
-				? attribute.count
-				: geometry.drawRange.start + geometry.drawRange.count;
-
-			start = Math.max( start, geometry.drawRange.start );
-			count = Math.min( end, end2 ) - start;
-
-			if ( count < 0 ) count = 0;
-
-		}
-
 		// Skip creating an accessor if the attribute doesn't have data to export
 		if ( count === 0 ) return null;
 

+ 1 - 42
examples/misc_exporter_gltf.html

@@ -39,7 +39,6 @@
 				const options = {
 					trs: params.trs,
 					onlyVisible: params.onlyVisible,
-					truncateDrawRange: params.truncateDrawRange,
 					binary: params.binary,
 					maxTextureSize: params.maxTextureSize
 				};
@@ -105,7 +104,6 @@
 			const params = {
 				trs: false,
 				onlyVisible: true,
-				truncateDrawRange: true,
 				binary: false,
 				maxTextureSize: 4096,
 				exportScene1: exportScene1,
@@ -345,44 +343,6 @@
 
 				scene1.add( object );
 
-				// ---------------------------------------------------------------------
-				// Buffer geometry truncated (DrawRange)
-				// ---------------------------------------------------------------------
-				geometry = new THREE.BufferGeometry();
-				const numElements = 6;
-				const outOfRange = 3;
-
-				positions = new Float32Array( ( numElements + outOfRange ) * 3 );
-				const colors = new Float32Array( ( numElements + outOfRange ) * 3 );
-
-				positions.set( [
-					0, 0, 0,
-					0, 80, 0,
-					80, 0, 0,
-					80, 0, 0,
-					0, 80, 0,
-					80, 80, 0
-				] );
-
-				colors.set( [
-					1, 0, 0,
-					1, 0, 0,
-					1, 1, 0,
-					1, 1, 0,
-					0, 0, 1,
-					0, 0, 1,
-				] );
-
-				geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
-				geometry.setAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
-				geometry.setDrawRange( 0, numElements );
-
-				object = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { side: THREE.DoubleSide, vertexColors: true } ) );
-				object.name = 'Custom buffered truncated';
-				object.position.set( 140, - 40, - 200 );
-
-				scene1.add( object );
-
 				// ---------------------------------------------------------------------
 				// THREE.Points
 				// ---------------------------------------------------------------------
@@ -462,7 +422,7 @@
 
 					waltHead = obj;
 					waltHead.scale.multiplyScalar( 1.5 );
-					waltHead.position.set( 400, 0, 0 );
+					waltHead.position.set( 200, - 40, - 200 );
 					scene1.add( waltHead );
 
 				} );
@@ -495,7 +455,6 @@
 				let h = gui.addFolder( 'Settings' );
 				h.add( params, 'trs' ).name( 'Use TRS' );
 				h.add( params, 'onlyVisible' ).name( 'Only Visible Objects' );
-				h.add( params, 'truncateDrawRange' ).name( 'Truncate Draw Range' );
 				h.add( params, 'binary' ).name( 'Binary (GLB)' );
 				h.add( params, 'maxTextureSize', 2, 8192 ).name( 'Max Texture Size' ).step( 1 );
 

BIN
examples/screenshots/misc_exporter_gltf.jpg