Class ShaderPreDefinitions
java.lang.Object
foundry.veil.api.client.render.shader.ShaderPreDefinitions
Manages pre-defined variables and data in java that can be applied to shaders.
Regular definitions are added with set(String) and set(String, String).
These schedule a shader recompilation every time they are set
so shaders can remain up-to-date.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Consumer<String> definitionCallback) Adds a listener for when a change happens.@Nullable StringgetDefinition(String name) Retrieves a definition by name.voidRemoves the definition with the specified name.voidSets the value of a definition pair.voidSets the value of a definition pair.voidSets a definition added to all shaders.voidSets a definition added to all shaders.
-
Constructor Details
-
ShaderPreDefinitions
public ShaderPreDefinitions()Creates a new set of predefinitions.
-
-
Method Details
-
addListener
Adds a listener for when a change happens.- Parameters:
definitionCallback- The callback for when definitions change ornullto ignore changes
-
set
Sets the value of a definition pair. If the value has changed, all shaders depending on it will recompile.- Parameters:
name- The name of the definition to set
-
set
Sets the value of a definition pair. If the value has changed, all shaders depending on it will recompile.- Parameters:
name- The name of the definition to setvalue- The value to associate with it
-
setStatic
Sets a definition added to all shaders. These should be treated as static final variables.- Parameters:
name- The name of the definition to set
-
setStatic
Sets a definition added to all shaders. These should be treated as static final variables.- Parameters:
name- The name of the definition to setvalue- The value to associate with it
-
remove
Removes the definition with the specified name.- Parameters:
name- The name of the definition to remove
-
getDefinition
Retrieves a definition by name.- Parameters:
name- The name of the definition- Returns:
- The definition with that name or
nullif it doesn't exist
-
getDefinitions
- Returns:
- A view of all definitions
-
getStaticDefinitions
- Returns:
- A view of all static definitions
-