Explorar o código

Restore some logics accidentally removed

Takahiro %!s(int64=5) %!d(string=hai) anos
pai
achega
f9789e23b9
Modificáronse 1 ficheiros con 17 adicións e 8 borrados
  1. 17 8
      src/renderers/webgl/WebGLBindingStates.js

+ 17 - 8
src/renderers/webgl/WebGLBindingStates.js

@@ -290,16 +290,25 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 
 	}
 
-	function setupVertexAttributes( object, material, program, geometry ) {
+	function vertexAttribPointer( index, size, type, normalized, stride, offset ) {
 
-		if ( geometry && geometry.isInstancedBufferGeometry & ! capabilities.isWebGL2 ) {
+		if ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT ) ) {
 
-			if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) {
+			gl.vertexAttribIPointer( index, size, type, normalized, stride, offset );
 
-				console.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
-				return;
+		} else {
 
-			}
+			gl.vertexAttribPointer( index, size, type, normalized, stride, offset );
+
+		}
+
+	}
+
+	function setupVertexAttributes( object, material, program, geometry ) {
+
+		if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
+
+			if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
 
 		}
 
@@ -357,7 +366,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 						}
 
 						gl.bindBuffer( gl.ARRAY_BUFFER, buffer );
-						gl.vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, offset * bytesPerElement );
+						vertexAttribPointer( programAttribute, size, type, normalized, stride * bytesPerElement, offset * bytesPerElement );
 
 					} else {
 
@@ -378,7 +387,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 						}
 
 						gl.bindBuffer( gl.ARRAY_BUFFER, buffer );
-						gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, 0 );
+						vertexAttribPointer( programAttribute, size, type, normalized, 0, 0 );
 
 					}