MeshDistanceMaterial.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { Material } from './Material.js';
  2. import { Vector3 } from '../math/Vector3.js';
  3. /**
  4. * parameters = {
  5. *
  6. * referencePosition: <float>,
  7. * nearDistance: <float>,
  8. * farDistance: <float>,
  9. *
  10. * skinning: <bool>,
  11. * morphTargets: <bool>,
  12. *
  13. * map: new THREE.Texture( <Image> ),
  14. *
  15. * alphaMap: new THREE.Texture( <Image> ),
  16. *
  17. * displacementMap: new THREE.Texture( <Image> ),
  18. * displacementScale: <float>,
  19. * displacementBias: <float>
  20. *
  21. * }
  22. */
  23. function MeshDistanceMaterial( parameters ) {
  24. Material.call( this );
  25. this.type = 'MeshDistanceMaterial';
  26. this.referencePosition = new Vector3();
  27. this.nearDistance = 1;
  28. this.farDistance = 1000;
  29. this.skinning = false;
  30. this.morphTargets = false;
  31. this.map = null;
  32. this.alphaMap = null;
  33. this.displacementMap = null;
  34. this.displacementScale = 1;
  35. this.displacementBias = 0;
  36. this.fog = false;
  37. this.setValues( parameters );
  38. }
  39. MeshDistanceMaterial.prototype = Object.create( Material.prototype );
  40. MeshDistanceMaterial.prototype.constructor = MeshDistanceMaterial;
  41. MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
  42. MeshDistanceMaterial.prototype.copy = function ( source ) {
  43. Material.prototype.copy.call( this, source );
  44. this.referencePosition.copy( source.referencePosition );
  45. this.nearDistance = source.nearDistance;
  46. this.farDistance = source.farDistance;
  47. this.skinning = source.skinning;
  48. this.morphTargets = source.morphTargets;
  49. this.map = source.map;
  50. this.alphaMap = source.alphaMap;
  51. this.displacementMap = source.displacementMap;
  52. this.displacementScale = source.displacementScale;
  53. this.displacementBias = source.displacementBias;
  54. return this;
  55. };
  56. export { MeshDistanceMaterial };
粤ICP备19079148号