浏览代码

VOXLoader: VOXMesh clean up.

Mr.doob 4 年之前
父节点
当前提交
9fa202c235
共有 1 个文件被更改,包括 7 次插入2 次删除
  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.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 		geometry.computeVertexNormals();
 		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 );
 		super( geometry, material );