|
@@ -933,46 +933,14 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
if ( geometryAttribute !== undefined ) {
|
|
|
|
|
|
- var type = _gl.FLOAT;
|
|
|
- var array = geometryAttribute.array;
|
|
|
var normalized = geometryAttribute.normalized;
|
|
|
+ var size = geometryAttribute.itemSize;
|
|
|
|
|
|
- if ( array instanceof Float32Array ) {
|
|
|
-
|
|
|
- type = _gl.FLOAT;
|
|
|
-
|
|
|
- } else if ( array instanceof Float64Array ) {
|
|
|
-
|
|
|
- console.warn( "Unsupported data buffer format: Float64Array" );
|
|
|
-
|
|
|
- } else if ( array instanceof Uint16Array ) {
|
|
|
-
|
|
|
- type = _gl.UNSIGNED_SHORT;
|
|
|
-
|
|
|
- } else if ( array instanceof Int16Array ) {
|
|
|
-
|
|
|
- type = _gl.SHORT;
|
|
|
-
|
|
|
- } else if ( array instanceof Uint32Array ) {
|
|
|
-
|
|
|
- type = _gl.UNSIGNED_INT;
|
|
|
-
|
|
|
- } else if ( array instanceof Int32Array ) {
|
|
|
-
|
|
|
- type = _gl.INT;
|
|
|
-
|
|
|
- } else if ( array instanceof Int8Array ) {
|
|
|
-
|
|
|
- type = _gl.BYTE;
|
|
|
-
|
|
|
- } else if ( array instanceof Uint8Array ) {
|
|
|
-
|
|
|
- type = _gl.UNSIGNED_BYTE;
|
|
|
-
|
|
|
- }
|
|
|
+ var attributeProperties = objects.getAttributeProperties( geometryAttribute );
|
|
|
|
|
|
- var size = geometryAttribute.itemSize;
|
|
|
- var buffer = objects.getAttributeBuffer( geometryAttribute );
|
|
|
+ var buffer = attributeProperties.__webglBuffer;
|
|
|
+ var type = attributeProperties.type;
|
|
|
+ var bytesPerElement = attributeProperties.bytesPerElement;
|
|
|
|
|
|
if ( geometryAttribute.isInterleavedBufferAttribute ) {
|
|
|
|
|
@@ -997,7 +965,7 @@ function WebGLRenderer( parameters ) {
|
|
|
}
|
|
|
|
|
|
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
|
|
|
- _gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );
|
|
|
+ _gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, ( startIndex * stride + offset ) * bytesPerElement );
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1018,7 +986,7 @@ function WebGLRenderer( parameters ) {
|
|
|
}
|
|
|
|
|
|
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
|
|
|
- _gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * geometryAttribute.array.BYTES_PER_ELEMENT );
|
|
|
+ _gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * bytesPerElement );
|
|
|
|
|
|
}
|
|
|
|