Description
The Attributes
property provides access to the current render context's attributes. These attributes are utilized to set parameters in materials and shaders during rendering. The attributes are automatically cleared at the end of each render block, ensuring that they do not persist beyond their intended scope.
Usage
Use the Attributes
property to modify or access rendering attributes that are relevant to the current rendering context. This is particularly useful when you need to dynamically adjust shader parameters or material properties during rendering operations.
Example
// Example of using the Attributes property
// Set a custom attribute for the current render context
Graphics.Attributes.Set("CustomAttribute", 1.0f);
// Retrieve an attribute value
float customValue = Graphics.Attributes.GetFloat("CustomAttribute");
// Use the attribute in a rendering operation
Graphics.DrawModel(myModel, myTransform, Graphics.Attributes);