Explorar o código

VOXLoader: VOXMesh clean up.

Mr.doob %!s(int64=4) %!d(string=hai) anos
pai
achega
9fa202c235
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      examples/jsm/loaders/VOXLoader.js

+ 7 - 2
examples/jsm/loaders/VOXLoader.js

@@ -251,9 +251,14 @@ class VOXMesh extends Mesh {
 		geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 		geometry.computeVertexNormals();
 
-		if ( hasColors ) geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
+		const material = new MeshStandardMaterial();
 
-		const material = new MeshStandardMaterial( { vertexColors: hasColors } );
+		if ( hasColors ) {
+
+			geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
+			material.vertexColors = true;
+
+		}
 
 		super( geometry, material );