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
registryIServiceRegistryThe service registry.
renderGroupRenderGroupThe 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
MaxPrimitivesWithLifetime
Maximum number of lifetime-based primitives stored and rendered per update.
public int MaxPrimitivesWithLifetime { get; set; }
Property Value
PrimitiveColor
Default color used when a specific color is not provided for a primitive.
public Color PrimitiveColor { get; set; }
Property Value
RenderGroup
Render group used for the internal debug render objects.
public RenderGroup RenderGroup { get; set; }
Property Value
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
fromVector3Arrow start position.
toVector3Arrow end position (tip base).
coneHeightfloatHeight of the cone tip.
coneRadiusfloatRadius of the cone tip.
colorColorArrow color. Uses PrimitiveColor when default.
durationfloatDuration in seconds the arrow remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
startVector3One corner of the box.
endVector3The opposite corner.
rotationQuaternionRotation applied to the box.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the bounds remain visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
positionVector3Capsule center position.
heightfloatCapsule height.
radiusfloatCapsule radius.
rotationQuaternionRotation applied to the capsule.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the capsule remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
positionVector3Circle center position.
radiusfloatCircle radius.
rotationQuaternionRotation applied to the circle plane.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the circle remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
positionVector3Cone center position.
heightfloatCone height.
radiusfloatCone base radius.
rotationQuaternionRotation applied to the cone.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the cone remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
startVector3The starting position of the cube, representing its center.
sizeVector3The dimensions of the cube, specified as a Vector3.
rotationQuaternionThe rotation of the cube, specified as a Quaternion. Defaults to no rotation.
colorColorThe color of the cube, specified as a Color. Defaults to the primitive color.
durationfloatThe duration, in seconds, for which the cube will remain visible. Defaults to 0.0, meaning the cube is rendered for a single frame.
depthTestboolA value indicating whether the cube should be rendered with depth testing. Set to true to enable depth testing; otherwise, false. Defaults to true.
solidboolA 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
positionVector3Cylinder center position.
heightfloatCylinder height.
radiusfloatCylinder radius.
rotationQuaternionRotation applied to the cylinder.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the cylinder remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
positionVector3Half-sphere center position.
radiusfloatHalf-sphere radius.
colorColorColor. Uses PrimitiveColor when default.
rotationQuaternionRotation applied to the half-sphere.
durationfloatDuration in seconds the half-sphere remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
startVector3Start position.
endVector3End position.
colorColorLine color. Uses PrimitiveColor when default.
durationfloatDuration in seconds the line remains visible. 0 draws for a single frame.
depthTestboolWhether 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
verticesVector3[]Array of vertices; each consecutive pair defines a line.
colorColor?Color for all lines. Uses PrimitiveColor when null.
durationfloatDuration in seconds the lines remain visible. 0 draws for a single frame.
depthTestboolWhether 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
positionVector3Quad center position.
sizeVector2Quad dimensions (X = width, Y = height).
rotationQuaternionRotation applied to the quad.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the quad remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether 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
startVector3Start position.
dirVector3Direction vector.
colorColorRay color. Uses PrimitiveColor when default.
durationfloatDuration in seconds the ray remains visible. 0 draws for a single frame.
depthTestboolWhether 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
positionVector3Sphere center position.
radiusfloatSphere radius.
colorColorColor. Uses PrimitiveColor when default.
durationfloatDuration in seconds the sphere remains visible. 0 draws for a single frame.
depthTestboolWhether depth testing is enabled.
solidboolWhether rendered solid or wireframe.
Update(GameTime)
public override void Update(GameTime gameTime)
Parameters
gameTimeGameTime