class final
#include <engine/gizmos/gizmos.hpp>
Gizmos Resource which queues commands for drawing gizmos, basic primitives useful for debugging and tools.
Public types
Public functions
- void color(const glm::vec3& color)
- Sets the color to be used when drawing any subsequent gizmos.
- void drawLine(const std::string& id, glm::vec3 from, glm::vec3 to, float lifespan = 0.0F, Space space = Space::World)
- Draws a line gizmo.
- void drawBox(const std::string& id, glm::vec3 corner, glm::vec3 oppositeCorner, float lifespan = 0.0F, Space space = Space::World)
- Draws a filled box gizmo.
- void drawBox(const std::string& id, const glm::mat4& transform, float lifespan = 0.0F, Space space = Space::World)
- Draws a filled box gizmo.
- void drawCutCone(const std::string& id, glm::vec3 firstBaseCenter, float firstBaseRadius, glm::vec3 secondBaseCenter, float secondBaseRadius, float lifespan = 0.0F, Space space = Space::World)
- Draws a cut cone gizmo.
- void drawRing(const std::string& id, glm::vec3 firstBasePosition, glm::vec3 secondBasePosition, float outerRadius, float innerRadius, float lifespan = 0.0F, Space space = Space::World)
- Draws a ring gizmo.
- void drawArrow(const std::string& id, glm::vec3 origin, glm::vec3 direction, float girth, float width, float ratio = 0.F, float lifespan = 0.0F, Space space = Space::World)
- Draws an arrow gizmo.
- void drawWireBox(const std::string& id, glm::vec3 corner, glm::vec3 oppositeCorner, float lifespan = 0.0F, Space space = Space::World)
- Draws a wireframe box gizmo.
- void drawWireBox(const std::string& id, const glm::mat4& transform, float lifespan = 0.0F, Space space = Space::World)
- Draws a wireframe box gizmo.
- auto pressed(const std::string& id) const -> bool
- Checks whether the left mouse button was pressed over a gizmo.
- auto locked(const std::string& id) const -> bool
- Checks whether the left mouse button was pressed over a gizmo.
- auto hovered(const std::string& id) const -> bool
- Checks whether the mouse cursor is over a gizmo.
- void handleInput(uint32_t hovered, bool pressed)
- Notifies that a given gizmo is being hovered. Called automatically by an internal system.
- void setLocked(uint32_t locked)
- Notifies that a given gizmo is locked.
- void releaseLocked()
- Notifies that the previously locked gizmo is no longer locked.
Public variables
- std::vector<std::shared_ptr<Gizmo>> worldGizmos
- Queued gizmos to be drawn in world space.
- std::vector<std::shared_ptr<Gizmo>> viewGizmos
- Queued gizmos to be drawn in viewport space.
- std::vector<std::shared_ptr<Gizmo>> screenGizmos
- Queued gizmos to be drawn in screen space.
- bool mLocking
- Whether the mouse has just now been pressed.
Enum documentation
Function documentation
void cubos:: engine:: Gizmos:: color(const glm::vec3& color)
Sets the color to be used when drawing any subsequent gizmos.
Parameters | |
---|---|
color | Color to be used. |
void cubos:: engine:: Gizmos:: drawLine(const std::string& id,
glm::vec3 from,
glm::vec3 to,
float lifespan = 0.0F,
Space space = Space::World)
Draws a line gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
from | One of the ends of the line to be drawn. |
to | The other end of the line to be drawn. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawBox(const std::string& id,
glm::vec3 corner,
glm::vec3 oppositeCorner,
float lifespan = 0.0F,
Space space = Space::World)
Draws a filled box gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
corner | One of the corners of the box to be drawn. |
oppositeCorner | The opposite corner of the box to be drawn. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawBox(const std::string& id,
const glm::mat4& transform,
float lifespan = 0.0F,
Space space = Space::World)
Draws a filled box gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
transform | Transformation matrix to apply to a unit-sized box centered at the origin. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawCutCone(const std::string& id,
glm::vec3 firstBaseCenter,
float firstBaseRadius,
glm::vec3 secondBaseCenter,
float secondBaseRadius,
float lifespan = 0.0F,
Space space = Space::World)
Draws a cut cone gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
firstBaseCenter | Center of one of the bases. |
firstBaseRadius | Radius of one of the bases. |
secondBaseCenter | Center of the second base. |
secondBaseRadius | Radius of the second base. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawRing(const std::string& id,
glm::vec3 firstBasePosition,
glm::vec3 secondBasePosition,
float outerRadius,
float innerRadius,
float lifespan = 0.0F,
Space space = Space::World)
Draws a ring gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
firstBasePosition | Center of one of the bases. |
secondBasePosition | Center of the second base. |
outerRadius | Radius of one of the ring. |
innerRadius | Radius of the of the hole. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawArrow(const std::string& id,
glm::vec3 origin,
glm::vec3 direction,
float girth,
float width,
float ratio = 0.F,
float lifespan = 0.0F,
Space space = Space::World)
Draws an arrow gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
origin | Point from which the arrow starts. |
direction | Direction of the arrow. |
girth | Radius of the cylinder part of the arrow. |
width | Radius of the base of the cone at the tip of the arrow. |
ratio | Point of the arrow at which the cylinder ends and the cone begins. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawWireBox(const std::string& id,
glm::vec3 corner,
glm::vec3 oppositeCorner,
float lifespan = 0.0F,
Space space = Space::World)
Draws a wireframe box gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
corner | One of the corners of the box to be drawn. |
oppositeCorner | The opposite corner of the box to be drawn. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
void cubos:: engine:: Gizmos:: drawWireBox(const std::string& id,
const glm::mat4& transform,
float lifespan = 0.0F,
Space space = Space::World)
Draws a wireframe box gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
transform | Transformation matrix to apply to a unit-sized box centered at the origin. |
lifespan | How long the line will be on screen for, in seconds. Defaults to 0, which means a single frame. |
space | Space to draw the gizmo in. |
bool cubos:: engine:: Gizmos:: pressed(const std::string& id) const
Checks whether the left mouse button was pressed over a gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
Returns | Whether the gizmo was pressed. |
bool cubos:: engine:: Gizmos:: locked(const std::string& id) const
Checks whether the left mouse button was pressed over a gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
Returns | Whether the gizmo was pressed. |
bool cubos:: engine:: Gizmos:: hovered(const std::string& id) const
Checks whether the mouse cursor is over a gizmo.
Parameters | |
---|---|
id | Identifier of the gizmo. |
Returns | Whether the mouse button is over a gizmo. |
void cubos:: engine:: Gizmos:: handleInput(uint32_t hovered,
bool pressed)
Notifies that a given gizmo is being hovered. Called automatically by an internal system.
Parameters | |
---|---|
hovered | Gizmo being hovered. |
pressed | Whether the mouse left button is pressed. |