class DrawHelper

Helper class for immediate drawing of common geometric shapes.

Public

Constructors

DrawHelper

DrawHelper()

Methods

SetColor

void SetColor(const Color &color)

Sets a color that will be used for any shapes recorded after this call.

SetTransform

void SetTransform(const Matrix4 &transform)

Sets a transform matrix that will be used for any shapes recorded after this call.

SetLayer

void SetLayer(u64 layer)

Sets the layer bitfield that can be used for filtering which objects are output into the final mesh.

Cube

void Cube(const Vector3 &position, const Vector3 &extents)

Records a solid cuboid with the specified properties in the internal draw queue.

Sphere

void Sphere(const Vector3 &position, float radius, u32 quality = 1)

Records a solid sphere with the specified properties in the internal draw queue.

WireCube

void WireCube(const Vector3 &position, const Vector3 &extents)

Records a wireframe cube with the specified properties in the internal draw queue.

WireSphere

void WireSphere(const Vector3 &position, float radius, u32 quality = 10)

Records a wireframe sphere with the specified properties in the internal draw queue.

WireHemisphere

void WireHemisphere(const Vector3 &position, float radius, u32 quality = 10)

Records a wireframe hemisphere with the specified properties in the internal draw queue.

Line

void Line(const Vector3 &start, const Vector3 &end)

Records a line with the specified properties in the internal draw queue.

LineList

void LineList(const Vector<Vector3> &lines)

Records a list of lines in the internal draw queue.

The list must contain lines as pair of vertices, starting point followed by an end point, and so on.

Frustum

void Frustum(const Vector3 &position, float aspect, Degree FOV, float near, float far)

Records a wireframe frustum with the specified properties in the internal draw queue.

Cone

void Cone(const Vector3 &base, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne, u32 quality = 10)

Records a solid cone with the specified properties in the internal draw queue.

WireCone

void WireCone(const Vector3 &base, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne, u32 quality = 10)

Records a wire cone with the specified properties in the internal draw queue.

Disc

void Disc(const Vector3 &position, const Vector3 &normal, float radius, u32 quality = 10)

Records a solid disc with the specified properties in the internal draw queue.

WireDisc

void WireDisc(const Vector3 &position, const Vector3 &normal, float radius, u32 quality = 10)

Records a wireframe disc with the specified properties in the internal draw queue.

Arc

void Arc(const Vector3 &position, const Vector3 &normal, float radius, Degree startAngle, Degree amountAngle, u32 quality = 10)

Records a solid arc with the specified properties in the internal draw queue.

WireArc

void WireArc(const Vector3 &position, const Vector3 &normal, float radius, Degree startAngle, Degree amountAngle, u32 quality = 10)

Records a wireframe arc with the specified properties in the internal draw queue.

WireMesh

void WireMesh(const SPtr<MeshData> &meshData)

Records a 3D mesh to be drawn as wireframe in the internal draw queue.

Rectangle

void Rectangle(const Rect3 &area)

Records a solid rectangle with the specified properties in the internal draw queue.

Text

void Text(const Vector3 &position, const String &text, const HFont &font, float size = 10.F)

Records a mesh representing 2D text with the specified properties in the internal draw queue.

position
Position to render the text at. Text will be centered around this point.
text
Text to draw.
font
Font to use for rendering the text's characters.
size
Size of the characters, in points.

Clear

void Clear()

Clears all recorded shapes.

BuildMeshes

Vector<ShapeMeshData> BuildMeshes(SortType sorting = SortType::None, const Camera *camera = nullptr, u64 layers = 18446744073709551615ULL)

Generates a set of meshes from all the recorded solid and wireframe shapes.

The meshes can be accessed via getMeshes() and released via clearMeshes().

sorting
(optional) Determines how (and if) should elements be sorted based on their distance from the reference point.
camera
(optional) Camera through which the meshes will be rendered.
layers
(optional) Layers bitfield that can be used for controlling which shapes will be included in the mesh. This bitfield will be ANDed with the layer specified when recording the shape.

Returns: Generated mesh data.

Private

Fields

mColor

Color mColor

mTransform

Matrix4 mTransform

mLayer

u64 mLayer

mSolidCubeData

Vector<CubeData> mSolidCubeData

mWireCubeData

Vector<CubeData> mWireCubeData

mSolidSphereData

Vector<SphereData> mSolidSphereData

mWireSphereData

Vector<SphereData> mWireSphereData

mWireHemisphereData

Vector<SphereData> mWireHemisphereData

mLineData

Vector<LineData> mLineData

mLineListData

Vector<LineListData> mLineListData

mRect3Data

Vector<Rect3Data> mRect3Data

mFrustumData

Vector<FrustumData> mFrustumData

mConeData

Vector<ConeData> mConeData

mWireConeData

Vector<ConeData> mWireConeData

mDiscData

Vector<DiscData> mDiscData

mWireDiscData

Vector<DiscData> mWireDiscData

mArcData

Vector<ArcData> mArcData

mWireArcData

Vector<ArcData> mWireArcData

mText2DData

Vector<Text2DData> mText2DData

mWireMeshData

Vector<WireMeshData> mWireMeshData

mSolidVertexDesc

SPtr<VertexDescription> mSolidVertexDesc

mWireVertexDesc

SPtr<VertexDescription> mWireVertexDesc

mLineVertexDesc

SPtr<VertexDescription> mLineVertexDesc

mTextVertexDesc

SPtr<VertexDescription> mTextVertexDesc