|
@@ -1008,7 +1008,6 @@ function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, ty
|
|
|
this.uuid = _Math.generateUUID();
|
|
|
|
|
|
this.name = '';
|
|
|
- this.sourceFile = '';
|
|
|
|
|
|
this.image = image !== undefined ? image : Texture.DEFAULT_IMAGE;
|
|
|
this.mipmaps = [];
|
|
@@ -11797,6 +11796,8 @@ function BufferAttribute( array, itemSize, normalized ) {
|
|
|
this.dynamic = false;
|
|
|
this.updateRange = { offset: 0, count: - 1 };
|
|
|
|
|
|
+ this.onUpload = null;
|
|
|
+
|
|
|
this.version = 0;
|
|
|
|
|
|
}
|
|
@@ -17247,8 +17248,53 @@ function WebGLObjects( gl, properties, info ) {
|
|
|
|
|
|
gl.bufferData( bufferType, data.array, usage );
|
|
|
|
|
|
+ var type = gl.FLOAT;
|
|
|
+ var array = data.array;
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ attributeProperties.bytesPerElement = array.BYTES_PER_ELEMENT;
|
|
|
+ attributeProperties.type = type;
|
|
|
attributeProperties.version = data.version;
|
|
|
|
|
|
+ if ( data.onUpload !== null ) {
|
|
|
+
|
|
|
+ data.onUpload();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function updateBuffer( attributeProperties, data, bufferType ) {
|
|
@@ -17294,6 +17340,18 @@ function WebGLObjects( gl, properties, info ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function getAttributeProperties( attribute ) {
|
|
|
+
|
|
|
+ if ( attribute.isInterleavedBufferAttribute ) {
|
|
|
+
|
|
|
+ return properties.get( attribute.data );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return properties.get( attribute );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
function getWireframeAttribute( geometry ) {
|
|
|
|
|
|
var property = properties.get( geometry );
|
|
@@ -17359,6 +17417,7 @@ function WebGLObjects( gl, properties, info ) {
|
|
|
return {
|
|
|
|
|
|
getAttributeBuffer: getAttributeBuffer,
|
|
|
+ getAttributeProperties: getAttributeProperties,
|
|
|
getWireframeAttribute: getWireframeAttribute,
|
|
|
|
|
|
update: update
|
|
@@ -20367,46 +20426,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 ) {
|
|
|
|
|
@@ -20431,7 +20458,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 {
|
|
|
|
|
@@ -20452,7 +20479,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 );
|
|
|
|
|
|
}
|
|
|
|