Table of Contents

Class ImmediateDebugRenderSystem

Namespace
Stride.CommunityToolkit.DebugShapes
Assembly
Stride.CommunityToolkit.DebugShapes.dll

Provides a system for immediate debug rendering of various shapes and lines in the game world.

public class ImmediateDebugRenderSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
Inheritance
ImmediateDebugRenderSystem
Implements
Inherited Members

Constructors

ImmediateDebugRenderSystem(IServiceRegistry, RenderGroup)

Creates a new instance of the debug render system.

public ImmediateDebugRenderSystem(IServiceRegistry registry, RenderGroup renderGroup = RenderGroup.Group31)

Parameters

registry IServiceRegistry

The service registry.

renderGroup RenderGroup

The render group to use for the debug render objects.

Properties

MaxPrimitives

Maximum number of one-frame primitives stored and rendered per update.

public int MaxPrimitives { get; set; }

Property Value

int

MaxPrimitivesWithLifetime

Maximum number of lifetime-based primitives stored and rendered per update.

public int MaxPrimitivesWithLifetime { get; set; }

Property Value

int

PrimitiveColor

Default color used when a specific color is not provided for a primitive.

public Color PrimitiveColor { get; set; }

Property Value

Color

RenderGroup

Render group used for the internal debug render objects.

public RenderGroup RenderGroup { get; set; }

Property Value

RenderGroup

Methods

DrawArrow(Vector3, Vector3, float, float, Color, float, bool, bool)

Draws an arrow composed of a line and a cone tip.

public void DrawArrow(Vector3 from, Vector3 to, float coneHeight = 0.25, float coneRadius = 0.125, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

from Vector3

Arrow start position.

to Vector3

Arrow end position (tip base).

coneHeight float

Height of the cone tip.

coneRadius float

Radius of the cone tip.

color Color

Arrow color. Uses PrimitiveColor when default.

duration float

Duration in seconds the arrow remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether the cone tip is rendered solid or wireframe.

DrawBounds(Vector3, Vector3, Quaternion, Color, float, bool, bool)

Draws the box spanning two opposite corners, rotated about its centre.

public void DrawBounds(Vector3 start, Vector3 end, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

start Vector3

One corner of the box.

end Vector3

The opposite corner.

rotation Quaternion

Rotation applied to the box.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the bounds remain visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawCapsule(Vector3, float, float, Quaternion, Color, float, bool, bool)

Draws a capsule.

public void DrawCapsule(Vector3 position, float height, float radius, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Capsule center position.

height float

Capsule height.

radius float

Capsule radius.

rotation Quaternion

Rotation applied to the capsule.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the capsule remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawCircle(Vector3, float, Quaternion, Color, float, bool, bool)

Draws a circle.

public void DrawCircle(Vector3 position, float radius, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Circle center position.

radius float

Circle radius.

rotation Quaternion

Rotation applied to the circle plane.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the circle remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawCone(Vector3, float, float, Quaternion, Color, float, bool, bool)

Draws a cone.

public void DrawCone(Vector3 position, float height, float radius, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Cone center position.

height float

Cone height.

radius float

Cone base radius.

rotation Quaternion

Rotation applied to the cone.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the cone remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawCube(Vector3, Vector3, Quaternion, Color, float, bool, bool)

Draws a cube in the scene with the specified position, size, rotation, color, and rendering options.

public void DrawCube(Vector3 start, Vector3 size, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

start Vector3

The starting position of the cube, representing its center.

size Vector3

The dimensions of the cube, specified as a Vector3.

rotation Quaternion

The rotation of the cube, specified as a Quaternion. Defaults to no rotation.

color Color

The color of the cube, specified as a Color. Defaults to the primitive color.

duration float

The duration, in seconds, for which the cube will remain visible. Defaults to 0.0, meaning the cube is rendered for a single frame.

depthTest bool

A value indicating whether the cube should be rendered with depth testing. Set to true to enable depth testing; otherwise, false. Defaults to true.

solid bool

A value indicating whether the cube should be rendered as a solid shape. Set to true for solid rendering; otherwise, false for wireframe rendering. Defaults to false.

Remarks

This method allows for flexible rendering of cubes in the scene, with options for wireframe or solid rendering, depth testing, and custom colors. Use this method to visualize objects, debug spatial layouts, or create temporary visual markers.

DrawCylinder(Vector3, float, float, Quaternion, Color, float, bool, bool)

Draws a cylinder.

public void DrawCylinder(Vector3 position, float height, float radius, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Cylinder center position.

height float

Cylinder height.

radius float

Cylinder radius.

rotation Quaternion

Rotation applied to the cylinder.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the cylinder remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawHalfSphere(Vector3, float, Color, Quaternion, float, bool, bool)

Draws a half-sphere.

public void DrawHalfSphere(Vector3 position, float radius, Color color = default, Quaternion rotation = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Half-sphere center position.

radius float

Half-sphere radius.

color Color

Color. Uses PrimitiveColor when default.

rotation Quaternion

Rotation applied to the half-sphere.

duration float

Duration in seconds the half-sphere remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawLine(Vector3, Vector3, Color, float, bool)

Draws a line between two points.

public void DrawLine(Vector3 start, Vector3 end, Color color = default, float duration = 0, bool depthTest = true)

Parameters

start Vector3

Start position.

end Vector3

End position.

color Color

Line color. Uses PrimitiveColor when default.

duration float

Duration in seconds the line remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

DrawLines(Vector3[], Color?, float, bool)

Draws multiple independent line segments from a vertex list (pairs form segments).

public void DrawLines(Vector3[] vertices, Color? color = null, float duration = 0, bool depthTest = true)

Parameters

vertices Vector3[]

Array of vertices; each consecutive pair defines a line.

color Color?

Color for all lines. Uses PrimitiveColor when null.

duration float

Duration in seconds the lines remain visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

DrawQuad(Vector3, Vector2, Quaternion, Color, float, bool, bool)

Draws a quad.

public void DrawQuad(Vector3 position, Vector2 size, Quaternion rotation = default, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Quad center position.

size Vector2

Quad dimensions (X = width, Y = height).

rotation Quaternion

Rotation applied to the quad.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the quad remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

DrawRay(Vector3, Vector3, Color, float, bool)

Draws a ray from a starting point along a direction.

public void DrawRay(Vector3 start, Vector3 dir, Color color = default, float duration = 0, bool depthTest = true)

Parameters

start Vector3

Start position.

dir Vector3

Direction vector.

color Color

Ray color. Uses PrimitiveColor when default.

duration float

Duration in seconds the ray remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

DrawSphere(Vector3, float, Color, float, bool, bool)

Draws a sphere.

public void DrawSphere(Vector3 position, float radius, Color color = default, float duration = 0, bool depthTest = true, bool solid = false)

Parameters

position Vector3

Sphere center position.

radius float

Sphere radius.

color Color

Color. Uses PrimitiveColor when default.

duration float

Duration in seconds the sphere remains visible. 0 draws for a single frame.

depthTest bool

Whether depth testing is enabled.

solid bool

Whether rendered solid or wireframe.

Update(GameTime)

public override void Update(GameTime gameTime)

Parameters

gameTime GameTime