XII Release 0.1.0
Loading...
Searching...
No Matches
xiiDebugRenderer Class Reference

#include <DebugRenderer.h>

Static Public Member Functions

static void ClearContext (const xiiDebugRendererContext &context)
static void DrawLines (const xiiDebugRendererContext &context, xiiArrayPtr< const xiiDebugRendererLine > lines, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity(), xiiDebugRendererDepthMode depthMode=xiiDebugRendererDepthMode::DepthTested)
 Renders the given set of lines for one frame.
static xiiResult DrawGeometry (const xiiDebugRendererContext &context, const xiiGeometry &geometry, const xiiColor &color, xiiMatOrTransform transform=xiiMat4::MakeIdentity(), xiiDebugRendererDepthMode depthMode=xiiDebugRendererDepthMode::DepthTested)
static void Draw2DLines (const xiiDebugRendererContext &context, xiiArrayPtr< const xiiDebugRendererLine > lines, const xiiColor &color)
 Renders the given set of lines in 2D (screen-space) for one frame.
static void DrawCross (const xiiDebugRendererContext &context, const xiiVec3 &vGlobalPosition, float fLineLength, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders a cross for one frame.
static void DrawLineBox (const xiiDebugRendererContext &context, const xiiBoundingBox &box, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders a wireframe box for one frame.
static void DrawLineBoxCorners (const xiiDebugRendererContext &context, const xiiBoundingBox &box, float fCornerFraction, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders the corners of a wireframe box for one frame.
static void DrawLineSphere (const xiiDebugRendererContext &context, const xiiBoundingSphere &sphere, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders a wireframe sphere for one frame.
static void DrawLineCapsuleZ (const xiiDebugRendererContext &context, float fLength, float fRadius, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders an upright wireframe capsule for one frame.
static void DrawLineCylinderZ (const xiiDebugRendererContext &context, float fLength, float fRadius, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders an upright wireframe cylinder for one frame.
static void DrawLineFrustum (const xiiDebugRendererContext &context, const xiiFrustum &frustum, const xiiColor &color, bool bDrawPlaneNormals=false)
 Renders a wireframe frustum for one frame.
static void DrawSolidBox (const xiiDebugRendererContext &context, const xiiBoundingBox &box, const xiiColor &color, xiiMatOrTransform mTransform=xiiMat4::MakeIdentity())
 Renders a solid box for one frame.
static void DrawSolidTriangles (const xiiDebugRendererContext &context, xiiArrayPtr< xiiDebugRendererTriangle > triangles, const xiiColor &color, xiiDebugRendererDepthMode depthMode=xiiDebugRendererDepthMode::DepthTested)
 Renders the set of filled triangles for one frame.
static void DrawTexturedTriangles (const xiiDebugRendererContext &context, xiiArrayPtr< xiiDebugRendererTexturedTriangle > triangles, const xiiColor &color, const xiiTexture2DResourceHandle &hTexture)
 Renders the set of textured triangles for one frame.
static void Draw2DRectangle (const xiiDebugRendererContext &context, const xiiRectFloat &rectInPixel, float fDepth, const xiiColor &color)
 Renders a filled 2D rectangle in screen-space for one frame.
static void Draw2DRectangle (const xiiDebugRendererContext &context, const xiiRectFloat &rectInPixel, float fDepth, const xiiColor &color, const xiiTexture2DResourceHandle &hTexture, xiiVec2 vScale=xiiVec2(1, 1), xiiDebugRendererDepthMode depthMode=xiiDebugRendererDepthMode::DepthTested)
 Renders a textured 2D rectangle in screen-space for one frame.
static void Draw2DRectangle (const xiiDebugRendererContext &context, const xiiRectFloat &rectInPixel, float fDepth, const xiiColor &color, xiiSharedPtr< xiiGALTextureView > pTextureView, xiiVec2 vScale=xiiVec2(1, 1), xiiDebugRendererDepthMode depthMode=xiiDebugRendererDepthMode::DepthTested)
 Renders a textured 2D rectangle in screen-space for one frame. Overlay ignores scene depth.
static void Draw2DLineRectangle (const xiiDebugRendererContext &context, const xiiRectFloat &rectInPixel, float fDepth, const xiiColor &color)
 Renders a wireframe 2D rectangle in screen-space for one frame.
static xiiUInt32 Draw2DText (const xiiDebugRendererContext &context, const xiiFormatString &text, const xiiVec2I32 &vPositionInPixel, const xiiColor &color, xiiUInt32 uiSizeInPixel=16, xiiDebugTextHAlign::Enum horizontalAlignment=xiiDebugTextHAlign::Left, xiiDebugTextVAlign::Enum verticalAlignment=xiiDebugTextVAlign::Top)
static void DrawInfoText (const xiiDebugRendererContext &context, xiiDebugTextPlacement::Enum placement, xiiStringView sGroupName, const xiiFormatString &text, const xiiColor &color=xiiColor::White)
static void AddPersistentInfoText (const xiiDebugRendererContext &context, xiiDebugTextPlacement::Enum placement, const xiiFormatString &text, xiiTime duration, const xiiColor &color=xiiColor::White)
 Same as DrawInfoText but displays the text for a certain duration.
static xiiUInt32 Draw3DText (const xiiDebugRendererContext &context, const xiiFormatString &text, const xiiVec3 &vGlobalPosition, const xiiColor &color, xiiUInt32 uiSizeInPixel=16, xiiDebugTextHAlign::Enum horizontalAlignment=xiiDebugTextHAlign::Center, xiiDebugTextVAlign::Enum verticalAlignment=xiiDebugTextVAlign::Bottom)
 Displays a string in 3D space for one frame.
static void AddPersistentCross (const xiiDebugRendererContext &context, float fSize, const xiiColor &color, xiiMatOrTransform mTransform, xiiTime duration)
 Renders a cross at the given location for as many frames until duration has passed.
static void AddPersistentLineSphere (const xiiDebugRendererContext &context, float fRadius, const xiiColor &color, xiiMatOrTransform mTransform, xiiTime duration)
 Renders a wireframe sphere at the given location for as many frames until duration has passed.
static void AddPersistentLineBox (const xiiDebugRendererContext &context, const xiiVec3 &vHalfSize, const xiiColor &color, xiiMatOrTransform mTransform, xiiTime duration)
 Renders a wireframe box at the given location for as many frames until duration has passed.
static void AddPersistentLines (const xiiDebugRendererContext &context, xiiArrayPtr< const xiiDebugRendererLine > lines, const xiiColor &color, xiiMatOrTransform mTransform, xiiTime duration)
 Renders lines at the given location for as many frames until duration has passed.
static void DrawAngle (const xiiDebugRendererContext &context, xiiAngle startAngle, xiiAngle endAngle, const xiiColor &solidColor, const xiiColor &lineColor, xiiMatOrTransform mTransform, xiiVec3 vForwardAxis=xiiVec3::MakeAxisX(), xiiVec3 vRotationAxis=xiiVec3::MakeAxisZ())
static void DrawOpeningCone (const xiiDebugRendererContext &context, xiiAngle halfAngle, const xiiColor &colorInside, const xiiColor &colorOutside, xiiMatOrTransform mTransform, xiiVec3 vForwardAxis=xiiVec3::MakeAxisX())
 Renders a cone with the tip at the center position, opening up with the given angle.
static void DrawLimitCone (const xiiDebugRendererContext &context, xiiAngle halfAngle1, xiiAngle halfAngle2, const xiiColor &solidColor, const xiiColor &lineColor, xiiMatOrTransform mTransform)
static void DrawCylinder (const xiiDebugRendererContext &context, float fRadiusStart, float fRadiusEnd, float fLength, const xiiColor &solidColor, const xiiColor &lineColor, xiiMatOrTransform mTransform, bool bCapStart=false, bool bCapEnd=false, xiiBasisAxis::Enum cylinderAxis=xiiBasisAxis::PositiveX)
static void DrawArrow (const xiiDebugRendererContext &context, float fSize, const xiiColor &color, xiiMatOrTransform mTransform, xiiVec3 vForwardAxis=xiiVec3::MakeAxisX())
 Renders a line arrow.
static float GetTextGlyphWidth (xiiUInt32 uiSizeInPixel=16U)
 Returns the width of single glyph in pixels for the given text size.
static float GetTextLineHeight (xiiUInt32 uiSizeInPixel=16U)
 Returns the line height in pixels for the given text size.
static float GetTextScale ()
 Returns the global debug text scale.
static void SetTextScale (float fScale)
 Sets the global debug text scale.
static xiiResult AddRenderGraphPasses (xiiRenderGraph &graph, xiiRenderGraphTextureHandle &color, xiiRenderGraphTextureHandle &sceneDepth)

Detailed Description

Draws simple shapes into the scene or view.

Shapes can be rendered for a single frame, or 'persistent' for a certain duration. The 'context' specifies whether shapes are generally visible in a scene, from all views, or specific to a single view. See the xiiDebugRendererContext constructors for what can be implicitly used as a context. Draws submitted before the first debug upload of a world frame are visible in all applicable views of that frame. Later submissions enter the next frame's extraction buffer. Graphs rendering the same world frame must use the same frame index.

Member Function Documentation

◆ ClearContext()

void xiiDebugRenderer::ClearContext ( const xiiDebugRendererContext & context)
static

Releases transient and persistent data for a destroyed view/world. Requires exclusive use of the context; it must not race extraction or rendering. RenderWorldModule calls this during view and world teardown.

◆ Draw2DText()

xiiUInt32 xiiDebugRenderer::Draw2DText ( const xiiDebugRendererContext & context,
const xiiFormatString & text,
const xiiVec2I32 & vPositionInPixel,
const xiiColor & color,
xiiUInt32 uiSizeInPixel = 16,
xiiDebugTextHAlign::Enum horizontalAlignment = xiiDebugTextHAlign::Left,
xiiDebugTextVAlign::Enum verticalAlignment = xiiDebugTextVAlign::Top )
static

Displays a string in screen-space for one frame.

The string may contain newlines (
) for multi-line output. If horizontal alignment is right, the entire text block is aligned according to the longest line. If vertical alignment is bottom, the entire text block is aligned there.

Data can be output as a table, by separating columns with tabs (\t). For example: "| Col 1\t| Col 2\t| Col 3\t|\n| abc\t| 42\t| 11.23\t|"

Returns the number of lines that the text was split up into.

◆ DrawAngle()

void xiiDebugRenderer::DrawAngle ( const xiiDebugRendererContext & context,
xiiAngle startAngle,
xiiAngle endAngle,
const xiiColor & solidColor,
const xiiColor & lineColor,
xiiMatOrTransform mTransform,
xiiVec3 vForwardAxis = xiiVec3::MakeAxisX(),
xiiVec3 vRotationAxis = xiiVec3::MakeAxisZ() )
static

Renders a solid 2D cone in a plane with a given angle.

The rotation goes around the given rotationAxis. An angle of zero is pointing into forwardAxis direction. Both angles may be negative.

◆ DrawCylinder()

void xiiDebugRenderer::DrawCylinder ( const xiiDebugRendererContext & context,
float fRadiusStart,
float fRadiusEnd,
float fLength,
const xiiColor & solidColor,
const xiiColor & lineColor,
xiiMatOrTransform mTransform,
bool bCapStart = false,
bool bCapEnd = false,
xiiBasisAxis::Enum cylinderAxis = xiiBasisAxis::PositiveX )
static

Renders a cylinder starting at the center position, along the +X axis.

If the start and end radius are different, a cone or arrow can be created.

◆ DrawGeometry()

xiiResult xiiDebugRenderer::DrawGeometry ( const xiiDebugRendererContext & context,
const xiiGeometry & geometry,
const xiiColor & color,
xiiMatOrTransform transform = xiiMat4::MakeIdentity(),
xiiDebugRendererDepthMode depthMode = xiiDebugRendererDepthMode::DepthTested )
static

Submits triangulated Core geometry and lines using its vertex colors multiplied by color. Copies vertices into the existing debug batches; no intermediate mesh or resource is created. Rejects invalid indices, non-triangle polygons, non-finite positions/colors/transforms, or a non-affine transform with XII_FAILURE before submitting any primitives.

◆ DrawInfoText()

void xiiDebugRenderer::DrawInfoText ( const xiiDebugRendererContext & context,
xiiDebugTextPlacement::Enum placement,
xiiStringView sGroupName,
const xiiFormatString & text,
const xiiColor & color = xiiColor::White )
static

Draws a piece of text in one of the screen corners.

Text positioning is automatic, all lines are placed in each corner such that they don't overlap. Text from different corners may overlap, though.

For text formatting options, see Draw2DText().

The sGroupName parameter is used to insert whitespace between unrelated pieces of text, it is not displayed anywhere, though.

Text size cannot be changed.

◆ DrawLimitCone()

void xiiDebugRenderer::DrawLimitCone ( const xiiDebugRendererContext & context,
xiiAngle halfAngle1,
xiiAngle halfAngle2,
const xiiColor & solidColor,
const xiiColor & lineColor,
xiiMatOrTransform mTransform )
static

Renders a bent cone with the tip at the center position, pointing into the +X direction opening up with halfAngle1 and halfAngle2 along the Y and Z axis.

If solidColor.a > 0, the cone is rendered with as solid triangles. If lineColor.a > 0, the cone is rendered as lines. Both can be combined.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Debug/DebugRenderer.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Debug/Implementation/DebugRenderer.cpp