Skip to content

Commit

Permalink
Merge pull request #11412 from aardgoose/index-discard
Browse files Browse the repository at this point in the history
allow index attributes to be dropped using index.onUpload() mechanism.
  • Loading branch information
mrdoob authored Jun 3, 2017
2 parents 4971c0d + 87489e3 commit 62057e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
7 changes: 5 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,11 +784,14 @@ function WebGLRenderer( parameters ) {
}

var renderer = bufferRenderer;
var indexProperties;

if ( index !== null ) {

indexProperties = attributes.get( index );

renderer = indexedBufferRenderer;
renderer.setIndex( index );
renderer.setIndex( indexProperties );

}

Expand All @@ -798,7 +801,7 @@ function WebGLRenderer( parameters ) {

if ( index !== null ) {

_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, indexProperties.buffer );

}

Expand Down
20 changes: 3 additions & 17 deletions src/renderers/webgl/WebGLIndexedBufferRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ function WebGLIndexedBufferRenderer( gl, extensions, infoRender ) {

var type, size;

function setIndex( index ) {
function setIndex( indexProperties ) {

if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {

type = gl.UNSIGNED_INT;
size = 4;

} else if ( index.array instanceof Uint16Array ) {

type = gl.UNSIGNED_SHORT;
size = 2;

} else {

type = gl.UNSIGNED_BYTE;
size = 1;

}
type = indexProperties.type;
size = indexProperties.bytesPerElement;

}

Expand Down

0 comments on commit 62057e5

Please sign in to comment.