class GizmoDrawing

Provides easy access to the rendering of gizmo elements.

Gizmos are icons and 3D objects usually rendered in scene view for various visualization purposes (for example a Camera component will have a gizmo that draws a Camera icon since otherwise it has no visual representation). Aside from being rendered, gizmos can also be selected by the user as if they were normal scene elements.

Public

Constructors

GizmoDrawing

GizmoDrawing()

Methods

StartGizmo

void StartGizmo(const SPtr<SceneGizmos> &gizmoManager, const HSceneObject &gizmoParent)

Starts gizmo creation.

All further call will be referencing this gizmo. Must be followed by a matching EndGizmo().

gizmoManager
Manager into which all the draw commands will be recorded.
gizmoParent
Scene object this gizmo is attached to. Selecting the gizmo will select this scene object.

EndGizmo

void EndGizmo()

Ends gizmo creation.

Must be called after a matching startGizmo().

SetColor

void SetColor(const Color &color)

Changes the color of any further gizmo draw calls.

SetTransform

void SetTransform(const Matrix4 &transform)

Changes the transform that will be applied to meshes of any further gizmo draw calls.

SetPickable

void SetPickable(bool pickable)

If pickable is set to true, gizmo can be selected by the user, otherwise it will be drawn but cannot be interacted with.

GetColor

Color GetColor() const

Returns the currently set gizmo color.

GetTransform

Matrix4 GetTransform() const

Returns the currently set gizmo transform.

DrawCube

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

Draws an axis aligned cuboid.

position
Center of the cuboid.
extents
Radius of the cuboid in each axis.

DrawSphere

void DrawSphere(const Vector3 &position, float radius)

Draws a sphere.

DrawCone

void DrawCone(const Vector3 &basePosition, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne)

Draws a solid cone.

basePosition
Position of the center of the base of the cone.
normal
Orientation of the cone, pointing from center base to the tip of the cone.
height
Height of the cone (along the normal).
radius
Radius of the base of the cone.
scale
Scale applied to cone's disc width & height. Allows you to create elliptical cones.

DrawDisc

void DrawDisc(const Vector3 &position, const Vector3 &normal, float radius)

Draws a solid disc.

position
Center of the disc.
normal
Orientation of the disc, pointing in the direction the disc is visible in.
radius
Radius of the disc.

DrawWireCube

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

Draws a wireframe axis aligned cuboid.

position
Center of the cuboid.
extents
Radius of the cuboid in each axis.

DrawWireSphere

void DrawWireSphere(const Vector3 &position, float radius)

Draws a wireframe sphere represented by three discs.

DrawWireHemisphere

void DrawWireHemisphere(const Vector3 &position, float radius)

Draws a wireframe hemisphere represented by three arcs.

DrawWireCapsule

void DrawWireCapsule(const Vector3 &position, float height, float radius)

Draws a wireframe capsule.

position
World coordinates of the center of the capsule.
height
Distance between the centers of the capsule's hemispheres.
radius
Distance of each point from the capsule's center-line.

DrawWireCone

void DrawWireCone(const Vector3 &basePosition, const Vector3 &normal, float height, float radius, const Vector2 &scale = Vector2::kOne)

Draws a wireframe cone.

basePosition
Position of the center of the base of the cone.
normal
Orientation of the cone, pointing from center base to the tip of the cone.
height
Height of the cone (along the normal).
radius
Radius of the base of the cone.
scale
Scale applied to cone's disc width & height. Allows you to create elliptical cones.

DrawLine

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

Draws a line between two points.

DrawLineList

void DrawLineList(const Vector<Vector3> &linePoints)

Draws a list of lines.

Provided array must contain pairs of the line start point followed by an end point.

DrawWireDisc

void DrawWireDisc(const Vector3 &position, const Vector3 &normal, float radius)

Draws a wireframe disc.

position
Center of the disc.
normal
Orientation of the disc, pointing in the direction the disc is visible in.
radius
Radius of the disc.

DrawWireArc

void DrawWireArc(const Vector3 &position, const Vector3 &normal, float radius, Degree startAngle, Degree amountAngle)

Draws a wireframe arc.

position
Center of the arc.
normal
Orientation of the arc, pointing in the direction the arc is visible in.
radius
Radius of the arc.
startAngle
Angle at which to start the arc.
amountAngle
Length of the arc.

DrawWireMesh

void DrawWireMesh(const SPtr<MeshData> &meshData)

Draws a wireframe mesh.

meshData
Object containing mesh vertices and indices. Vertices must be Vertex3 and indices 32-bit.

DrawFrustum

void DrawFrustum(const Vector3 &position, float aspect, Degree FOV, float nearPlane, float farPlane)

Draws a wireframe frustum.

position
Origin of the frustum, or the eye point.
aspect
Ratio of frustum width over frustum height.
FOV
Horizontal field of view in degrees.
nearPlane
Distance to the near frustum plane.
farPlane
Distance to the far frustum plane.

DrawIcon

void DrawIcon(Vector3 position, HSpriteImage image, bool fixedScale)

Draws an icon that always faces the camera.

position
Position of the center of the icon.
image
Sprite image for the icon to draw.
fixedScale
If true then the icon will remain the same size regardless of the distance from camera.

DrawText

void DrawText(const Vector3 &position, const String &text, const HFont &font, float fontSize = 16.F)

Draws a mesh representing 2D text with the specified properties.

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.
fontSize
Size of the characters, in points.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Fields

mGizmoManager

SPtr<SceneGizmos> mGizmoManager

mColor

Color mColor

mTransform

Matrix4 mTransform

mActiveSceneObject

HSceneObject mActiveSceneObject

mPickable

bool mPickable

mTransformDirty

bool mTransformDirty

mColorDirty

bool mColorDirty