|
@@ -4,7 +4,6 @@ import MeshBasicNodeMaterial from './MeshBasicNodeMaterial.js';
|
|
|
import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
|
|
|
import PointsNodeMaterial from './PointsNodeMaterial.js';
|
|
|
import SpriteNodeMaterial from './SpriteNodeMaterial.js';
|
|
|
-import { Material } from 'three';
|
|
|
|
|
|
export {
|
|
|
NodeMaterial,
|
|
@@ -15,31 +14,17 @@ export {
|
|
|
SpriteNodeMaterial
|
|
|
};
|
|
|
|
|
|
-const materialLib = {
|
|
|
- NodeMaterial,
|
|
|
- LineBasicNodeMaterial,
|
|
|
- MeshBasicNodeMaterial,
|
|
|
- MeshStandardNodeMaterial,
|
|
|
- PointsNodeMaterial,
|
|
|
- SpriteNodeMaterial
|
|
|
-};
|
|
|
-
|
|
|
-const fromTypeFunction = Material.fromType;
|
|
|
-
|
|
|
-Material.fromType = function ( type ) {
|
|
|
-
|
|
|
- if ( materialLib[ type ] !== undefined ) {
|
|
|
-
|
|
|
- return new materialLib[ type ]();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return fromTypeFunction.call( this, type );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
NodeMaterial.fromMaterial = function ( material ) {
|
|
|
|
|
|
+ const materialLib = {
|
|
|
+ NodeMaterial,
|
|
|
+ LineBasicNodeMaterial,
|
|
|
+ MeshBasicNodeMaterial,
|
|
|
+ MeshStandardNodeMaterial,
|
|
|
+ PointsNodeMaterial,
|
|
|
+ SpriteNodeMaterial,
|
|
|
+ };
|
|
|
+
|
|
|
const type = material.type.replace( 'Material', 'NodeMaterial' );
|
|
|
|
|
|
if ( materialLib[ type ] === undefined ) {
|