Plasma Engine  2.0
Loading...
Searching...
No Matches
plDebugRenderer Class Reference

Draws simple shapes into the scene or view. More...

#include <DebugRenderer.h>

Classes

struct  Line
 
struct  TexturedTriangle
 
struct  Triangle
 

Static Public Member Functions

static void DrawLines (const plDebugRendererContext &context, plArrayPtr< const Line > lines, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders the given set of lines for one frame.
 
static void Draw2DLines (const plDebugRendererContext &context, plArrayPtr< const Line > lines, const plColor &color)
 Renders the given set of lines in 2D (screen-space) for one frame.
 
static void DrawCross (const plDebugRendererContext &context, const plVec3 &vGlobalPosition, float fLineLength, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders a cross for one frame.
 
static void DrawLineBox (const plDebugRendererContext &context, const plBoundingBox &box, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders a wireframe box for one frame.
 
static void DrawLineBoxCorners (const plDebugRendererContext &context, const plBoundingBox &box, float fCornerFraction, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders the corners of a wireframe box for one frame.
 
static void DrawLineSphere (const plDebugRendererContext &context, const plBoundingSphere &sphere, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders a wireframe sphere for one frame.
 
static void DrawLineCapsuleZ (const plDebugRendererContext &context, float fLength, float fRadius, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders an upright wireframe capsule for one frame.
 
static void DrawLineCylinderZ (const plDebugRendererContext &context, float fLength, float fRadius, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders an upright wireframe cylinder for one frame.
 
static void DrawLineFrustum (const plDebugRendererContext &context, const plFrustum &frustum, const plColor &color, bool bDrawPlaneNormals=false)
 Renders a wireframe frustum for one frame.
 
static void DrawSolidBox (const plDebugRendererContext &context, const plBoundingBox &box, const plColor &color, const plTransform &transform=plTransform::MakeIdentity())
 Renders a solid box for one frame.
 
static void DrawSolidTriangles (const plDebugRendererContext &context, plArrayPtr< Triangle > triangles, const plColor &color)
 Renders the set of filled triangles for one frame.
 
static void DrawTexturedTriangles (const plDebugRendererContext &context, plArrayPtr< TexturedTriangle > triangles, const plColor &color, const plTexture2DResourceHandle &hTexture)
 Renders the set of textured triangles for one frame.
 
static void Draw2DRectangle (const plDebugRendererContext &context, const plRectFloat &rectInPixel, float fDepth, const plColor &color)
 Renders a filled 2D rectangle in screen-space for one frame.
 
static void Draw2DRectangle (const plDebugRendererContext &context, const plRectFloat &rectInPixel, float fDepth, const plColor &color, const plTexture2DResourceHandle &hTexture, plVec2 vScale=plVec2(1, 1))
 Renders a textured 2D rectangle in screen-space for one frame.
 
static void Draw2DRectangle (const plDebugRendererContext &context, const plRectFloat &rectInPixel, float fDepth, const plColor &color, plGALTextureResourceViewHandle hResourceView, plVec2 vScale=plVec2(1, 1))
 Renders a textured 2D rectangle in screen-space for one frame.
 
static plUInt32 Draw2DText (const plDebugRendererContext &context, const plFormatString &text, const plVec2I32 &vPositionInPixel, const plColor &color, plUInt32 uiSizeInPixel=16, plDebugTextHAlign::Enum horizontalAlignment=plDebugTextHAlign::Left, plDebugTextVAlign::Enum verticalAlignment=plDebugTextVAlign::Top)
 Displays a string in screen-space for one frame.
 
static void DrawInfoText (const plDebugRendererContext &context, plDebugTextPlacement::Enum placement, plStringView sGroupName, const plFormatString &text, const plColor &color=plColor::White)
 Draws a piece of text in one of the screen corners.
 
static plUInt32 Draw3DText (const plDebugRendererContext &context, const plFormatString &text, const plVec3 &vGlobalPosition, const plColor &color, plUInt32 uiSizeInPixel=16, plDebugTextHAlign::Enum horizontalAlignment=plDebugTextHAlign::Center, plDebugTextVAlign::Enum verticalAlignment=plDebugTextVAlign::Bottom)
 Displays a string in 3D space for one frame.
 
static void AddPersistentCross (const plDebugRendererContext &context, float fSize, const plColor &color, const plTransform &transform, plTime duration)
 Renders a cross at the given location for as many frames until duration has passed.
 
static void AddPersistentLineSphere (const plDebugRendererContext &context, float fRadius, const plColor &color, const plTransform &transform, plTime duration)
 Renders a wireframe sphere at the given location for as many frames until duration has passed.
 
static void AddPersistentLineBox (const plDebugRendererContext &context, const plVec3 &vHalfSize, const plColor &color, const plTransform &transform, plTime duration)
 Renders a wireframe box at the given location for as many frames until duration has passed.
 
static void DrawAngle (const plDebugRendererContext &context, plAngle startAngle, plAngle endAngle, const plColor &solidColor, const plColor &lineColor, const plTransform &transform, plVec3 vForwardAxis=plVec3::MakeAxisX(), plVec3 vRotationAxis=plVec3::MakeAxisZ())
 Renders a solid 2D cone in a plane with a given angle.
 
static void DrawOpeningCone (const plDebugRendererContext &context, plAngle halfAngle, const plColor &colorInside, const plColor &colorOutside, const plTransform &transform, plVec3 vForwardAxis=plVec3::MakeAxisX())
 Renders a cone with the tip at the center position, opening up with the given angle.
 
static void DrawLimitCone (const plDebugRendererContext &context, plAngle halfAngle1, plAngle halfAngle2, const plColor &solidColor, const plColor &lineColor, const plTransform &transform)
 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.
 
static void DrawCylinder (const plDebugRendererContext &context, float fRadiusStart, float fRadiusEnd, float fLength, const plColor &solidColor, const plColor &lineColor, const plTransform &transform, bool bCapStart=false, bool bCapEnd=false)
 Renders a cylinder starting at the center position, along the +X axis.
 
static void DrawArrow (const plDebugRendererContext &context, float fSize, const plColor &color, const plTransform &transform, plVec3 vForwardAxis=plVec3::MakeAxisX())
 Renders a line arrow.
 
static float GetTextGlyphWidth (plUInt32 uiSizeInPixel=16)
 Returns the width of single glyph in pixels for the given text size.
 
static float GetTextLineHeight (plUInt32 uiSizeInPixel=16)
 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.
 

Friends

class plSimpleRenderPass
 

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 plDebugRendererContext constructors for what can be implicitly used as a context.

Member Function Documentation

◆ Draw2DText()

plUInt32 plDebugRenderer::Draw2DText ( const plDebugRendererContext & context,
const plFormatString & text,
const plVec2I32 & vPositionInPixel,
const plColor & color,
plUInt32 uiSizeInPixel = 16,
plDebugTextHAlign::Enum horizontalAlignment = plDebugTextHAlign::Left,
plDebugTextVAlign::Enum verticalAlignment = plDebugTextVAlign::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 plDebugRenderer::DrawAngle ( const plDebugRendererContext & context,
plAngle startAngle,
plAngle endAngle,
const plColor & solidColor,
const plColor & lineColor,
const plTransform & transform,
plVec3 vForwardAxis = plVec3::MakeAxisX(),
plVec3 vRotationAxis = plVec3::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 plDebugRenderer::DrawCylinder ( const plDebugRendererContext & context,
float fRadiusStart,
float fRadiusEnd,
float fLength,
const plColor & solidColor,
const plColor & lineColor,
const plTransform & transform,
bool bCapStart = false,
bool bCapEnd = false )
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.

◆ DrawInfoText()

void plDebugRenderer::DrawInfoText ( const plDebugRendererContext & context,
plDebugTextPlacement::Enum placement,
plStringView sGroupName,
const plFormatString & text,
const plColor & color = plColor::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 groupName parameter is used to insert whitespace between unrelated pieces of text, it is not displayed anywhere, though.

Text size cannot be changed.

◆ DrawLimitCone()

void plDebugRenderer::DrawLimitCone ( const plDebugRendererContext & context,
plAngle halfAngle1,
plAngle halfAngle2,
const plColor & solidColor,
const plColor & lineColor,
const plTransform & transform )
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: