Description
The DrawQuad
method is a static function in the Sandbox.Graphics
class that allows you to render a quadrilateral (quad) on the screen. This method requires a rectangle to define the quad's position and size, a material to determine the quad's appearance, a color to tint the quad, and additional rendering attributes to customize the rendering process.
Usage
To use the DrawQuad
method, you need to provide the following parameters:
rect
: A reference to a Sandbox.Rect
structure that specifies the position and size of the quad.
material
: A reference to a Sandbox.Material
object that defines the visual properties of the quad.
color
: A reference to a Color
structure that specifies the tint color to apply to the quad.
attributes
: A Sandbox.RenderAttributes
object that contains additional rendering options.
This method does not return a value.
Example
// Example of using DrawQuad
// Define the rectangle for the quad
Rect quadRect = new Rect(0, 0, 100, 100);
// Create a material for the quad
Material quadMaterial = new Material();
// Define a color to tint the quad
Color quadColor = new Color(1.0f, 0.5f, 0.5f, 1.0f); // Light red tint
// Define render attributes
RenderAttributes renderAttributes = new RenderAttributes();
// Draw the quad
Graphics.DrawQuad(ref quadRect, ref quadMaterial, ref quadColor, renderAttributes);