MeshPhysicalNodeMaterial.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { addNodeMaterial } from './NodeMaterial.js';
  2. import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
  3. import { MeshPhysicalMaterial } from 'three';
  4. const defaultValues = new MeshPhysicalMaterial();
  5. class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
  6. constructor( parameters ) {
  7. super();
  8. this.isMeshPhysicalNodeMaterial = true;
  9. this.clearcoatNode = null;
  10. this.clearcoatRoughnessNode = null;
  11. this.clearcoatNormalNode = null;
  12. this.sheenNode = null;
  13. this.sheenRoughnessNode = null;
  14. this.iridescenceNode = null;
  15. this.iridescenceIORNode = null;
  16. this.iridescenceThicknessNode = null;
  17. this.specularIntensityNode = null;
  18. this.specularColorNode = null;
  19. this.transmissionNode = null;
  20. this.thicknessNode = null;
  21. this.attenuationDistanceNode = null;
  22. this.attenuationColorNode = null;
  23. this.sheen = 0;
  24. this.clearcoat = 0;
  25. this.iridescence = 0;
  26. this.transmission = 0;
  27. this.setDefaultValues( defaultValues );
  28. this.setValues( parameters );
  29. }
  30. copy( source ) {
  31. this.clearcoatNode = source.clearcoatNode;
  32. this.clearcoatRoughnessNode = source.clearcoatRoughnessNode;
  33. this.clearcoatNormalNode = source.clearcoatNormalNode;
  34. this.sheenNode = source.sheenNode;
  35. this.sheenRoughnessNode = source.sheenRoughnessNode;
  36. this.iridescenceNode = source.iridescenceNode;
  37. this.iridescenceIORNode = source.iridescenceIORNode;
  38. this.iridescenceThicknessNode = source.iridescenceThicknessNode;
  39. this.specularIntensityNode = source.specularIntensityNode;
  40. this.specularColorNode = source.specularColorNode;
  41. this.transmissionNode = source.transmissionNode;
  42. this.thicknessNode = source.thicknessNode;
  43. this.attenuationDistanceNode = source.attenuationDistanceNode;
  44. this.attenuationColorNode = source.attenuationColorNode;
  45. return super.copy( source );
  46. }
  47. }
  48. export default MeshPhysicalNodeMaterial;
  49. addNodeMaterial( MeshPhysicalNodeMaterial );