瀏覽代碼

NodeMaterial: Fix support for extended classes (#23724)

* fix support for extended classes

* update to NodeMaterial
sunag 3 年之前
父節點
當前提交
2d7fbabdb5

+ 6 - 1
examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js

@@ -65,10 +65,15 @@ class WebGLNodeBuilder extends NodeBuilder {
 	_parseObject() {
 
 		const material = this.material;
-		const type = material.type;
+		let type = material.type;
 
 		// shader lib
 
+		if ( material.isMeshStandardNodeMaterial ) type = 'MeshStandardNodeMaterial';
+		else if ( material.isMeshBasicNodeMaterial ) type = 'MeshBasicNodeMaterial';
+		else if ( material.isPointsNodeMaterial ) type = 'PointsNodeMaterial';
+		else if ( material.isLineBasicNodeMaterial ) type = 'LineBasicNodeMaterial';
+
 		if ( nodeShaderLib[ type ] !== undefined ) {
 
 			const shaderLib = nodeShaderLib[ type ];

+ 1 - 1
examples/webgl_materials_instance_uniform_nodes.html

@@ -97,7 +97,7 @@
 
 				const instanceUniform = new InstanceUniformNode();
 
-				const material = new THREE.MeshStandardMaterial();
+				const material = new Nodes.MeshStandardNodeMaterial();
 				material.colorNode = instanceUniform;
 
 				// Spheres geometry