s&box docs
API ReferenceSandbox.Rendering

public sealed class Sandbox.Rendering.CommandList

Broader workflow and conceptual references connected to this API.

Constructors

Showing 2 constructors

Methods

Showing 75 methods

public void Blit(Sandbox.Material material, Sandbox.RenderAttributes attributes = null)

Parameters

  • attributes: Default: null

public void ClearRenderTarget()

Set the current render target. Setting this will bind the render target and change the viewport to match it.

public void DispatchComputeIndirect(Sandbox.ComputeShader compute, Sandbox.GpuBuffer indirectBuffer, uint indirectElementOffset = 0)

Parameters

  • indirectElementOffset: Default: 0

public void Draw(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.Material material, int startVertex = 0, int vertexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)

Parameters

  • startVertex: Default: 0
  • vertexCount: Default: 0
  • attributes: Default: null
  • primitiveType: Default: 5

public void DrawIndexed(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, int startIndex = 0, int indexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)

Parameters

  • startIndex: Default: 0
  • indexCount: Default: 0
  • attributes: Default: null
  • primitiveType: Default: 5

public void DrawIndexedInstanced(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, int instanceCount, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)

Draws indexed geometry with instancing. Each instance shares the same index buffer.

Parameters

  • attributes: Default: null
  • primitiveType: Default: 5

public void DrawModel(Sandbox.Model model, Transform transform, Sandbox.RenderAttributes attributes = null)

Draws a single model at the given Transform immediately.

Parameters

  • model: The model to draw
  • transform: Transform to draw the model at
  • attributes: Optional attributes to apply only for this draw call Default: null

public void DrawModelInstancedIndirect(Sandbox.Model model, Sandbox.GpuBuffer buffer, int bufferOffset = 0, Sandbox.RenderAttributes attributes = null)

Draws multiple instances of a model using GPU instancing with the number of instances being provided by indirect draw arguments. Use `SV_InstanceID` semantic in shaders to access the rendered instance.

Parameters

  • model: The model to draw
  • buffer: The GPU buffer containing the DrawIndirectArguments
  • bufferOffset: Optional offset in the GPU buffer Default: 0
  • attributes: Optional attributes to apply only for this draw call Default: null

public void DrawReflection(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ReflectionSetup reflectionSetup = null)

Render a planar reflection using the specified camera and the specified plane.

Parameters

  • reflectionSetup: Default: null

public void DrawRefraction(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.RefractionSetup refractionSetup = null)

Render a planar refraction using the specified camera and the specified plane. This is for all intents and purposes a regular view with a plane clipping it. Usually used for rendering under water.

Parameters

  • refractionSetup: Default: null

public void DrawRenderer(Sandbox.Renderer renderer, Sandbox.Rendering.RendererSetup rendererSetup = null)

Render a `Sandbox.Renderer` with the specified overrides.

Parameters

  • rendererSetup: Default: null

public void DrawScreenQuad(Sandbox.Material material, Color color)

public void DrawText(Sandbox.TextRendering.Scope scope, Sandbox.Rect rect, Sandbox.TextFlag flags = 33)

Draws text within a rectangle using a prepared `Sandbox.TextRendering.Scope`.

Parameters

  • scope: The text rendering scope.
  • rect: The rectangle to draw the text in.
  • flags: Text alignment flags (optional). Default: 33

public void DrawView(Sandbox.CameraComponent camera, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ViewSetup viewSetup = null)

Renders the view from a camera to the specified render target.

Parameters

  • viewSetup: Default: null

public Sandbox.Rendering.RenderTargetHandle GrabDepthTexture(string token)Obsolete

Takes a copy of the depthbuffer and returns a handle to it

Obsolete: This API member is obsolete.

public Sandbox.Rendering.RenderTargetHandle GrabFrameTexture(string token, bool withMips = False)Obsolete

Takes a copy of the framebuffer and returns a handle to it

Obsolete: This API member is obsolete.

Parameters

  • withMips: Generates mipmaps on the grabbed texture filtered with gaussian blur for each mip Default: False

public void InsertList(Sandbox.Rendering.CommandList otherBuffer)

