KiCad PCB EDA Suite
|
Renders a set of colored spheres in 3D space that act as a directional orientation gizmo. More...
#include <3d_spheres_gizmo.h>
Classes | |
struct | GizmoSphere |
Public Types | |
enum class | GizmoSphereSelection { None = -1 , Right = 0 , Left , Back , Front , Top , Bottom , Count } |
Enum to indicate which sphere (direction) is selected. More... | |
Public Member Functions | |
SPHERES_GIZMO (int aGizmoPosX, int aGizmoPosY) | |
~SPHERES_GIZMO () | |
void | setViewport (int ax, int ay, int aWidth, int aHeight) |
std::tuple< int, int, int, int > | getViewport () const |
void | setGizmoPosition (int ax, int ay) |
void | handleMouseInput (int aMouseX, int aMouseY) |
GizmoSphereSelection | getSelectedGizmoSphere () const |
void | resetSelectedGizmoSphere () |
void | render3dSpheresGizmo (glm::mat4 aCameraRotationMatrix) |
Private Member Functions | |
void | setGizmoMaterial () |
Private Attributes | |
GLUquadric * | m_quadric = nullptr |
int | m_gizmoPosX = 0 |
int | m_gizmoPosY = 0 |
int | m_viewportX = 0 |
int | m_viewportY = 0 |
int | m_viewportW = 0 |
int | m_viewportH = 0 |
float | m_ndcX = -1.0f |
float | m_ndcY = -1.0f |
const float | m_arrowSize = RANGE_SCALE_3D * 0.20f |
const float | m_sphereRadius = 0.05f * RANGE_SCALE_3D |
std::array< GizmoSphere, 6 > | m_spheres |
List of all directional gizmo spheres. | |
GizmoSphereSelection | m_selectedGizmoSphere = GizmoSphereSelection::None |
Renders a set of colored spheres in 3D space that act as a directional orientation gizmo.
Definition at line 34 of file 3d_spheres_gizmo.h.
|
strong |
Enum to indicate which sphere (direction) is selected.
Enumerator | |
---|---|
None | No sphere selected. |
Right | +X direction. |
Left | -X direction. |
Back | +Y direction. |
Front | -Y direction. |
Top | +Z direction. |
Bottom | -Z direction. |
Count | Number of selectable spheres. |
Definition at line 50 of file 3d_spheres_gizmo.h.
SPHERES_GIZMO::SPHERES_GIZMO | ( | int | aGizmoPosX, |
int | aGizmoPosY | ||
) |
Definition at line 41 of file 3d_spheres_gizmo.cpp.
References m_gizmoPosX, m_gizmoPosY, and m_quadric.
SPHERES_GIZMO::~SPHERES_GIZMO | ( | ) |
Definition at line 31 of file 3d_spheres_gizmo.cpp.
References m_quadric.
SPHERES_GIZMO::GizmoSphereSelection SPHERES_GIZMO::getSelectedGizmoSphere | ( | ) | const |
Definition at line 358 of file 3d_spheres_gizmo.cpp.
References m_selectedGizmoSphere.
Referenced by RENDER_3D_OPENGL::getSelectedGizmoSphere().
std::tuple< int, int, int, int > SPHERES_GIZMO::getViewport | ( | ) | const |
Definition at line 60 of file 3d_spheres_gizmo.cpp.
References m_viewportH, m_viewportW, m_viewportX, and m_viewportY.
Referenced by RENDER_3D_OPENGL::getGizmoViewport().
void SPHERES_GIZMO::handleMouseInput | ( | int | aMouseX, |
int | aMouseY | ||
) |
Definition at line 91 of file 3d_spheres_gizmo.cpp.
References m_gizmoPosX, m_gizmoPosY, m_ndcX, m_ndcY, and m_viewportH.
Referenced by RENDER_3D_OPENGL::handleGizmoMouseInput().
void SPHERES_GIZMO::render3dSpheresGizmo | ( | glm::mat4 | aCameraRotationMatrix | ) |
Definition at line 112 of file 3d_spheres_gizmo.cpp.
References empty(), m_arrowSize, m_gizmoPosX, m_gizmoPosY, m_ndcX, m_ndcY, m_quadric, m_selectedGizmoSphere, m_spheres, m_viewportH, None, RANGE_SCALE_3D, and setGizmoMaterial().
Referenced by RENDER_3D_OPENGL::Redraw().
void SPHERES_GIZMO::resetSelectedGizmoSphere | ( | ) |
Definition at line 363 of file 3d_spheres_gizmo.cpp.
References m_ndcX, m_ndcY, m_selectedGizmoSphere, and None.
Referenced by RENDER_3D_OPENGL::resetSelectedGizmoSphere().
|
private |
Definition at line 73 of file 3d_spheres_gizmo.cpp.
Referenced by render3dSpheresGizmo().
void SPHERES_GIZMO::setGizmoPosition | ( | int | ax, |
int | ay | ||
) |
Definition at line 66 of file 3d_spheres_gizmo.cpp.
References m_gizmoPosX, and m_gizmoPosY.
void SPHERES_GIZMO::setViewport | ( | int | ax, |
int | ay, | ||
int | aWidth, | ||
int | aHeight | ||
) |
Definition at line 51 of file 3d_spheres_gizmo.cpp.
References m_viewportH, m_viewportW, m_viewportX, and m_viewportY.
Referenced by RENDER_3D_OPENGL::setGizmoViewport().
|
private |
Definition at line 92 of file 3d_spheres_gizmo.h.
Referenced by render3dSpheresGizmo().
|
private |
Definition at line 71 of file 3d_spheres_gizmo.h.
Referenced by handleMouseInput(), render3dSpheresGizmo(), setGizmoPosition(), and SPHERES_GIZMO().
|
private |
Definition at line 72 of file 3d_spheres_gizmo.h.
Referenced by handleMouseInput(), render3dSpheresGizmo(), setGizmoPosition(), and SPHERES_GIZMO().
|
private |
Definition at line 79 of file 3d_spheres_gizmo.h.
Referenced by handleMouseInput(), render3dSpheresGizmo(), and resetSelectedGizmoSphere().
|
private |
Definition at line 80 of file 3d_spheres_gizmo.h.
Referenced by handleMouseInput(), render3dSpheresGizmo(), and resetSelectedGizmoSphere().
|
private |
Definition at line 69 of file 3d_spheres_gizmo.h.
Referenced by render3dSpheresGizmo(), SPHERES_GIZMO(), and ~SPHERES_GIZMO().
|
private |
Definition at line 130 of file 3d_spheres_gizmo.h.
Referenced by getSelectedGizmoSphere(), render3dSpheresGizmo(), and resetSelectedGizmoSphere().
|
private |
Definition at line 93 of file 3d_spheres_gizmo.h.
|
private |
List of all directional gizmo spheres.
The order follows the GizmoSphereSelection enum.
Definition at line 99 of file 3d_spheres_gizmo.h.
Referenced by render3dSpheresGizmo().
|
private |
Definition at line 77 of file 3d_spheres_gizmo.h.
Referenced by getViewport(), handleMouseInput(), render3dSpheresGizmo(), and setViewport().
|
private |
Definition at line 76 of file 3d_spheres_gizmo.h.
Referenced by getViewport(), and setViewport().
|
private |
Definition at line 74 of file 3d_spheres_gizmo.h.
Referenced by getViewport(), and setViewport().
|
private |
Definition at line 75 of file 3d_spheres_gizmo.h.
Referenced by getViewport(), and setViewport().