Kaynağa Gözat

Added Uint8Array case to webgl_buffergeometry_rawshader.

Mr.doob 9 yıl önce
ebeveyn
işleme
e222d48a51
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5 5
      examples/webgl_buffergeometry_rawshader.html

+ 5 - 5
examples/webgl_buffergeometry_rawshader.html

@@ -124,14 +124,14 @@
 
 				geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 
-				var colors = new Float32Array( triangles * 3 * 4 );
+				var colors = new Uint8Array( triangles * 3 * 4 );
 
 				for ( var i = 0, l = triangles * 3 * 4; i < l; i += 4 ) {
 
-					colors[ i     ] = Math.random();
-					colors[ i + 1 ] = Math.random();
-					colors[ i + 2 ] = Math.random();
-					colors[ i + 3 ] = Math.random();
+					colors[ i     ] = Math.random() * 255;
+					colors[ i + 1 ] = Math.random() * 255;
+					colors[ i + 2 ] = Math.random() * 255;
+					colors[ i + 3 ] = Math.random() * 255;
 
 				}