Run this CommandList here

public void ReleaseRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)

We're no longer using this RT, return it to the pool

public void Reset()

public void SetConstantBuffer(Sandbox.StringToken token, T data)Obsolete

Obsolete: This API member is obsolete.

public Sandbox.Rendering.RenderTargetHandle.SizeHandle ViewportSizeScaled(int divisor)

A handle to the viewport size divided by a factor. Useful for dispatching at half or quarter resolution.

Properties

Showing 7 properties

public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.Attributes { get; set; }

Access to the local attributes. What these are depends on where the command list is being called. If we're calling from a renderable, these are the attributes for that renderable.

public string Sandbox.Rendering.CommandList.DebugName { get; set; }

public bool Sandbox.Rendering.CommandList.Enabled { get; set; }

public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.GlobalAttributes { get; set; }

These are the attributes for the current view. Setting a variable here will let you pass it down to other places in the render pipeline.

public Sandbox.Rendering.HudPainter Sandbox.Rendering.CommandList.Paint { get; set; }

Access to simple 2D painting functions to draw shapes and text.

Metadata

FieldValue
NamespaceSandbox.Rendering
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Rendering.CommandList

On this page

Constructorspublic CommandList()public CommandList(System.String debugName)Methodspublic System.Void Blit(Sandbox.Material material, Sandbox.RenderAttributes attributes = null)public System.Void Clear(Color color, System.Boolean clearColor = True, System.Boolean clearDepth = True, System.Boolean clearStencil = True)public System.Void Clear(Sandbox.GpuBuffer buffer, System.UInt32 value = 0)public System.Void Clear(Sandbox.Rendering.RenderTargetHandle handle, Color color = null)public System.Void Clear(Sandbox.Texture texture, Color color = null)public System.Void ClearRenderTarget()public System.Void DispatchCompute(Sandbox.ComputeShader compute, Sandbox.Rendering.RenderTargetHandle.SizeHandle dimension)public System.Void DispatchCompute(Sandbox.ComputeShader compute, System.Int32 threadsX, System.Int32 threadsY, System.Int32 threadsZ)public System.Void DispatchComputeIndirect(Sandbox.ComputeShader compute, Sandbox.GpuBuffer indirectBuffer, System.UInt32 indirectElementOffset = 0)public System.Void Draw(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.Material material, System.Int32 startVertex = 0, System.Int32 vertexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexed(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, System.Int32 startIndex = 0, System.Int32 indexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstanced(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, System.Int32 instanceCount, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstancedIndirect(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstancedIndirect(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawInstancedIndirect(Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawInstancedIndirect(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawModel(Sandbox.Model model, Transform transform, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstanced(Sandbox.Model model, System.Int32 count, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstanced(Sandbox.Model model, System.Span`1<Transform> transforms, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstancedIndirect(Sandbox.Model model, Sandbox.GpuBuffer buffer, System.Int32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null)public System.Void DrawQuad(Sandbox.Rect rect, Sandbox.Material material, Color color)public System.Void DrawReflection(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ReflectionSetup reflectionSetup = null)public System.Void DrawRefraction(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.RefractionSetup refractionSetup = null)public System.Void DrawRenderer(Sandbox.Renderer renderer, Sandbox.Rendering.RendererSetup rendererSetup = null)public System.Void DrawScreenQuad(Sandbox.Material material, Color color)public System.Void DrawText(Sandbox.TextRendering.Scope scope, Sandbox.Rect rect, Sandbox.TextFlag flags = 33)public System.Void DrawView(Sandbox.CameraComponent camera, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ViewSetup viewSetup = null)public System.Void GenerateMipMaps(Sandbox.Rendering.RenderTargetHandle handle, Sandbox.Graphics.DownsampleMethod method = 1)public System.Void GenerateMipMaps(Sandbox.RenderTarget target, Sandbox.Graphics.DownsampleMethod method = 1)public System.Void GenerateMipMaps(Sandbox.Texture texture, Sandbox.Graphics.DownsampleMethod method = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, Sandbox.ImageFormat format, System.Int32 numMips = 1, System.Int32 sizeFactor = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, System.Int32 sizeFactor = 1, Sandbox.ImageFormat colorFormat = -2, Sandbox.ImageFormat depthFormat = -2, Sandbox.MultisampleAmount msaa = 6, System.Int32 numMips = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, System.Int32 width, System.Int32 height, Sandbox.ImageFormat colorFormat = -2, Sandbox.ImageFormat depthFormat = -2, Sandbox.MultisampleAmount msaa = 6, System.Int32 numMips = 1)public Sandbox.Rendering.RenderTargetHandle GrabDepthTexture(System.String token)public Sandbox.Rendering.RenderTargetHandle GrabFrameTexture(System.String token, System.Boolean withMips = False)public System.Void InsertList(Sandbox.Rendering.CommandList otherBuffer)public System.Void ReleaseRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)public System.Void Reset()public System.Void ResourceBarrierTransition(Sandbox.GpuBuffer buffer, Sandbox.Rendering.ResourceState before, Sandbox.Rendering.ResourceState after)public System.Void ResourceBarrierTransition(Sandbox.GpuBuffer buffer, Sandbox.Rendering.ResourceState state)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle handle, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle.ColorTextureRef texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle.DepthTextureRef texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Texture texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void Set(Sandbox.StringToken token, Matrix matrix)public System.Void Set(Sandbox.StringToken token, Sandbox.GpuBuffer buffer)public System.Void Set(Sandbox.StringToken token, Sandbox.Rendering.RenderTargetHandle.ColorTextureRef buffer, System.Int32 mip = -1)public System.Void Set(Sandbox.StringToken token, Sandbox.Texture texture)public System.Void Set(Sandbox.StringToken token, System.Boolean b)public System.Void Set(Sandbox.StringToken token, System.Double f)public System.Void Set(Sandbox.StringToken token, System.Int32 i)public System.Void Set(Sandbox.StringToken token, System.Single f)public System.Void Set(Sandbox.StringToken token, Vector2 vector2)public System.Void Set(Sandbox.StringToken token, Vector3 vector3)public System.Void Set(Sandbox.StringToken token, Vector4 vector4)public System.Void SetCombo(Sandbox.StringToken token, System.Boolean value)public System.Void SetCombo(Sandbox.StringToken token, System.Int32 value)public System.Void SetCombo(Sandbox.StringToken token, T t)public System.Void SetConstantBuffer(Sandbox.StringToken token, T data)public System.Void SetGlobal(Sandbox.StringToken token, Matrix matrix)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.GpuBuffer buffer)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.Rendering.RenderTargetHandle.ColorIndexRef buffer)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.Texture texture)public System.Void SetGlobal(Sandbox.StringToken token, System.Boolean b)public System.Void SetGlobal(Sandbox.StringToken token, System.Double f)public System.Void SetGlobal(Sandbox.StringToken token, System.Int32 i)public System.Void SetGlobal(Sandbox.StringToken token, System.Single f)public System.Void SetGlobal(Sandbox.StringToken token, Vector2 vector2)public System.Void SetGlobal(Sandbox.StringToken token, Vector3 vector3)public System.Void SetGlobal(Sandbox.StringToken token, Vector4 vector4)public System.Void SetRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)public System.Void SetRenderTarget(Sandbox.RenderTarget target)public System.Void UavBarrier(Sandbox.GpuBuffer buffer)public System.Void UavBarrier(Sandbox.Texture texture)public Sandbox.Rendering.RenderTargetHandle.SizeHandle ViewportSizeScaled(System.Int32 divisor)Propertiespublic Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.Attributes { get; set; }public System.String Sandbox.Rendering.CommandList.DebugName { get; set; }public System.Boolean Sandbox.Rendering.CommandList.Enabled { get; set; }public Sandbox.Rendering.CommandList.Flag Sandbox.Rendering.CommandList.Flags { get; set; }public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.GlobalAttributes { get; set; }public Sandbox.Rendering.HudPainter Sandbox.Rendering.CommandList.Paint { get; set; }public Sandbox.Rendering.RenderTargetHandle.SizeHandle Sandbox.Rendering.CommandList.ViewportSize { get; set; }Metadata