|
@@ -92,7 +92,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
|
|
|
|
|
|
for ( var name in attributes ) {
|
|
for ( var name in attributes ) {
|
|
|
|
|
|
- updateAttribute( attributes[ name ], name );
|
|
|
|
|
|
+ updateAttribute( attributes[ name ] );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,7 +106,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
|
|
|
|
|
|
for ( var i = 0, l = array.length; i < l; i ++ ) {
|
|
for ( var i = 0, l = array.length; i < l; i ++ ) {
|
|
|
|
|
|
- updateAttribute( array[ i ], i );
|
|
|
|
|
|
+ updateAttribute( array[ i ] );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -116,9 +116,19 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- function updateAttribute( attribute, name ) {
|
|
|
|
|
|
+ function updateAttribute( attribute ) {
|
|
|
|
|
|
- var bufferType = name === 'index' ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
|
|
|
|
|
|
+ var bufferType;
|
|
|
|
+
|
|
|
|
+ if ( attribute instanceof THREE.IndexBufferAttribute ) {
|
|
|
|
+
|
|
|
|
+ bufferType = gl.ELEMENT_ARRAY_BUFFER;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ bufferType = gl.ARRAY_BUFFER;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
var data = ( attribute instanceof THREE.InterleavedBufferAttribute ) ? attribute.data : attribute;
|
|
var data = ( attribute instanceof THREE.InterleavedBufferAttribute ) ? attribute.data : attribute;
|
|
|
|
|
|
@@ -251,9 +261,9 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
|
|
console.timeEnd( 'wireframe' );
|
|
console.timeEnd( 'wireframe' );
|
|
|
|
|
|
var TypeArray = position.count > 65535 ? Uint32Array : Uint16Array;
|
|
var TypeArray = position.count > 65535 ? Uint32Array : Uint16Array;
|
|
- var attribute = new THREE.BufferAttribute( new TypeArray( indices ), 1 );
|
|
|
|
|
|
+ var attribute = new THREE.IndexBufferAttribute( new TypeArray( indices ), 1 );
|
|
|
|
|
|
- updateAttribute( attribute, 'index' );
|
|
|
|
|
|
+ updateAttribute( attribute );
|
|
|
|
|
|
property.wireframe = attribute;
|
|
property.wireframe = attribute;
|
|
|
|
|
|
@@ -277,7 +287,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
|
|
this.getWireframeAttribute = getWireframeAttribute;
|
|
this.getWireframeAttribute = getWireframeAttribute;
|
|
|
|
|
|
this.update = update;
|
|
this.update = update;
|
|
- this.updateAttribute = updateAttribute;
|
|
|
|
|
|
|
|
this.clear = function () {
|
|
this.clear = function () {
|
|
|
|
|