TiledLighting.js 913 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. */
  14. export class TiledLighting extends Lighting {
  15. /**
  16. * Constructs a new lighting system.
  17. */
  18. constructor() {
  19. super();
  20. }
  21. /**
  22. * Creates a new tiled lights node for the given array of lights.
  23. *
  24. * This method is called internally by the renderer and must be overwritten by
  25. * all custom lighting implementations.
  26. *
  27. * @param {Array<Light>} lights - The render object.
  28. * @return {TiledLightsNode} The tiled lights node.
  29. */
  30. createNode( lights = [] ) {
  31. return tiledLights().setLights( lights );
  32. }
  33. }
粤ICP备19079148号