void Clear( Color color, bool clearColor, bool clearDepth, bool clearStencil )

robot_2Generated
code_blocksInput

Description

The Clear method in the Sandbox.Rendering.CommandList class is used to clear the current render target. This method allows you to specify a color to clear to, and whether to clear the color, depth, and stencil buffers.

Usage

To use the Clear method, you need to create an instance of the CommandList class. Then, call the Clear method with the desired parameters:

  • color: A Color object representing the color to clear the render target to.
  • clearColor: A bool indicating whether the color buffer should be cleared.
  • clearDepth: A bool indicating whether the depth buffer should be cleared.
  • clearStencil: A bool indicating whether the stencil buffer should be cleared.

Example

// Create a new CommandList instance
CommandList commandList = new CommandList();

// Define the clear color
Color clearColor = new Color(0.0f, 0.0f, 0.0f, 1.0f); // Black with full opacity

// Clear the render target with the specified color, depth, and stencil
commandList.Clear(clearColor, true, true, true);