Skip to content

Commit c00709a

Browse files
authoredSep 13, 2022
GLTFExporter: Remove truncateDrawRange option. (mrdoob#24625)
* GLTFExporter: Remove truncateDrawRange option. * Update screenshot. * GLTFExporter: Clean up.
1 parent 50f1db1 commit c00709a

File tree

5 files changed

+1
-61
lines changed

5 files changed

+1
-61
lines changed
 

‎docs/examples/en/exporters/GLTFExporter.html

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ <h3>[method:undefined parse]( [param:Object3D input], [param:Function onComplete
117117
<ul>
118118
<li>trs - bool. Export position, rotation and scale instead of matrix per node. Default is false</li>
119119
<li>onlyVisible - bool. Export only visible objects. Default is true.</li>
120-
<li>truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.</li>
121120
<li>binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.</li>
122121
<li>maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. Default is Infinity.</li>
123122
<li>animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.</li>

‎docs/examples/zh/exporters/GLTFExporter.html

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ <h3>[method:undefined parse]( [param:Object3D input], [param:Function onComplete
117117
<ul>
118118
<li>trs - bool. Export position, rotation and scale instead of matrix per node. Default is false</li>
119119
<li>onlyVisible - bool. Export only visible objects. Default is true.</li>
120-
<li>truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.</li>
121120
<li>binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.</li>
122121
<li>maxTextureSize - int. Restricts the image maximum size (both width and height) to the given value. Default is Infinity.</li>
123122
<li>animations - Array<[page:AnimationClip AnimationClip]>. List of animations to be included in the export.</li>

‎examples/jsm/exporters/GLTFExporter.js

-17
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ class GLTFWriter {
438438
binary: false,
439439
trs: false,
440440
onlyVisible: true,
441-
truncateDrawRange: true,
442441
maxTextureSize: Infinity,
443442
animations: [],
444443
includeCustomExtensions: false
@@ -987,7 +986,6 @@ class GLTFWriter {
987986
*/
988987
processAccessor( attribute, geometry, start, count ) {
989988

990-
const options = this.options;
991989
const json = this.json;
992990

993991
const types = {
@@ -1028,21 +1026,6 @@ class GLTFWriter {
10281026
if ( start === undefined ) start = 0;
10291027
if ( count === undefined ) count = attribute.count;
10301028

1031-
// @TODO Indexed buffer geometry with drawRange not supported yet
1032-
if ( options.truncateDrawRange && geometry !== undefined && geometry.index === null ) {
1033-
1034-
const end = start + count;
1035-
const end2 = geometry.drawRange.count === Infinity
1036-
? attribute.count
1037-
: geometry.drawRange.start + geometry.drawRange.count;
1038-
1039-
start = Math.max( start, geometry.drawRange.start );
1040-
count = Math.min( end, end2 ) - start;
1041-
1042-
if ( count < 0 ) count = 0;
1043-
1044-
}
1045-
10461029
// Skip creating an accessor if the attribute doesn't have data to export
10471030
if ( count === 0 ) return null;
10481031

‎examples/misc_exporter_gltf.html

+1-42
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
const options = {
4040
trs: params.trs,
4141
onlyVisible: params.onlyVisible,
42-
truncateDrawRange: params.truncateDrawRange,
4342
binary: params.binary,
4443
maxTextureSize: params.maxTextureSize
4544
};
@@ -105,7 +104,6 @@
105104
const params = {
106105
trs: false,
107106
onlyVisible: true,
108-
truncateDrawRange: true,
109107
binary: false,
110108
maxTextureSize: 4096,
111109
exportScene1: exportScene1,
@@ -345,44 +343,6 @@
345343

346344
scene1.add( object );
347345

348-
// ---------------------------------------------------------------------
349-
// Buffer geometry truncated (DrawRange)
350-
// ---------------------------------------------------------------------
351-
geometry = new THREE.BufferGeometry();
352-
const numElements = 6;
353-
const outOfRange = 3;
354-
355-
positions = new Float32Array( ( numElements + outOfRange ) * 3 );
356-
const colors = new Float32Array( ( numElements + outOfRange ) * 3 );
357-
358-
positions.set( [
359-
0, 0, 0,
360-
0, 80, 0,
361-
80, 0, 0,
362-
80, 0, 0,
363-
0, 80, 0,
364-
80, 80, 0
365-
] );
366-
367-
colors.set( [
368-
1, 0, 0,
369-
1, 0, 0,
370-
1, 1, 0,
371-
1, 1, 0,
372-
0, 0, 1,
373-
0, 0, 1,
374-
] );
375-
376-
geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
377-
geometry.setAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
378-
geometry.setDrawRange( 0, numElements );
379-
380-
object = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { side: THREE.DoubleSide, vertexColors: true } ) );
381-
object.name = 'Custom buffered truncated';
382-
object.position.set( 140, - 40, - 200 );
383-
384-
scene1.add( object );
385-
386346
// ---------------------------------------------------------------------
387347
// THREE.Points
388348
// ---------------------------------------------------------------------
@@ -462,7 +422,7 @@
462422

463423
waltHead = obj;
464424
waltHead.scale.multiplyScalar( 1.5 );
465-
waltHead.position.set( 400, 0, 0 );
425+
waltHead.position.set( 200, - 40, - 200 );
466426
scene1.add( waltHead );
467427

468428
} );
@@ -495,7 +455,6 @@
495455
let h = gui.addFolder( 'Settings' );
496456
h.add( params, 'trs' ).name( 'Use TRS' );
497457
h.add( params, 'onlyVisible' ).name( 'Only Visible Objects' );
498-
h.add( params, 'truncateDrawRange' ).name( 'Truncate Draw Range' );
499458
h.add( params, 'binary' ).name( 'Binary (GLB)' );
500459
h.add( params, 'maxTextureSize', 2, 8192 ).name( 'Max Texture Size' ).step( 1 );
501460

-827 Bytes
Loading

0 commit comments

Comments
 (0)