Class LightRenderer

java.lang.Object
foundry.veil.api.client.render.light.renderer.LightRenderer
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource

public final class LightRenderer extends Object implements org.lwjgl.system.NativeResource
Renders all lights in a scene.
There is no way to retrieve a light, so care should be taken to keep track of what lights have been added to the scene and when they should be removed.
  • Constructor Details

    • LightRenderer

      public LightRenderer()
      Creates a new light renderer.
  • Method Details

    • render

      @Internal public boolean render(CullFrustum frustum, AdvancedFbo lightFbo)
      Draws the lights to the specified framebuffer.
      Parameters:
      lightFbo - The framebuffer to render lights into
      Returns:
      If any lights were actually rendered
    • addLight

      public <T extends LightData> LightRenderHandle<T> addLight(T lightData)
      Adds a light to the renderer.
      Parameters:
      lightData - The light to add
    • addLight

      public <T extends LightData> LightRenderHandle<T> addLight(LightRenderHandle<T> handle)
      Attempts to re-add the specified light handle to the renderer.
      Parameters:
      handle - The handle of the light to add
      Returns:
      The same handle or a new one if re-added
    • getLights

      public <T extends LightData> Collection<? extends LightRenderHandle<T>> getLights(LightTypeRegistry.LightType<? extends T> type)
      Retrieves all lights of the specified type.
      Parameters:
      type - The type of lights to get
      Returns:
      A list of lights for the specified type in the scene
    • enableAmbientOcclusion

      public void enableAmbientOcclusion()
      Enables ambient occlusion.
    • disableAmbientOcclusion

      public void disableAmbientOcclusion()
      Disables ambient occlusion.
    • isAmbientOcclusionEnabled

      public boolean isAmbientOcclusionEnabled()
      Returns:
      Whether chunks can have ambient occlusion
    • free

      public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource
    • addDebugInfo

      @Internal public void addDebugInfo(Consumer<String> consumer)