Description
The ViewModel
field is a member of the SceneRenderLayer
enumeration in the Sandbox namespace. This layer is specifically designed to be drawn on top of all other layers, with an altered depth. It is typically used for rendering view models, such as weapon models in first-person games, ensuring they appear above other scene elements.
Usage
Use the SceneRenderLayer.ViewModel
when you need to render objects that should always appear on top of other scene elements, such as first-person weapon models or HUD elements that require depth consideration. This layer ensures that these objects are drawn last, with depth adjustments to maintain their visibility over other objects.
Example
// Example of setting a SceneObject to use the ViewModel render layer
SceneObject myWeaponModel = new SceneObject();
myWeaponModel.RenderLayer = SceneRenderLayer.ViewModel;
// This ensures the weapon model is rendered on top of other scene elements
// with the necessary depth adjustments.