MeshToonMaterial.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 MeshToonMaterial extends Material {
  6. constructor( parameters ) {
  7. super();
  8. this.isMeshToonMaterial = true;
  9. this.defines = { 'TOON': '' };
  10. this.type = 'MeshToonMaterial';
  11. this.color = new Color( 0xffffff );
  12. this.map = null;
  13. this.gradientMap = null;
  14. this.lightMap = null;
  15. this.lightMapIntensity = 1.0;
  16. this.aoMap = null;
  17. this.aoMapIntensity = 1.0;
  18. this.emissive = new Color( 0x000000 );
  19. this.emissiveIntensity = 1.0;
  20. this.emissiveMap = null;
  21. this.bumpMap = null;
  22. this.bumpScale = 1;
  23. this.normalMap = null;
  24. this.normalMapType = TangentSpaceNormalMap;
  25. this.normalScale = new Vector2( 1, 1 );
  26. this.displacementMap = null;
  27. this.displacementScale = 1;
  28. this.displacementBias = 0;
  29. this.alphaMap = null;
  30. this.wireframe = false;
  31. this.wireframeLinewidth = 1;
  32. this.wireframeLinecap = 'round';
  33. this.wireframeLinejoin = 'round';
  34. this.fog = true;
  35. this.setValues( parameters );
  36. }
  37. copy( source ) {
  38. super.copy( source );
  39. this.color.copy( source.color );
  40. this.map = source.map;
  41. this.gradientMap = source.gradientMap;
  42. this.lightMap = source.lightMap;
  43. this.lightMapIntensity = source.lightMapIntensity;
  44. this.aoMap = source.aoMap;
  45. this.aoMapIntensity = source.aoMapIntensity;
  46. this.emissive.copy( source.emissive );
  47. this.emissiveMap = source.emissiveMap;
  48. this.emissiveIntensity = source.emissiveIntensity;
  49. this.bumpMap = source.bumpMap;
  50. this.bumpScale = source.bumpScale;
  51. this.normalMap = source.normalMap;
  52. this.normalMapType = source.normalMapType;
  53. this.normalScale.copy( source.normalScale );
  54. this.displacementMap = source.displacementMap;
  55. this.displacementScale = source.displacementScale;
  56. this.displacementBias = source.displacementBias;
  57. this.alphaMap = source.alphaMap;
  58. this.wireframe = source.wireframe;
  59. this.wireframeLinewidth = source.wireframeLinewidth;
  60. this.wireframeLinecap = source.wireframeLinecap;
  61. this.wireframeLinejoin = source.wireframeLinejoin;
  62. this.fog = source.fog;
  63. return this;
  64. }
  65. }
  66. export { MeshToonMaterial };
粤ICP备19079148号