MeshNormalMaterial.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { Material } from './Material.js';
  2. import { Vector2 } from '../math/Vector2.js';
  3. /**
  4. * @author mrdoob / http://mrdoob.com/
  5. * @author WestLangley / http://github.com/WestLangley
  6. *
  7. * parameters = {
  8. * opacity: <float>,
  9. *
  10. * bumpMap: new THREE.Texture( <Image> ),
  11. * bumpScale: <float>,
  12. *
  13. * normalMap: new THREE.Texture( <Image> ),
  14. * normalScale: <Vector2>,
  15. *
  16. * displacementMap: new THREE.Texture( <Image> ),
  17. * displacementScale: <float>,
  18. * displacementBias: <float>,
  19. *
  20. * wireframe: <boolean>,
  21. * wireframeLinewidth: <float>
  22. *
  23. * skinning: <bool>,
  24. * morphTargets: <bool>,
  25. * morphNormals: <bool>
  26. * }
  27. */
  28. function MeshNormalMaterial( parameters ) {
  29. Material.call( this );
  30. this.type = 'MeshNormalMaterial';
  31. this.bumpMap = null;
  32. this.bumpScale = 1;
  33. this.normalMap = null;
  34. this.normalScale = new Vector2( 1, 1 );
  35. this.displacementMap = null;
  36. this.displacementScale = 1;
  37. this.displacementBias = 0;
  38. this.wireframe = false;
  39. this.wireframeLinewidth = 1;
  40. this.fog = false;
  41. this.lights = false;
  42. this.skinning = false;
  43. this.morphTargets = false;
  44. this.morphNormals = false;
  45. this.setValues( parameters );
  46. }
  47. MeshNormalMaterial.prototype = Object.create( Material.prototype );
  48. MeshNormalMaterial.prototype.constructor = MeshNormalMaterial;
  49. MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
  50. MeshNormalMaterial.prototype.copy = function ( source ) {
  51. Material.prototype.copy.call( this, source );
  52. this.bumpMap = source.bumpMap;
  53. this.bumpScale = source.bumpScale;
  54. this.normalMap = source.normalMap;
  55. this.normalScale.copy( source.normalScale );
  56. this.displacementMap = source.displacementMap;
  57. this.displacementScale = source.displacementScale;
  58. this.displacementBias = source.displacementBias;
  59. this.wireframe = source.wireframe;
  60. this.wireframeLinewidth = source.wireframeLinewidth;
  61. this.skinning = source.skinning;
  62. this.morphTargets = source.morphTargets;
  63. this.morphNormals = source.morphNormals;
  64. return this;
  65. };
  66. export { MeshNormalMaterial };