Description
The LayerType
property of the Graphics
class provides information about the current rendering layer type. This property is useful for determining whether the current rendering context is meant for drawing opaque, transparent, or shadow elements. While most of the time you may not need to interact with this property directly, it is available for situations where layer-specific rendering logic is required.
Usage
To access the current layer type, simply use the LayerType
property from the Graphics
class. This property is static, so it can be accessed without an instance of the class.
Example
// Example of accessing the LayerType property
SceneLayerType currentLayer = Graphics.LayerType;
// Use the currentLayer variable to determine rendering logic
if (currentLayer == SceneLayerType.Opaque)
{
// Perform operations specific to opaque rendering
}
else if (currentLayer == SceneLayerType.Transparent)
{
// Perform operations specific to transparent rendering
}
else if (currentLayer == SceneLayerType.Shadow)
{
// Perform operations specific to shadow rendering
}