PointsMaterial.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { Material } from './Material.js';
  2. import { Color } from '../math/Color.js';
  3. /**
  4. * @author mrdoob / http://mrdoob.com/
  5. * @author alteredq / http://alteredqualia.com/
  6. *
  7. * parameters = {
  8. * color: <hex>,
  9. * opacity: <float>,
  10. * map: new THREE.Texture( <Image> ),
  11. * alphaMap: new THREE.Texture( <Image> ),
  12. *
  13. * size: <float>,
  14. * sizeAttenuation: <bool>
  15. *
  16. * morphTargets: <bool>
  17. * }
  18. */
  19. function PointsMaterial( parameters ) {
  20. Material.call( this );
  21. this.type = 'PointsMaterial';
  22. this.color = new Color( 0xffffff );
  23. this.map = null;
  24. this.alphaMap = null;
  25. this.size = 1;
  26. this.sizeAttenuation = true;
  27. this.morphTargets = false;
  28. this.setValues( parameters );
  29. }
  30. PointsMaterial.prototype = Object.create( Material.prototype );
  31. PointsMaterial.prototype.constructor = PointsMaterial;
  32. PointsMaterial.prototype.isPointsMaterial = true;
  33. PointsMaterial.prototype.copy = function ( source ) {
  34. Material.prototype.copy.call( this, source );
  35. this.color.copy( source.color );
  36. this.map = source.map;
  37. this.alphaMap = source.alphaMap;
  38. this.size = source.size;
  39. this.sizeAttenuation = source.sizeAttenuation;
  40. this.morphTargets = source.morphTargets;
  41. return this;
  42. };
  43. export { PointsMaterial };