|
@@ -75,9 +75,41 @@
|
|
|
|
|
|
scene.add( new THREE.HemisphereLight( 0x443333, 0x222233, 4 ) );
|
|
|
|
|
|
+ // Test Extended Material
|
|
|
+
|
|
|
+ class MeshCustomNodeMaterial extends Nodes.MeshStandardNodeMaterial {
|
|
|
+
|
|
|
+ constructor() {
|
|
|
+
|
|
|
+ super();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // Extends Serialization Material
|
|
|
+
|
|
|
+ const superCreateMaterialFromType = THREE.MaterialLoader.createMaterialFromType;
|
|
|
+
|
|
|
+ THREE.MaterialLoader.createMaterialFromType = function ( type ) {
|
|
|
+
|
|
|
+ const materialLib = {
|
|
|
+ MeshCustomNodeMaterial
|
|
|
+ };
|
|
|
+
|
|
|
+ if ( materialLib[ type ] !== undefined ) {
|
|
|
+
|
|
|
+ return new materialLib[ type ]();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return superCreateMaterialFromType.call( this, type );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
//
|
|
|
|
|
|
- const material = new Nodes.MeshStandardNodeMaterial();
|
|
|
+ const material = new MeshCustomNodeMaterial();
|
|
|
|
|
|
new OBJLoader()
|
|
|
.setPath( 'models/obj/cerberus/' )
|