MeshStandardMaterial.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import { TangentSpaceNormalMap } from '../constants.js';
  2. import { Material } from './Material.js';
  3. import { Vector2 } from '../math/Vector2.js';
  4. import { Color } from '../math/Color.js';
  5. class MeshStandardMaterial extends Material {
  6. constructor( parameters ) {
  7. super();
  8. this.isMeshStandardMaterial = true;
  9. this.defines = { 'STANDARD': '' };
  10. this.type = 'MeshStandardMaterial';
  11. this.color = new Color( 0xffffff ); // diffuse
  12. this.roughness = 1.0;
  13. this.metalness = 0.0;
  14. this.map = null;
  15. this.lightMap = null;
  16. this.lightMapIntensity = 1.0;
  17. this.aoMap = null;
  18. this.aoMapIntensity = 1.0;
  19. this.emissive = new Color( 0x000000 );
  20. this.emissiveIntensity = 1.0;
  21. this.emissiveMap = null;
  22. this.bumpMap = null;
  23. this.bumpScale = 1;
  24. this.normalMap = null;
  25. this.normalMapType = TangentSpaceNormalMap;
  26. this.normalScale = new Vector2( 1, 1 );
  27. this.displacementMap = null;
  28. this.displacementScale = 1;
  29. this.displacementBias = 0;
  30. this.roughnessMap = null;
  31. this.metalnessMap = null;
  32. this.alphaMap = null;
  33. this.envMap = null;
  34. this.envMapIntensity = 1.0;
  35. this.wireframe = false;
  36. this.wireframeLinewidth = 1;
  37. this.wireframeLinecap = 'round';
  38. this.wireframeLinejoin = 'round';
  39. this.flatShading = false;
  40. this.fog = true;
  41. this.setValues( parameters );
  42. }
  43. copy( source ) {
  44. super.copy( source );
  45. this.defines = { 'STANDARD': '' };
  46. this.color.copy( source.color );
  47. this.roughness = source.roughness;
  48. this.metalness = source.metalness;
  49. this.map = source.map;
  50. this.lightMap = source.lightMap;
  51. this.lightMapIntensity = source.lightMapIntensity;
  52. this.aoMap = source.aoMap;
  53. this.aoMapIntensity = source.aoMapIntensity;
  54. this.emissive.copy( source.emissive );
  55. this.emissiveMap = source.emissiveMap;
  56. this.emissiveIntensity = source.emissiveIntensity;
  57. this.bumpMap = source.bumpMap;
  58. this.bumpScale = source.bumpScale;
  59. this.normalMap = source.normalMap;
  60. this.normalMapType = source.normalMapType;
  61. this.normalScale.copy( source.normalScale );
  62. this.displacementMap = source.displacementMap;
  63. this.displacementScale = source.displacementScale;
  64. this.displacementBias = source.displacementBias;
  65. this.roughnessMap = source.roughnessMap;
  66. this.metalnessMap = source.metalnessMap;
  67. this.alphaMap = source.alphaMap;
  68. this.envMap = source.envMap;
  69. this.envMapIntensity = source.envMapIntensity;
  70. this.wireframe = source.wireframe;
  71. this.wireframeLinewidth = source.wireframeLinewidth;
  72. this.wireframeLinecap = source.wireframeLinecap;
  73. this.wireframeLinejoin = source.wireframeLinejoin;
  74. this.flatShading = source.flatShading;
  75. this.fog = source.fog;
  76. return this;
  77. }
  78. }
  79. export { MeshStandardMaterial };
粤ICP备19079148号