class
#include <esp/gfx/DebugLineRender.h>
DebugLineRender Singleton utility class for on-the-fly rendering of lines (e.g. every frame). This is intended for debugging or simple UX for prototype apps. The API prioritizes ease-of-use over maximum runtime performance.
It's easy to add new primitives here; see drawCircle as a reference. In addition, if you're interested to integrate Magnum's line-based primitives, see src/deps/magnum/doc/generated/primitives.cpp and also this discussion: https://github.com/facebookresearch/habitat-sim/pull/1349#discussion_
Constructors, destructors, conversion operators
- DebugLineRender()
- Constructor. This allocates GPU resources so it should persist frame-to-frame (don't recreate it every frame).
- DebugLineRender(const DebugLineRender&) deleted
- Copying is not allowed.
Public functions
- void releaseGLResources()
- Release GPU resources.
- auto operator=(const DebugLineRender&) -> DebugLineRender& deleted
- Copying is not allowed.
- void setLineWidth(float lineWidth)
- Set line width in pixels (approximate).
-
void drawLine(const Magnum::
Vector3& from, const Magnum:: Vector3& to, const Magnum:: Color4& color) - Draw a line segment in world-space (ignores pushTransform).
-
void drawLine(const Magnum::
Vector3& from, const Magnum:: Vector3& to, const Magnum:: Color4& fromColor, const Magnum:: Color4& toColor) - Draw a line segment in world-space.
-
void flushLines(const Magnum::
Matrix4& camMatrix, const Magnum:: Matrix4& projMatrix, const Magnum:: Vector2i& viewport) - Submit lines to the GL renderer. Call this once per frame. Because this uses transparency, you should ideally call this after submitting opaque scene geometry.
-
void flushLines(const Magnum::
Matrix4& projCamMatrix, const Magnum:: Vector2i& viewport) -
void pushTransform(const Magnum::
Matrix4& transform) - Push (multiply) a transform onto the transform stack, affecting all line-drawing until popped. Must be paired with popTransform(). For example, push an object's local-to-world transform and then use drawTransformedLine to draw lines in the object's local space.
- void popTransform()
- See also pushTransform.
-
void drawTransformedLine(const Magnum::
Vector3& from, const Magnum:: Vector3& to, const Magnum:: Color4& color) - Draw a line segment in world-space or local-space (see pushTransform).
-
void drawTransformedLine(const Magnum::
Vector3& from, const Magnum:: Vector3& to, const Magnum:: Color4& fromColor, const Magnum:: Color4& toColor) - Draw a line segment in world-space or local-space (see pushTransform).
-
void drawBox(const Magnum::
Vector3& min, const Magnum:: Vector3& max, const Magnum:: Color4& color) - Draw a box in world-space or local-space (see pushTransform).
-
void drawCircle(const Magnum::
Vector3& pos, float radius, const Magnum:: Color4& color, int numSegments = 24, const Magnum:: Vector3& normal = Magnum:: Vector3(0.0, 1.0, 0.0)) - Draw a circle in world-space or local-space (see pushTransform). The circle is an approximation; see numSegments.
-
void drawCone(const Magnum::
Vector3& pos, const Magnum:: Vector3& apex, float radius, const Magnum:: Color4& color, int numSegments = 24, const Magnum:: Vector3& normal = Magnum:: Vector3(0.0, 1.0, 0.0)) - Draw a cone in world-space or local-space (see pushTransform). The cone is a circle (see drawCircle) with each segment endpoint having a line drawn to the given apex.
-
void drawCoordinateAxes(const Magnum::
Vector3& pos, const Magnum:: Vector3& scale = {1.0f, 1.0f, 1.0f}, float radius = 0.05) - Draw RGB->XYZ coordinate axes at given location with given scaling. A circle will be placed near the end of each positive axis.
-
void drawPathWithEndpointCircles(const std::
vector<Magnum:: Vector3>& points, float radius, const Magnum:: Color4& color, int numSegments = 24, const Magnum:: Vector3& normal = Magnum:: Vector3(0.0, 1.0, 0.0)) - Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).
-
void drawPathWithEndpointCircles(Magnum::Containers::ArrayView<const Magnum::
Vector3> points, float radius, const Magnum:: Color4& color, int numSegments = 24, const Magnum:: Vector3& normal = Magnum:: Vector3(0.0, 1.0, 0.0)) - Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).
Function documentation
void esp:: gfx:: DebugLineRender:: drawCoordinateAxes(const Magnum:: Vector3& pos,
const Magnum:: Vector3& scale = {1.0f, 1.0f, 1.0f},
float radius = 0.05)
Draw RGB->XYZ coordinate axes at given location with given scaling. A circle will be placed near the end of each positive axis.
Parameters | |
---|---|
pos | The location in world space to place the axes |
scale | The length of each axis |
radius | The radius of the positive-direction circle indicators |
void esp:: gfx:: DebugLineRender:: drawPathWithEndpointCircles(Magnum::Containers::ArrayView<const Magnum:: Vector3> points,
float radius,
const Magnum:: Color4& color,
int numSegments = 24,
const Magnum:: Vector3& normal = Magnum:: Vector3(0.0, 1.0, 0.0))
Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).
Parameters | |
---|---|
points | Note that std::vector, std::array, or c-style array can be passed here. |
radius | |
color | |
numSegments | |
normal |