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

public class LightRenderer extends Object implements org.lwjgl.system.NativeResource
Renders all lights in a scene.

Lights can be added with addLight(Light), and subsequently removed with removeLight(Light). Lights are automatically updated the next time render(AdvancedFbo) is called if Light.isDirty() is true.

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

    • applyShader

      public void applyShader()
      Applies the shader set to VeilRenderSystem.
    • setup

      @Internal public void setup(CullFrustum frustum)
    • clear

      @Internal public void clear()
    • render

      @Internal public void render(AdvancedFbo framebuffer)
    • addLight

      public void addLight(Light light)
      Adds a light to the renderer.
      Parameters:
      light - The light to add
    • removeLight

      public <T extends Light> void removeLight(T light)
      Removes the specified light from the renderer.
      Parameters:
      light - The light to remove
    • getLights

      public <T extends Light> List<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
    • enableVanillaLight

      public void enableVanillaLight()
      Enables the vanilla lightmap and directional shading.
    • disableVanillaLight

      public void disableVanillaLight()
      Disables the vanilla lightmap and directional shading.
    • enableAmbientOcclusion

      public void enableAmbientOcclusion()
      Enables ambient occlusion.
    • disableAmbientOcclusion

      public void disableAmbientOcclusion()
      Disables ambient occlusion.
    • getFramebuffer

      @Nullable public @Nullable AdvancedFbo getFramebuffer()
      Returns:
      The deferred framebuffer being read from
    • isVanillaLightEnabled

      public boolean isVanillaLightEnabled()
      Returns:
      Whether the vanilla lighting is enabled
    • 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)