Materials.js 741 B

123456789101112131415161718192021222324252627282930313233
  1. import LineBasicNodeMaterial from './LineBasicNodeMaterial.js';
  2. import MeshBasicNodeMaterial from './MeshBasicNodeMaterial.js';
  3. import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
  4. import PointsNodeMaterial from './PointsNodeMaterial.js';
  5. import { Material } from 'three';
  6. export {
  7. LineBasicNodeMaterial,
  8. MeshBasicNodeMaterial,
  9. MeshStandardNodeMaterial,
  10. PointsNodeMaterial
  11. };
  12. const materialLib = {
  13. LineBasicNodeMaterial,
  14. MeshBasicNodeMaterial,
  15. MeshStandardNodeMaterial,
  16. PointsNodeMaterial
  17. };
  18. const fromTypeFunction = Material.fromType;
  19. Material.fromType = function ( type ) {
  20. if ( materialLib[ type ] !== undefined ) {
  21. return new materialLib[ type ]();
  22. }
  23. return fromTypeFunction.call( this, type );
  24. };