Class InstancedLightRenderer<T extends Light & InstancedLight>
java.lang.Object
foundry.veil.render.deferred.light.renderer.InstancedLightRenderer<T>
- Type Parameters:
T- The type of lights to renders
- All Implemented Interfaces:
LightTypeRenderer<T>,AutoCloseable,org.lwjgl.system.NativeResource
- Direct Known Subclasses:
PointLightRenderer
public abstract class InstancedLightRenderer<T extends Light & InstancedLight>
extends Object
implements LightTypeRenderer<T>
Draws lights as instanced quads in the scene.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstancedLightRenderer(int maxLights, int lightSize) Creates a new instanced light renderer with a resizeable light buffer. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidclearRenderState(LightRenderer lightRenderer, List<T> lights) Clears the render state after drawing all lights.protected com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffervoidfree()voidrenderLights(LightRenderer lightRenderer, List<T> lights, CullFrustum frustum) Renders all specified lights with this renderer.protected abstract voidSets up the instanced buffer state.protected abstract voidsetupRenderState(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, 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 maxLights, int lightSize) Creates a new instanced light renderer with a resizeable light buffer.- Parameters:
maxLights- The maximum amount of lights that can be rendered in one draw call.lightSize- The size of each light in bytes
-
-
Method Details
-
createMesh
protected com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer 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
-
renderLights
Description copied from interface:LightTypeRendererRenders all specified 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 Light & InstancedLight>- Parameters:
lightRenderer- The light renderer instancelights- The lights to renderfrustum- The culling view frustum
-
free
public void free()- Specified by:
freein interfaceorg.lwjgl.system.NativeResource
-