Class SceneViewState
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Culling results and draw lists for drawing a scene through one view.
public sealed class SceneViewState : IDisposableInheritance
Implements
Constructors
SceneViewState(Scene)
Initializes a view of an already initialized scene.
public SceneViewState(Scene scene)Parameters
scene Scene
Properties
HasOutlineObjects
Gets whether there are any selected nodes queued for outline rendering.
public bool HasOutlineObjects { get; }Property Value
HasWater
Gets whether any water surface is queued to draw this frame.
public bool HasWater { get; }Property Value
HasWaterEffects
Gets whether anything is queued to draw into the water effects map this frame.
public bool HasWaterEffects { get; }Property Value
LightBinner
Gets the tile and depth bin cull passes for this view of the scene.
public LightBinner LightBinner { get; }Property Value
Pvs
Gets or sets the PVS bitfield for the cluster this view looks from, empty to cull nothing.
public ReadOnlyMemory<byte> Pvs { get; set; }Property Value
Scene
Gets the scene this state draws.
public Scene Scene { get; }Property Value
WantsSceneColor
Gets whether any material drawn after the framebuffer grab samples the scene color.
public bool WantsSceneColor { get; }Property Value
WantsSceneDepth
Gets whether anything drawn after the framebuffer grab samples the scene depth.
public bool WantsSceneDepth { get; }Property Value
Methods
CollectSceneDrawCalls(Camera, Frustum?)
Frustum-culls the scene and populates the per-pass render lists for the upcoming frame.
public void CollectSceneDrawCalls(Camera camera, Frustum? cullFrustum = null)Parameters
camera Camera
The camera used to sort translucent draw calls by distance.
cullFrustum Frustum?
An optional override frustum for culling; defaults to the camera frustum.
CompactIndirectDraws()
Packs non-zero indirect draw commands together on the GPU to avoid empty draw calls.
public void CompactIndirectDraws()Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()GetFrustumCullResults(Frustum)
Returns all scene nodes whose bounding boxes intersect the given frustum, caching static results across frames when the frustum is unchanged.
public List<SceneNode> GetFrustumCullResults(Frustum frustum)Parameters
frustum Frustum
The view frustum to test against.
Returns
A list of visible scene nodes (valid until the next call to this method).
MeshletCullGpu(Frustum)
Dispatches the GPU frustum (and optional occlusion) culling compute shader.
public void MeshletCullGpu(Frustum frustum)Parameters
frustum Frustum
The view frustum used to cull meshlets.
RenderOpaqueLayer(RenderContext, Shader?)
Renders the opaque pass, optionally with a depth prepass, followed by aggregate indirect draws and static overlay geometry.
public void RenderOpaqueLayer(Scene.RenderContext renderContext, Shader? depthOnlyShader = null)Parameters
renderContext Scene.RenderContext
The render context for this pass.
depthOnlyShader Shader?
Optional depth-only shader; null for a pass that replaces material shaders.
RenderOpaqueRefractLayer(RenderContext)
Renders depth-writing geometry that samples the scene color, collected during . Runs after the framebuffer grab but before water and translucents, so those still sort against its depth.
public void RenderOpaqueRefractLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderOutlineLayer(RenderContext)
Renders all selected nodes using the outline shader to produce selection highlights.
public void RenderOutlineLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderTranslucentLayer(RenderContext)
Renders all translucent draw calls collected during .
public void RenderTranslucentLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderViewmodelOpaqueLayer(RenderContext)
Renders the opaque first-person viewmodel layer collected during . Rendered before the main scene so its reserved near depth range can never be overtaken by world geometry.
public void RenderViewmodelOpaqueLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass, expected to use the dedicated viewmodel camera and depth range.
RenderViewmodelTranslucentLayer(RenderContext)
Renders the translucent first-person viewmodel layer collected during . Rendered after the main scene (and 3D sky) translucent passes so it composites correctly on top of them.
public void RenderViewmodelTranslucentLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass, expected to use the dedicated viewmodel camera and depth range.
RenderWaterEffectsLayer(RenderContext)
Renders the draw calls that fill the water effects map; the caller owns the render target.
public void RenderWaterEffectsLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.
RenderWaterLayer(RenderContext)
Renders water draw calls collected during .
public void RenderWaterLayer(Scene.RenderContext renderContext)Parameters
renderContext Scene.RenderContext
The render context for this pass.

