PointsMaterial.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. *
  5. * parameters = {
  6. * color: <hex>,
  7. * opacity: <float>,
  8. * map: new THREE.Texture( <Image> ),
  9. *
  10. * size: <float>,
  11. * sizeAttenuation: <bool>,
  12. *
  13. * blending: THREE.NormalBlending,
  14. * depthTest: <bool>,
  15. * depthWrite: <bool>,
  16. *
  17. * vertexColors: <bool>,
  18. *
  19. * fog: <bool>
  20. * }
  21. */
  22. THREE.PointsMaterial = function ( parameters ) {
  23. THREE.Material.call( this );
  24. this.type = 'PointsMaterial';
  25. this.color = new THREE.Color( 0xffffff );
  26. this.map = null;
  27. this.size = 1;
  28. this.sizeAttenuation = true;
  29. this.vertexColors = THREE.NoColors;
  30. this.fog = true;
  31. this.setValues( parameters );
  32. };
  33. THREE.PointsMaterial.prototype = Object.create( THREE.Material.prototype );
  34. THREE.PointsMaterial.prototype.constructor = THREE.PointsMaterial;
  35. THREE.PointsMaterial.prototype.copy = function ( source ) {
  36. THREE.Material.prototype.copy.call( this, source );
  37. this.color.copy( source.color );
  38. this.map = source.map;
  39. this.size = source.size;
  40. this.sizeAttenuation = source.sizeAttenuation;
  41. this.vertexColors = source.vertexColors;
  42. this.fog = source.fog;
  43. return this;
  44. };
  45. // backwards compatibility
  46. THREE.PointCloudMaterial = function ( parameters ) {
  47. console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
  48. return new THREE.PointsMaterial( parameters );
  49. };
  50. THREE.ParticleBasicMaterial = function ( parameters ) {
  51. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
  52. return new THREE.PointsMaterial( parameters );
  53. };
  54. THREE.ParticleSystemMaterial = function ( parameters ) {
  55. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
  56. return new THREE.PointsMaterial( parameters );
  57. };
粤ICP备19079148号