Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd1cec7

Browse files
committedSep 10, 2015
BufferGeometry: Added setDrawRange(). See mrdoob#7057.
1 parent efde4d0 commit dd1cec7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed
 

‎src/core/BufferGeometry.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ THREE.BufferGeometry = function () {
2222
this.boundingBox = null;
2323
this.boundingSphere = null;
2424

25+
this.drawRange = { start: 0, count: Infinity };
26+
2527
};
2628

2729
THREE.BufferGeometry.prototype = {
@@ -121,6 +123,13 @@ THREE.BufferGeometry.prototype = {
121123

122124
},
123125

126+
setDrawRange: function ( start, count ) {
127+
128+
this.drawRange.start = start;
129+
this.drawRange.count = count;
130+
131+
},
132+
124133
applyMatrix: function ( matrix ) {
125134

126135
var position = this.attributes.position;

‎src/renderers/WebGLRenderer.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,21 +837,23 @@ THREE.WebGLRenderer = function ( parameters ) {
837837

838838
if ( index !== null ) {
839839

840-
count = index.array.length;
840+
count = index.count;
841841

842842
} else if ( position instanceof THREE.InterleavedBufferAttribute ) {
843843

844844
count = position.data.array.length / 3;
845845

846846
} else {
847847

848-
count = position.array.length / 3;
848+
count = position.count;
849849

850850
}
851851

852+
var drawRange = geometry.drawRange;
853+
852854
group = {
853-
start: 0,
854-
count: count
855+
start: drawRange.start,
856+
count: Math.min( drawRange.count, count )
855857
};
856858

857859
}

0 commit comments

Comments
 (0)
Failed to load comments.