Class ShaderUniformCache
java.lang.Object
foundry.veil.api.client.render.shader.program.ShaderUniformCache
Queries shader programs for all relevant uniform data.
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
A single uniform block in a shader program.static final record
A single uniform in a shader program.static final record
A single uniform block in a shader program. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the cache, rebuilding it the next timegetUniform(CharSequence)
is called.static String
getName
(int type) Retrieves the human-readable name of the specified GL shader type.@Nullable ShaderUniformCache.StorageBlock
getStorageBlock
(String name) Retrieves a storage block by name.@Nullable ShaderUniformCache.Uniform
getUniform
(CharSequence name) Retrieves a uniform by name.@Nullable ShaderUniformCache.UniformBlock
getUniformBlock
(String name) Retrieves a uniform block by name.boolean
hasSampler
(String name) Checks if a sampler uniform exists with the specified name.boolean
hasStorageBlock
(String name) Checks if a storage block exists by the specified name.boolean
hasUniform
(String name) Checks if a uniform exists by the specified name.boolean
hasUniformBlock
(String name) Checks if a uniform block exists by the specified name.static boolean
isSampler
(int type) Checks if the specified GL shader type is a sampler.
-
Constructor Details
-
ShaderUniformCache
-
-
Method Details
-
clear
public void clear()Clears the cache, rebuilding it the next timegetUniform(CharSequence)
is called. -
getUniform
Retrieves a uniform by name.- Parameters:
name
- The name of the uniform to get- Returns:
- The uniform found or
null
if it doesn't exist
-
hasUniform
Checks if a uniform exists by the specified name.- Parameters:
name
- The name of the uniform to check for- Returns:
- Whether that uniform exists
-
getUniformBlock
Retrieves a uniform block by name.- Parameters:
name
- The name of the uniform block to get- Returns:
- The uniform block found or
null
if it doesn't exist
-
hasUniformBlock
Checks if a uniform block exists by the specified name.- Parameters:
name
- The name of the uniform block to check for- Returns:
- Whether that uniform block exists
-
getStorageBlock
Retrieves a storage block by name.- Parameters:
name
- The name of the storage block to get- Returns:
- The storage block found or
null
if it doesn't exist
-
hasStorageBlock
Checks if a storage block exists by the specified name.- Parameters:
name
- The name of the storage block to check for- Returns:
- Whether that storage block exists
-
hasSampler
Checks if a sampler uniform exists with the specified name.- Parameters:
name
- The name of the sampler to check for- Returns:
- Whether that uniform exists and is a sampler
-
getSamplers
- Returns:
- A view of all sampler uniforms in the shader
-
getUniforms
- Returns:
- A view of all uniforms in the shader
-
getUniformBlocks
- Returns:
- A view of all uniform blocks in the shader
-
getStorageBlocks
- Returns:
- A view of all storage blocks in the shader
-
isSampler
public static boolean isSampler(int type) Checks if the specified GL shader type is a sampler.- Parameters:
type
- The type to check- Returns:
- Whether that GL type is a sampler
-
getName
Retrieves the human-readable name of the specified GL shader type.- Parameters:
type
- The type to get the name of- Returns:
- The human-readable name
-