TiledLighting.js 1002 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Lighting } from 'three/webgpu';
  2. import { tiledLights } from '../tsl/lighting/TiledLightsNode.js';
  3. /**
  4. * A custom lighting implementation based on Tiled-Lighting that overwrites the default
  5. * implementation in {@link WebGPURenderer}.
  6. *
  7. * ```js
  8. * const lighting = new TiledLighting();
  9. * renderer.lighting = lighting; // set lighting system
  10. * ```
  11. *
  12. * @augments Lighting
  13. * @three_import import { TiledLighting } from 'three/addons/lighting/TiledLighting.js';
  14. */
  15. export class TiledLighting extends Lighting {
  16. /**
  17. * Constructs a new lighting system.
  18. */
  19. constructor() {
  20. super();
  21. }
  22. /**
  23. * Creates a new tiled lights node for the given array of lights.
  24. *
  25. * This method is called internally by the renderer and must be overwritten by
  26. * all custom lighting implementations.
  27. *
  28. * @param {Array<Light>} lights - The render object.
  29. * @return {TiledLightsNode} The tiled lights node.
  30. */
  31. createNode( lights = [] ) {
  32. return tiledLights().setLights( lights );
  33. }
  34. }