MeshMatcapMaterial.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. /**
  6. * parameters = {
  7. * color: <hex>,
  8. * opacity: <float>,
  9. *
  10. * matcap: new THREE.Texture( <Image> ),
  11. *
  12. * map: new THREE.Texture( <Image> ),
  13. *
  14. * bumpMap: new THREE.Texture( <Image> ),
  15. * bumpScale: <float>,
  16. *
  17. * normalMap: new THREE.Texture( <Image> ),
  18. * normalMapType: THREE.TangentSpaceNormalMap,
  19. * normalScale: <Vector2>,
  20. *
  21. * displacementMap: new THREE.Texture( <Image> ),
  22. * displacementScale: <float>,
  23. * displacementBias: <float>,
  24. *
  25. * alphaMap: new THREE.Texture( <Image> ),
  26. *
  27. * skinning: <bool>,
  28. * morphTargets: <bool>,
  29. * morphNormals: <bool>
  30. * }
  31. */
  32. function MeshMatcapMaterial( parameters ) {
  33. Material.call( this );
  34. this.defines = { 'MATCAP': '' };
  35. this.type = 'MeshMatcapMaterial';
  36. this.color = new Color( 0xffffff ); // diffuse
  37. this.matcap = null;
  38. this.map = null;
  39. this.bumpMap = null;
  40. this.bumpScale = 1;
  41. this.normalMap = null;
  42. this.normalMapType = TangentSpaceNormalMap;
  43. this.normalScale = new Vector2( 1, 1 );
  44. this.displacementMap = null;
  45. this.displacementScale = 1;
  46. this.displacementBias = 0;
  47. this.alphaMap = null;
  48. this.skinning = false;
  49. this.morphTargets = false;
  50. this.morphNormals = false;
  51. this.setValues( parameters );
  52. }
  53. MeshMatcapMaterial.prototype = Object.create( Material.prototype );
  54. MeshMatcapMaterial.prototype.constructor = MeshMatcapMaterial;
  55. MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;
  56. MeshMatcapMaterial.prototype.copy = function ( source ) {
  57. Material.prototype.copy.call( this, source );
  58. this.defines = { 'MATCAP': '' };
  59. this.color.copy( source.color );
  60. this.matcap = source.matcap;
  61. this.map = source.map;
  62. this.bumpMap = source.bumpMap;
  63. this.bumpScale = source.bumpScale;
  64. this.normalMap = source.normalMap;
  65. this.normalMapType = source.normalMapType;
  66. this.normalScale.copy( source.normalScale );
  67. this.displacementMap = source.displacementMap;
  68. this.displacementScale = source.displacementScale;
  69. this.displacementBias = source.displacementBias;
  70. this.alphaMap = source.alphaMap;
  71. this.skinning = source.skinning;
  72. this.morphTargets = source.morphTargets;
  73. this.morphNormals = source.morphNormals;
  74. return this;
  75. };
  76. export { MeshMatcapMaterial };
粤ICP备19079148号