Explorar o código

Changed indices to use Uint16Array

Changed indices to use Uint16Array rather than Int16Array to make full use of the 16bit precision of the pointer
Ben Adams %!s(int64=12) %!d(string=hai) anos
pai
achega
e9b0f9fa27
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      examples/webgl_buffergeometry.html

+ 4 - 3
examples/webgl_buffergeometry.html

@@ -84,7 +84,7 @@
 				geometry.attributes = {
 					index: {
 						itemSize: 1,
-						array: new Int16Array( triangles * 3 ),
+						array: new Uint16Array( triangles * 3 ),
 						numItems: triangles * 3
 					},
 					position: {
@@ -105,10 +105,11 @@
 				}
 
 				// break geometry into
-				// chunks of 20,000 triangles (3 unique vertices per triangle)
+				// chunks of 21,845 triangles (3 unique vertices per triangle)
 				// for indices to fit into 16 bit integer number
+				// floor(2^16 / 3) = 21845
 
-				var chunkSize = 20000;
+				var chunkSize = 21845;
 
 				var indices = geometry.attributes.index.array;