ParticleSystemMaterial.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. *
  12. * blending: THREE.NormalBlending,
  13. * depthTest: <bool>,
  14. * depthWrite: <bool>,
  15. *
  16. * vertexColors: <bool>,
  17. *
  18. * fog: <bool>
  19. * }
  20. */
  21. THREE.ParticleSystemMaterial = function ( parameters ) {
  22. THREE.Material.call( this );
  23. this.color = new THREE.Color( 0xffffff );
  24. this.map = null;
  25. this.size = 1;
  26. this.sizeAttenuation = true;
  27. this.vertexColors = false;
  28. this.fog = true;
  29. this.setValues( parameters );
  30. };
  31. THREE.ParticleSystemMaterial.prototype = Object.create( THREE.Material.prototype );
  32. THREE.ParticleSystemMaterial.prototype.clone = function () {
  33. var material = new THREE.ParticleSystemMaterial();
  34. THREE.Material.prototype.clone.call( this, material );
  35. material.color.copy( this.color );
  36. material.map = this.map;
  37. material.size = this.size;
  38. material.sizeAttenuation = this.sizeAttenuation;
  39. material.vertexColors = this.vertexColors;
  40. material.fog = this.fog;
  41. return material;
  42. };
  43. // backwards compatibility
  44. THREE.ParticleBasicMaterial = THREE.ParticleSystemMaterial;