VolumeNodeMaterial.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import NodeMaterial from './NodeMaterial.js';
  2. import VolumetricLightingModel from '../../nodes/functions/VolumetricLightingModel.js';
  3. import { BackSide } from '../../constants.js';
  4. /**
  5. * Volume node material.
  6. *
  7. * @augments NodeMaterial
  8. */
  9. class VolumeNodeMaterial extends NodeMaterial {
  10. static get type() {
  11. return 'VolumeNodeMaterial';
  12. }
  13. /**
  14. * Constructs a new volume node material.
  15. *
  16. * @param {?Object} parameters - The configuration parameter.
  17. */
  18. constructor( parameters ) {
  19. super();
  20. /**
  21. * This flag can be used for type testing.
  22. *
  23. * @type {boolean}
  24. * @readonly
  25. * @default true
  26. */
  27. this.isVolumeNodeMaterial = true;
  28. /**
  29. * Number of steps used for raymarching.
  30. *
  31. * @type {number}
  32. * @default 25
  33. */
  34. this.steps = 25;
  35. /**
  36. * Node used for scattering calculations.
  37. *
  38. * @type {Function|FunctionNode<vec4>}
  39. * @default null
  40. */
  41. this.scatteringNode = null;
  42. this.lights = true;
  43. this.transparent = true;
  44. this.side = BackSide;
  45. this.depthTest = false;
  46. this.depthWrite = false;
  47. this.setValues( parameters );
  48. }
  49. setupLightingModel() {
  50. return new VolumetricLightingModel();
  51. }
  52. }
  53. export default VolumeNodeMaterial;
粤ICP备19079148号