MeshPhysicalMaterial.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { Vector2 } from '../math/Vector2.js';
  2. import { MeshStandardMaterial } from './MeshStandardMaterial.js';
  3. /**
  4. * @author WestLangley / http://github.com/WestLangley
  5. *
  6. * parameters = {
  7. * reflectivity: <float>
  8. * clearCoat: <float>
  9. * clearCoatRoughness: <float>
  10. *
  11. * clearCoatNormalScale: <Vector2>,
  12. * clearCoatNormalMap: new THREE.Texture( <Image> ),
  13. * }
  14. */
  15. function MeshPhysicalMaterial( parameters ) {
  16. MeshStandardMaterial.call( this );
  17. this.defines = { 'PHYSICAL': '' };
  18. this.type = 'MeshPhysicalMaterial';
  19. this.reflectivity = 0.5; // maps to F0 = 0.04
  20. this.clearCoat = 0.0;
  21. this.clearCoatRoughness = 0.0;
  22. this.clearCoatNormalScale = new Vector2( 1, 1 );
  23. this.clearCoatNormalMap = null;
  24. this.setValues( parameters );
  25. }
  26. MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype );
  27. MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;
  28. MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
  29. MeshPhysicalMaterial.prototype.copy = function ( source ) {
  30. MeshStandardMaterial.prototype.copy.call( this, source );
  31. this.defines = { 'PHYSICAL': '' };
  32. this.reflectivity = source.reflectivity;
  33. this.clearCoat = source.clearCoat;
  34. this.clearCoatRoughness = source.clearCoatRoughness;
  35. this.clearCoatNormalMap = source.clearCoatNormalMap;
  36. this.clearCoatNormalScale.copy( source.clearCoatNormalScale );
  37. return this;
  38. };
  39. export { MeshPhysicalMaterial };
粤ICP备19079148号