Explorar o código

Fixed some more BufferAttribute based examples.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
8763847122

+ 3 - 3
examples/webgl_buffergeometry_lines_indexed.html

@@ -182,9 +182,9 @@
 				);
 				// --------------------------------
 
-				geometry.addAttribute( 'index', new THREE.Uint16Attribute( indices_array, 1 ) );
-				geometry.addAttribute( 'position', new THREE.Float32Attribute( positions, 3 ) );
-				geometry.addAttribute( 'color', new THREE.Float32Attribute( colors, 3 ) );
+				geometry.addAttribute( 'index', new THREE.BufferAttribute( new Uint16Array( indices_array ), 1 ) );
+				geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( positions ), 3 ) );
+				geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
 				geometry.computeBoundingSphere();
 
 				mesh = new THREE.Line( geometry, material, THREE.LinePieces );

+ 2 - 2
examples/webgl_buffergeometry_rawshader.html

@@ -113,7 +113,7 @@
 
 				var geometry = new THREE.BufferGeometry();
 
-				var vertices = new THREE.Float32Attribute( triangles * 3 * 3, 3 );
+				var vertices = new THREE.BufferAttribute( new Float32Array( triangles * 3 * 3 ), 3 );
 
 				for ( var i = 0; i < vertices.length; i ++ ) {
 
@@ -123,7 +123,7 @@
 
 				geometry.addAttribute( 'position', vertices );
 
-				var colors = new THREE.Float32Attribute( triangles * 3 * 4, 4 );
+				var colors = new THREE.BufferAttribute(new Float32Array( triangles * 3 * 4 ), 4 );
 
 				for ( var i = 0; i < colors.length; i ++ ) {