Package foundry.veil.api.client.render
Class VeilRenderSystem
java.lang.Object
foundry.veil.api.client.render.VeilRenderSystem
Additional functionality for
RenderSystem.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.client.renderer.RenderStateShard.OutputStateShardOutput state for drawing into the bloom framebuffer. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic voidstatic voidbind(VeilShaderBufferLayout<?> layout) Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.static voidbind(CharSequence name, ShaderBlock<?> block) Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.static booleanstatic voidbindSamplers(int first, int... textures) Binds the specified sampler ids to sequential texture units.static voidbindSamplers(int first, IntBuffer textures) Binds the specified sampler ids to sequential texture units.static voidbindTextures(int first, int... textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.static voidbindTextures(int first, IntBuffer textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.static voidbindVertexArray(int vao) Binds the specified vertex array and invalidates the vanilla MC immediate buffer state.static voidstatic voidstatic voidstatic booleanstatic voidclose()static voidcompositeLights(net.minecraft.util.profiling.ProfilerFiller profiler) static booleanstatic booleanstatic intcreateTextures(int target) Creates a new texture for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().static voidcreateTextures(int target, int[] textures) Creates new textures for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().static voidcreateTextures(int target, IntBuffer textures) Creates new textures for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().static booleanstatic voiddrawIndirect(com.mojang.blaze3d.vertex.VertexBuffer vbo, long indirect, int drawCount, int stride) Draws indirect instances of the specified vertex buffer.static booleanstatic voiddrawInstanced(com.mojang.blaze3d.vertex.VertexBuffer vbo, int instances) Draws instances of the specified vertex buffer.static booleandrawLights(net.minecraft.util.profiling.ProfilerFiller profiler, CullFrustum cullFrustum) static voidDraws a quad onto the full screen.static voidendFrame()static voidendLastBatch(net.minecraft.client.renderer.MultiBufferSource.BufferSource source, String name) Finishes the last batch of the specified buffer builder if it has the same name.static voidendLastBatch(net.minecraft.client.renderer.MultiBufferSource.BufferSource source, net.minecraft.client.renderer.RenderType renderType) Finishes the last batch of the specified buffer builder if it is the same render type.static <T> @Nullable ShaderBlock<T> getBlock(VeilShaderBufferLayout<T> layout) Retrieves the registered block for the specified layout.static intgetBoundTexture(int target) Retrieves the texture bound to the specified target.static org.joml.Vector3fcstatic CullFrustumstatic intgetIndexCount(com.mojang.blaze3d.vertex.VertexBuffer vbo) Retrieves the number of indices in the specified vertex buffer.static org.joml.Vector3fcstatic org.joml.Vector3fcstatic NecromancerRendererstatic @Nullable ShaderProgramstatic booleanstatic booleanstatic booleanhasImGui()static voidinit()static intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic intstatic longstatic intmaxTargetBindings(int target) Retrieves the maximum bindings for the specified buffer binding.static floatstatic intstatic intstatic longstatic intstatic intstatic booleanstatic booleanstatic booleanstatic booleanstatic voidprintGlErrors(@Nullable String glCall) Consumes all OpenGL errors and prints them to console.static booleanstatic voidRebuilds all chunks in view without deleting old chunks.static voidstatic <T extends net.minecraft.client.renderer.texture.AbstractTexture & VeilPreloadedTexture>
CompletableFuture<?> registerPreloadedTexture(net.minecraft.resources.ResourceLocation path, T texture) Registers the specified texture as a preloaded texture that should be loaded on the background thread.static <T extends net.minecraft.client.renderer.texture.AbstractTexture & VeilPreloadedTexture>
CompletableFuture<?> registerPreloadedTexture(net.minecraft.resources.ResourceLocation path, T texture, Executor executor) Registers the specified texture as a preloaded texture that should be loaded on the background thread.static VeilRendererrenderer()static voidstatic Executorstatic voidresize(int width, int height) static booleanstatic voidsetCameraBobOffset(org.joml.Vector3fc offset) static @Nullable ShaderProgramsetShader(@Nullable ShaderProgram shader) Sets the shader instance to a specific instance of a shader.static @Nullable ShaderProgramsetShader(Supplier<ShaderProgram> shader) Sets the shader instance to a specific instance reference of a shader.static @Nullable ShaderProgramsetShader(net.minecraft.resources.ResourceLocation shader) Sets the shader instance to be a reference to the shader manager.static voidsetShaderLights(org.joml.Vector3fc light0, org.joml.Vector3fc light1) static VeilShaderLimitsshaderLimits(int shader) Retrieves the maximum limits for the specified shader type.static booleanstatic voidstatic booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic voidunbind(ShaderBlock<?> block) Unbinds the specified block and frees the binding it occupied.static voidunbind(VeilShaderBufferLayout<?> layout) Unbinds the specified block and frees the binding it occupied.static voidunbindSamplers(int first, int count) Unbinds the specified number of sampler from sequential texture units.static intstatic booleanstatic boolean
-
Field Details
-
BLOOM_SHARD
public static final net.minecraft.client.renderer.RenderStateShard.OutputStateShard BLOOM_SHARDOutput state for drawing into the bloom framebuffer.
-
-
Method Details
-
bindTextures
Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.- Parameters:
first- The first unit to bind totextures- The textures to bind
-
bindTextures
public static void bindTextures(int first, int... textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.- Parameters:
first- The first unit to bind totextures- The textures to bind
-
bindSamplers
Binds the specified sampler ids to sequential texture units.- Parameters:
first- The first unit to bind totextures- The samplers to bind
-
bindSamplers
public static void bindSamplers(int first, int... textures) Binds the specified sampler ids to sequential texture units.- Parameters:
first- The first unit to bind totextures- The samplers to bind
-
unbindSamplers
public static void unbindSamplers(int first, int count) Unbinds the specified number of sampler from sequential texture units.- Parameters:
first- The first unit to unbind fromcount- The number of samplers to unbind
-
registerPreloadedTexture
public static <T extends net.minecraft.client.renderer.texture.AbstractTexture & VeilPreloadedTexture> CompletableFuture<?> registerPreloadedTexture(net.minecraft.resources.ResourceLocation path, T texture) Registers the specified texture as a preloaded texture that should be loaded on the background thread.- Type Parameters:
T- The texture type to register- Parameters:
path- The name of the texture to register astexture- The texture to register- Returns:
- A future for when the texture has loaded
-
registerPreloadedTexture
public static <T extends net.minecraft.client.renderer.texture.AbstractTexture & VeilPreloadedTexture> CompletableFuture<?> registerPreloadedTexture(net.minecraft.resources.ResourceLocation path, T texture, Executor executor) Registers the specified texture as a preloaded texture that should be loaded on the background thread.- Type Parameters:
T- The texture type to register- Parameters:
path- The name of the texture to register astexture- The texture to registerexecutor- The executor to load the texture on- Returns:
- A future for when the texture has loaded
-
drawScreenQuad
public static void drawScreenQuad()Draws a quad onto the full screen. -
setShader
@Nullable public static @Nullable ShaderProgram setShader(net.minecraft.resources.ResourceLocation shader) Sets the shader instance to be a reference to the shader manager.- Parameters:
shader- The name of the shader to use- Returns:
- The Veil shader instance applied or
nullif there was an error
-
setShader
Sets the shader instance to a specific instance of a shader.setShader(ResourceLocation)should be used in most cases.- Parameters:
shader- The shader instance to use- Returns:
- The Veil shader instance applied or
nullif there was an error
-
setShader
Sets the shader instance to a specific instance reference of a shader.setShader(ResourceLocation)should be used in most cases.- Parameters:
shader- The reference to the shader to use- Returns:
- The Veil shader instance applied or
nullif there was an error
-
drawInstanced
public static void drawInstanced(com.mojang.blaze3d.vertex.VertexBuffer vbo, int instances) Draws instances of the specified vertex buffer.- Parameters:
vbo- The vertex buffer to drawinstances- The number of instances to draw- See Also:
-
drawIndirect
public static void drawIndirect(com.mojang.blaze3d.vertex.VertexBuffer vbo, long indirect, int drawCount, int stride) Draws indirect instances of the specified vertex buffer.- Parameters:
vbo- The vertex buffer to drawindirect- A pointer into the currently boundGL40C.GL_DRAW_INDIRECT_BUFFERor the address of a struct containing draw datadrawCount- The number of primitives to drawstride- The offset between indirect elements- See Also:
-
endLastBatch
public static void endLastBatch(net.minecraft.client.renderer.MultiBufferSource.BufferSource source, String name) Finishes the last batch of the specified buffer builder if it has the same name.- Parameters:
source- The source to end the buffer forname- The name of the buffer to end
-
endLastBatch
public static void endLastBatch(net.minecraft.client.renderer.MultiBufferSource.BufferSource source, net.minecraft.client.renderer.RenderType renderType) Finishes the last batch of the specified buffer builder if it is the same render type.- Parameters:
source- The source to end the buffer forrenderType- The render type to end
-
rebuildChunks
public static void rebuildChunks()Rebuilds all chunks in view without deleting old chunks. -
printGlErrors
Consumes all OpenGL errors and prints them to console.- Parameters:
glCall- The name of the OpenGL call made for extra logging ornullto not include
-
getIndexCount
public static int getIndexCount(com.mojang.blaze3d.vertex.VertexBuffer vbo) Retrieves the number of indices in the specified vertex buffer.- Parameters:
vbo- The vertex buffer to query- Returns:
- The number of indices in the buffer
-
computeSupported
public static boolean computeSupported()- Returns:
- Whether compute shaders are supported
-
atomicCounterSupported
public static boolean atomicCounterSupported()- Returns:
- Whether atomic counters in shaders are supported
-
transformFeedbackSupported
public static boolean transformFeedbackSupported()- Returns:
- Whether transform feedback from shaders is supported
-
multibindSupported
public static boolean multibindSupported()- Returns:
- Whether
ARBMultiBindis supported
-
sparseBuffersSupported
public static boolean sparseBuffersSupported()- Returns:
- Whether
ARBSparseBufferis supported
-
directStateAccessSupported
public static boolean directStateAccessSupported()- Returns:
- Whether
ARBDirectStateAccessis supported
-
separateShaderObjectsSupported
public static boolean separateShaderObjectsSupported()- Returns:
- Whether
ARBSeparateShaderObjectsis supported
-
clearTextureSupported
public static boolean clearTextureSupported()- Returns:
- Whether
ARBClearTextureis supported
-
copyImageSupported
public static boolean copyImageSupported()- Returns:
- Whether
ARBCopyImageis supported
-
shaderStorageBufferSupported
public static boolean shaderStorageBufferSupported()- Returns:
- Whether
ARBShaderStorageBufferObjectis supported
-
programInterfaceQuerySupported
public static boolean programInterfaceQuerySupported()- Returns:
- Whether
ARBProgramInterfaceQueryis supported
-
textureAnisotropySupported
public static boolean textureAnisotropySupported()- Returns:
- Whether
ARBTextureFilterAnisotropicis supported
-
textureMirrorClampToEdgeSupported
public static boolean textureMirrorClampToEdgeSupported()- Returns:
- Whether
ARBTextureMirrorClampToEdgeis supported
-
textureCubeMapSeamlessSupported
public static boolean textureCubeMapSeamlessSupported()- Returns:
- Whether
ARBSeamlessCubemapPerTextureis supported
-
textureCubeMapArraySupported
public static boolean textureCubeMapArraySupported()- Returns:
- Whether
ARBTextureCubeMapArrayis supported - Since:
- 2.1.0
-
nvDrawTextureSupported
public static boolean nvDrawTextureSupported()- Returns:
- Whether
NVDrawTextureis supported
-
drawIndirectSupported
public static boolean drawIndirectSupported()- Returns:
- Whether
ARBDrawIndirectis supported
-
multiDrawIndirectSupported
public static boolean multiDrawIndirectSupported()- Returns:
- Whether
ARBMultiDrawIndirectis supported
-
gpuShaderFloat64BitSupported
public static boolean gpuShaderFloat64BitSupported()- Returns:
- Whether
ARBGPUShaderFP64is supported
-
gpuShaderInt64BitSupported
public static boolean gpuShaderInt64BitSupported()- Returns:
- Whether
ARBGPUShaderInt64is supported
-
vertexAttribute64BitSupported
public static boolean vertexAttribute64BitSupported()- Returns:
- Whether
ARBVertexAttrib64Bitis supported
-
bindlessTextureSupported
public static boolean bindlessTextureSupported()- Returns:
- Whether
ARBBindlessTextureis supported - Since:
- 2.0.0
-
vertexType10F11F11FRevSupported
public static boolean vertexType10F11F11FRevSupported()- Returns:
- Whether
GL30C.GL_UNSIGNED_INT_10F_11F_11F_REVis supported - Since:
- 2.0.0
-
pipelineStatisticsQuerySupported
public static boolean pipelineStatisticsQuerySupported()- Returns:
- Whether
ARBPipelineStatisticsQueryis supported - Since:
- 2.0.0
-
maxCombinedTextureUnits
public static int maxCombinedTextureUnits()- Returns:
- The GL maximum number of texture units that can be bound
-
maxColorAttachments
public static int maxColorAttachments()- Returns:
- The GL maximum amount of color attachments a framebuffer can have
-
maxSamples
public static int maxSamples()- Returns:
- The GL maximum amount of samples a render buffer can have
-
maxTargetBindings
public static int maxTargetBindings(int target) Retrieves the maximum bindings for the specified buffer binding.- Parameters:
target- The target to query the maximum bindings of- Returns:
- The GL maximum amount of buffer bindings available
-
shaderLimits
Retrieves the maximum limits for the specified shader type.- Parameters:
shader- The shader to query the limits for- Returns:
- The GL limits available
-
maxTransformFeedbackBindings
public static int maxTransformFeedbackBindings()- Returns:
- The GL maximum number of transform feedback buffers bindings available
-
maxUniformBuffersBindings
public static int maxUniformBuffersBindings()- Returns:
- The GL maximum number of uniform buffers bindings available
-
maxAtomicCounterBufferBindings
public static int maxAtomicCounterBufferBindings()- Returns:
- The GL maximum number of atomic counter buffers bindings available
-
maxShaderStorageBufferBindings
public static int maxShaderStorageBufferBindings()- Returns:
- The GL maximum number of shader storage buffers bindings available
-
maxArrayTextureLayers
public static int maxArrayTextureLayers()- Returns:
- The GL maximum number of array texture layers available
-
maxTextureAnisotropy
public static float maxTextureAnisotropy()- Returns:
- The GL maximum texture anisotropy value
-
maxVertexAttributes
public static int maxVertexAttributes()- Returns:
- The GL maximum number of vertex attributes available
-
maxVertexAttributeRelativeOffset
public static int maxVertexAttributeRelativeOffset()- Returns:
- The GL maximum offset of vertex attribute relative offsets
-
maxFramebufferWidth
public static int maxFramebufferWidth()- Returns:
- The GL maximum width of framebuffers
-
maxFramebufferHeight
public static int maxFramebufferHeight()- Returns:
- The GL maximum width of framebuffers
-
maxComputeWorkGroupCountX
public static int maxComputeWorkGroupCountX()- Returns:
- The GL maximum number of work groups in the X
-
maxComputeWorkGroupCountY
public static int maxComputeWorkGroupCountY()- Returns:
- The GL maximum number of work groups in the Y
-
maxComputeWorkGroupCountZ
public static int maxComputeWorkGroupCountZ()- Returns:
- The GL maximum number of work groups in the Z
-
maxComputeWorkGroupSizeX
public static int maxComputeWorkGroupSizeX()- Returns:
- The GL maximum number of local work groups in the X
-
maxComputeWorkGroupSizeY
public static int maxComputeWorkGroupSizeY()- Returns:
- The GL maximum number of local work groups in the Y
-
maxComputeWorkGroupSizeZ
public static int maxComputeWorkGroupSizeZ()- Returns:
- The GL maximum number of local work groups in the Z
-
maxComputeWorkGroupInvocations
public static int maxComputeWorkGroupInvocations()- Returns:
- The GL maximum number of total compute shader invocations
-
maxUniformBufferSize
public static long maxUniformBufferSize()- Returns:
- The GL maximum size of uniform buffers
-
uniformBufferAlignment
public static int uniformBufferAlignment()- Returns:
- The GL offset byte alignment requirement of uniform buffers
-
maxShaderStorageBufferSize
public static long maxShaderStorageBufferSize()- Returns:
- The GL maximum size of shader storage buffers
-
bind
Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.
Make sure this is called before trying to use the block on this frame as it may have been overwritten.
This binds the block and assigns it to shader values.
- Parameters:
name- The name of the block in shader codeblock- The block to bind
-
bind
Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.
Make sure this is called before trying to use the block on this frame as it may have been overwritten.
This binds the block and assigns it to shader values.
- Parameters:
layout- The layout of the buffer to bind- Throws:
IllegalArgumentException- If the layout is not registered
-
unbind
Unbinds the specified block and frees the binding it occupied. It isn't strictly necessary to unbind blocks, but they should not be referenced anymore after being deleted.- Parameters:
block- The block to unbind
-
unbind
Unbinds the specified block and frees the binding it occupied. It isn't strictly necessary to unbind blocks, but they should not be referenced anymore after being deleted.- Parameters:
layout- The layout of the buffer to unbind- Throws:
IllegalArgumentException- If the layout is not registered
-
getBlock
@Nullable public static <T> @Nullable ShaderBlock<T> getBlock(VeilShaderBufferLayout<T> layout) throws IllegalArgumentException Retrieves the registered block for the specified layout. Make sure the layout is registered.- Type Parameters:
T- The type of data the block encodes- Parameters:
layout- The layout to retrieve the block for- Returns:
- The block created or
nullif no shaders reference the block.#buffer namespace:path - Throws:
IllegalArgumentException- If the layout is not registered
-
bindVertexArray
public static void bindVertexArray(int vao) Binds the specified vertex array and invalidates the vanilla MC immediate buffer state.- Parameters:
vao- The vao to bind
-
getBoundTexture
public static int getBoundTexture(int target) Retrieves the texture bound to the specified target.- Parameters:
target- The target to get the binding for- Returns:
- The texture bound to that target
-
createTextures
public static int createTextures(int target) Creates a new texture for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().- Parameters:
target- The target to create the texture for- Returns:
- A new texture object with its state initialized if
directStateAccessSupported()istrue
-
createTextures
public static void createTextures(int target, int[] textures) Creates new textures for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().- Parameters:
target- The target to create the texture fortextures- The array to fill with new textures
-
createTextures
Creates new textures for the specified target when using direct state access, otherwise calls the regularGL11C.glGenTextures().- Parameters:
target- The target to create the texture fortextures- The array to fill with new textures
-
renderer
- Returns:
- The veil renderer instance
-
renderThreadExecutor
- Returns:
- An executor for the main render thread
-
getShader
- Returns:
- The actual shader reference to use while rendering or
nullif no shader is selected or the selected shader is from Vanilla Minecraft
-
getLight0Direction
public static org.joml.Vector3fc getLight0Direction()- Returns:
- The position of the first light
-
getLight1Direction
public static org.joml.Vector3fc getLight1Direction()- Returns:
- The position of the second light
-
getCameraBobOffset
public static org.joml.Vector3fc getCameraBobOffset()- Returns:
- The camera position offset from view bobbing
-
hasImGui
public static boolean hasImGui()- Returns:
- Whether ImGui can be used
-
getCullingFrustum
- Returns:
- The culling frustum for the renderer
-
getNecromancerRenderer
- Returns:
- The current necromancer renderer
-
bootstrap
@Internal public static void bootstrap() -
init
@Internal public static void init() -
beginFrame
@Internal public static void beginFrame() -
endFrame
@Internal public static void endFrame() -
rebuildFonts
@Internal public static void rebuildFonts() -
clearShaderBlocks
@Internal public static void clearShaderBlocks() -
shaderUpdate
@Internal public static void shaderUpdate() -
resize
@Internal public static void resize(int width, int height) -
close
@Internal public static void close() -
renderPost
-
setShaderLights
@Internal public static void setShaderLights(org.joml.Vector3fc light0, org.joml.Vector3fc light1) -
setCameraBobOffset
@Internal public static void setCameraBobOffset(org.joml.Vector3fc offset) -
drawLights
@Internal public static boolean drawLights(net.minecraft.util.profiling.ProfilerFiller profiler, CullFrustum cullFrustum) -
compositeLights
@Internal public static void compositeLights(net.minecraft.util.profiling.ProfilerFiller profiler) -
clearLevel
@Internal public static void clearLevel()
-