Class IndirectLightRenderer<T extends Light & IndirectLight<T>>
java.lang.Object
foundry.veil.api.client.render.light.renderer.IndirectLightRenderer<T>
- Type Parameters:
T
- The type of lights to render
- All Implemented Interfaces:
LightTypeRenderer<T>
,AutoCloseable
,org.lwjgl.system.NativeResource
- Direct Known Subclasses:
IndirectPointLightRenderer
public abstract class IndirectLightRenderer<T extends Light & IndirectLight<T>>
extends Object
implements LightTypeRenderer<T>
Draws lights as indirect instanced quads in the scene.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
protected final int
protected final int
protected int
protected final int
protected final int
-
Constructor Summary
ConstructorDescriptionIndirectLightRenderer
(int lightSize, int lowResSize, int positionOffset, int rangeOffset) Creates a new instanced light renderer with a resizeable light buffer. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
clearRenderState
(LightRenderer lightRenderer, List<T> lights) Clears the render state after drawing all lights.protected abstract com.mojang.blaze3d.vertex.MeshData
void
free()
int
static boolean
void
prepareLights
(LightRenderer lightRenderer, List<T> lights, Set<T> removedLights, CullFrustum frustum) Prepares the specified lights to be rendered.void
renderLights
(LightRenderer lightRenderer, List<T> lights) Renders all prepared lights with this renderer.protected abstract void
Sets up the instanced buffer state.protected abstract void
setupRenderState
(LightRenderer lightRenderer, List<T> lights) Sets up the render state for drawing all lights.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Field Details
-
lightSize
protected final int lightSize -
highResSize
protected final int highResSize -
lowResSize
protected final int lowResSize -
positionOffset
protected final int positionOffset -
rangeOffset
protected final int rangeOffset -
maxLights
protected int maxLights
-
-
Constructor Details
-
IndirectLightRenderer
public IndirectLightRenderer(int lightSize, int lowResSize, int positionOffset, int rangeOffset) Creates a new instanced light renderer with a resizeable light buffer.- Parameters:
lightSize
- The size of each light in byteslowResSize
- The size of the low-resolution mesh or0
to only use the high-detail mesh
-
-
Method Details
-
createMesh
protected abstract com.mojang.blaze3d.vertex.MeshData createMesh()- Returns:
- The mesh data each instanced light will be rendered with use
-
setupBufferState
protected abstract void setupBufferState()Sets up the instanced buffer state. -
setupRenderState
Sets up the render state for drawing all lights.- Parameters:
lightRenderer
- The renderer instancelights
- All lights in the order they are in the instanced buffer
-
clearRenderState
Clears the render state after drawing all lights.- Parameters:
lightRenderer
- The renderer instancelights
- All lights in the order they are in the instanced buffer
-
prepareLights
public void prepareLights(LightRenderer lightRenderer, List<T> lights, Set<T> removedLights, CullFrustum frustum) Description copied from interface:LightTypeRenderer
Prepares the specified lights to be rendered.- Specified by:
prepareLights
in interfaceLightTypeRenderer<T extends Light & IndirectLight<T>>
- Parameters:
lightRenderer
- The light renderer instancelights
- The lights to renderremovedLights
- The lights that will be removed this framefrustum
- The culling view frustum
-
renderLights
Description copied from interface:LightTypeRenderer
Renders all prepared lights with this renderer.
Shaders, custom uniforms, and the way lights are rendered is up to the individual renderer.
- Specified by:
renderLights
in interfaceLightTypeRenderer<T extends Light & IndirectLight<T>>
- Parameters:
lightRenderer
- The light renderer instancelights
- The lights to render
-
getVisibleLights
public int getVisibleLights()- Specified by:
getVisibleLights
in interfaceLightTypeRenderer<T extends Light & IndirectLight<T>>
- Returns:
- The number of lights visible last frame
-
free
public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-
isSupported
public static boolean isSupported()- Returns:
- Whether this renderer is supported
-