MeshPhysicalMaterial.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { MeshStandardMaterial } from './MeshStandardMaterial.js';
  2. /**
  3. * @author WestLangley / http://github.com/WestLangley
  4. *
  5. * parameters = {
  6. * reflectivity: <float>
  7. * clearCoat: <float>
  8. * clearCoatRoughness: <float>
  9. * }
  10. */
  11. function MeshPhysicalMaterial( parameters ) {
  12. MeshStandardMaterial.call( this );
  13. this.defines = { 'PHYSICAL': '' };
  14. this.type = 'MeshPhysicalMaterial';
  15. this.reflectivity = 0.5; // maps to F0 = 0.04
  16. this.clearCoat = 0.0;
  17. this.clearCoatRoughness = 0.0;
  18. this.setValues( parameters );
  19. }
  20. MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype );
  21. MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;
  22. MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
  23. MeshPhysicalMaterial.prototype.copy = function ( source ) {
  24. MeshStandardMaterial.prototype.copy.call( this, source );
  25. this.defines = { 'PHYSICAL': '' };
  26. this.reflectivity = source.reflectivity;
  27. this.clearCoat = source.clearCoat;
  28. this.clearCoatRoughness = source.clearCoatRoughness;
  29. return this;
  30. };
  31. export { MeshPhysicalMaterial };