Class InstancedLightRenderer<T extends LightData & InstancedLightData>
java.lang.Object
foundry.veil.api.client.render.light.renderer.InstancedLightRenderer<T>
- Type Parameters:
T- The type of lights to render
- All Implemented Interfaces:
LightTypeRenderer<T>,AutoCloseable,org.lwjgl.system.NativeResource
- Direct Known Subclasses:
AreaLightRenderer,InstancedPointLightRenderer
public abstract class InstancedLightRenderer<T extends LightData & InstancedLightData>
extends Object
implements LightTypeRenderer<T>
Draws lights as instanced quads in the scene.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstancedLightRenderer(int lightSize) Creates a new instanced light renderer with a resizeable light buffer. -
Method Summary
Modifier and TypeMethodDescriptionAdds the specified light to the renderer.protected abstract com.mojang.blaze3d.vertex.MeshDatavoidfree()List<? extends LightRenderHandle<T>> protected abstract @Nullable net.minecraft.client.renderer.RenderTypegetRenderType(List<? extends LightRenderHandle<T>> lights) Calculates the render type to use for the specified lights.intvoidprepareLights(LightRenderer lightRenderer, CullFrustum frustum) Prepares the light renderer.voidrenderLights(LightRenderer lightRenderer) Renders all prepared lights with this renderer.protected abstract voidsetupBufferState(VertexArrayBuilder builder) Sets up the instanced buffer state.steal(LightRenderHandle<T> handle) Attempts to re-add the specified handle to this renderer if invalid.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.lwjgl.system.NativeResource
close
-
Field Details
-
lightSize
protected final int lightSize -
maxLights
protected int maxLights
-
-
Constructor Details
-
InstancedLightRenderer
public InstancedLightRenderer(int lightSize) Creates a new instanced light renderer with a resizeable light buffer.- Parameters:
lightSize- The size of each light in bytes
-
-
Method Details
-
createMesh
protected abstract com.mojang.blaze3d.vertex.MeshData createMesh()- Returns:
- The mesh data each instanced light will be rendered with use
-
setupBufferState
Sets up the instanced buffer state. -
getRenderType
@Nullable protected abstract @Nullable net.minecraft.client.renderer.RenderType getRenderType(List<? extends LightRenderHandle<T>> lights) Calculates the render type to use for the specified lights.- Parameters:
lights- All lights in the order they are in the instanced buffer- Returns:
- The render type to use
-
addLight
Description copied from interface:LightTypeRendererAdds the specified light to the renderer.- Specified by:
addLightin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Parameters:
light- The light to add- Returns:
- A handle to the light in the renderer
-
steal
Description copied from interface:LightTypeRendererAttempts to re-add the specified handle to this renderer if invalid.- Specified by:
stealin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Parameters:
handle- The handle to add- Returns:
- A valid handle to this renderer
-
prepareLights
Description copied from interface:LightTypeRendererPrepares the light renderer.- Specified by:
prepareLightsin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Parameters:
lightRenderer- The light renderer instancefrustum- The culling view frustum
-
renderLights
Description copied from interface:LightTypeRendererRenders all prepared lights with this renderer.
Shaders, custom uniforms, and the way lights are rendered is up to the individual renderer.- Specified by:
renderLightsin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Parameters:
lightRenderer- The light renderer instance
-
getLights
- Specified by:
getLightsin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Returns:
- A view of all lights in this renderer
-
getVisibleLights
public int getVisibleLights()- Specified by:
getVisibleLightsin interfaceLightTypeRenderer<T extends LightData & InstancedLightData>- Returns:
- The number of lights visible last frame
-
free
public void free()- Specified by:
freein interfaceorg.lwjgl.system.NativeResource
-