Skip to content

Commit c88bd2c

Browse files
committed
Updated builds.
1 parent adfa0d8 commit c88bd2c

File tree

3 files changed

+193
-162
lines changed

3 files changed

+193
-162
lines changed

build/three.js

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9261,7 +9261,7 @@ THREE.Face3.prototype = {
92619261
* @author mrdoob / http://mrdoob.com/
92629262
*/
92639263

9264-
THREE.BufferAttribute = function ( array, itemSize ) {
9264+
THREE.BufferAttribute = function ( array, itemSize, normalized ) {
92659265

92669266
this.uuid = THREE.Math.generateUUID();
92679267

@@ -9272,6 +9272,7 @@ THREE.BufferAttribute = function ( array, itemSize ) {
92729272
this.updateRange = { offset: 0, count: - 1 };
92739273

92749274
this.version = 0;
9275+
this.normalized = normalized === true;
92759276

92769277
};
92779278

@@ -12329,7 +12330,8 @@ THREE.BufferGeometry.prototype = {
1232912330
data.data.attributes[ key ] = {
1233012331
itemSize: attribute.itemSize,
1233112332
type: attribute.array.constructor.name,
12332-
array: array
12333+
array: array,
12334+
normalized: attribute.normalized
1233312335
};
1233412336

1233512337
}
@@ -19126,7 +19128,7 @@ THREE.BufferGeometryLoader.prototype = {
1912619128
var attribute = attributes[ key ];
1912719129
var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );
1912819130

19129-
geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) );
19131+
geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize, attribute.normalized ) );
1913019132

1913119133
}
1913219134

@@ -25751,6 +25753,44 @@ THREE.WebGLRenderer = function ( parameters ) {
2575125753

2575225754
if ( geometryAttribute !== undefined ) {
2575325755

25756+
var type = _gl.FLOAT;
25757+
var array = geometryAttribute.array;
25758+
var normalized = geometryAttribute.normalized;
25759+
25760+
if ( array instanceof Float32Array ) {
25761+
25762+
type = _gl.FLOAT;
25763+
25764+
} else if ( array instanceof Float64Array ) {
25765+
25766+
console.warn("Unsupported data buffer format: Float64Array");
25767+
25768+
} else if ( array instanceof Uint16Array ) {
25769+
25770+
type = _gl.UNSIGNED_SHORT;
25771+
25772+
} else if ( array instanceof Int16Array ) {
25773+
25774+
type = _gl.SHORT;
25775+
25776+
} else if ( array instanceof Uint32Array ) {
25777+
25778+
type = _gl.UNSIGNED_INT;
25779+
25780+
} else if ( array instanceof Int32Array ) {
25781+
25782+
type = _gl.INT;
25783+
25784+
} else if ( array instanceof Int8Array ) {
25785+
25786+
type = _gl.BYTE;
25787+
25788+
} else if ( array instanceof Uint8Array ) {
25789+
25790+
type = _gl.UNSIGNED_BYTE;
25791+
25792+
}
25793+
2575425794
var size = geometryAttribute.itemSize;
2575525795
var buffer = objects.getAttributeBuffer( geometryAttribute );
2575625796

@@ -25777,7 +25817,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2577725817
}
2577825818

2577925819
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
25780-
_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );
25820+
_gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );
2578125821

2578225822
} else {
2578325823

@@ -25797,19 +25837,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2579725837

2579825838
}
2579925839

25800-
var type = _gl.FLOAT;
25801-
var normalized = false;
25802-
var array = geometryAttribute.array;
25803-
25804-
if ( array instanceof Uint8Array ) {
25805-
25806-
type = _gl.UNSIGNED_BYTE;
25807-
normalized = true;
25808-
25809-
}
25810-
2581125840
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
25812-
_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * array.BYTES_PER_ELEMENT );
25841+
_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * geometryAttribute.array.BYTES_PER_ELEMENT );
2581325842

2581425843
}
2581525844

0 commit comments

Comments
 (0)