1
0

MeshPhysicalMaterial.js 1.6 KB

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