MeshPhysicalMaterial.js 1.0 KB

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