PointCloudMaterial.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.PointCloudMaterial = function ( parameters ) {
  23. THREE.Material.call( this );
  24. this.type = 'PointCloudMaterial';
  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.PointCloudMaterial.prototype = Object.create( THREE.Material.prototype );
  34. THREE.PointCloudMaterial.prototype.constructor = THREE.PointCloudMaterial;
  35. THREE.PointCloudMaterial.prototype.clone = function () {
  36. var material = new THREE.PointCloudMaterial();
  37. THREE.Material.prototype.clone.call( this, material );
  38. material.color.copy( this.color );
  39. material.map = this.map;
  40. material.size = this.size;
  41. material.sizeAttenuation = this.sizeAttenuation;
  42. material.vertexColors = this.vertexColors;
  43. material.fog = this.fog;
  44. return material;
  45. };
  46. // backwards compatibility
  47. THREE.ParticleBasicMaterial = function ( parameters ) {
  48. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.' );
  49. return new THREE.PointCloudMaterial( parameters );
  50. };
  51. THREE.ParticleSystemMaterial = function ( parameters ) {
  52. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.' );
  53. return new THREE.PointCloudMaterial( parameters );
  54. };
粤ICP备19079148号