Description
The DrawQuad
method is a member of the CommandList
class within the Sandbox.Rendering
namespace. This method is used to draw a quadrilateral (quad) on the screen using a specified material and color. The quad is defined by a rectangle, and the material determines the appearance of the quad, while the color can be used to tint the material.
Usage
To use the DrawQuad
method, you need to have an instance of the CommandList
class. You will also need to provide a Rect
object that defines the position and size of the quad, a Material
object that specifies the visual properties of the quad, and a Color
object to apply a color tint to the material.
Here is a step-by-step guide:
- Create or obtain a
CommandList
instance.
- Define a
Rect
that specifies the position and size of the quad.
- Choose or create a
Material
to apply to the quad.
- Select a
Color
to tint the material.
- Call the
DrawQuad
method with the Rect
, Material
, and Color
as arguments.
Example
// Example of using the DrawQuad method
// Assume commandList is an instance of CommandList
CommandList commandList = new CommandList();
// Define the rectangle for the quad
Rect quadRect = new Rect(0, 0, 100, 100);
// Create or obtain a material
Material quadMaterial = new Material();
// Define a color for tinting
Color quadColor = new Color(1.0f, 0.5f, 0.5f, 1.0f); // Light red tint
// Draw the quad
commandList.DrawQuad(quadRect, quadMaterial, quadColor);