KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SPHERES_GIZMO Class Reference

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
 

Detailed Description

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.

Member Enumeration Documentation

◆ GizmoSphereSelection

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.

Constructor & Destructor Documentation

◆ SPHERES_GIZMO()

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::~SPHERES_GIZMO ( )

Definition at line 31 of file 3d_spheres_gizmo.cpp.

References m_quadric.

Member Function Documentation

◆ getSelectedGizmoSphere()

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().

◆ getViewport()

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().

◆ handleMouseInput()

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().

◆ render3dSpheresGizmo()

void SPHERES_GIZMO::render3dSpheresGizmo ( glm::mat4  aCameraRotationMatrix)

◆ resetSelectedGizmoSphere()

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().

◆ setGizmoMaterial()

void SPHERES_GIZMO::setGizmoMaterial ( )
private

Definition at line 73 of file 3d_spheres_gizmo.cpp.

Referenced by render3dSpheresGizmo().

◆ setGizmoPosition()

void SPHERES_GIZMO::setGizmoPosition ( int  ax,
int  ay 
)

Definition at line 66 of file 3d_spheres_gizmo.cpp.

References m_gizmoPosX, and m_gizmoPosY.

◆ setViewport()

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().

Member Data Documentation

◆ m_arrowSize

const float SPHERES_GIZMO::m_arrowSize = RANGE_SCALE_3D * 0.20f
private

Definition at line 92 of file 3d_spheres_gizmo.h.

Referenced by render3dSpheresGizmo().

◆ m_gizmoPosX

int SPHERES_GIZMO::m_gizmoPosX = 0
private

◆ m_gizmoPosY

int SPHERES_GIZMO::m_gizmoPosY = 0
private

◆ m_ndcX

float SPHERES_GIZMO::m_ndcX = -1.0f
private

◆ m_ndcY

float SPHERES_GIZMO::m_ndcY = -1.0f
private

◆ m_quadric

GLUquadric* SPHERES_GIZMO::m_quadric = nullptr
private

Definition at line 69 of file 3d_spheres_gizmo.h.

Referenced by render3dSpheresGizmo(), SPHERES_GIZMO(), and ~SPHERES_GIZMO().

◆ m_selectedGizmoSphere

GizmoSphereSelection SPHERES_GIZMO::m_selectedGizmoSphere = GizmoSphereSelection::None
private

◆ m_sphereRadius

const float SPHERES_GIZMO::m_sphereRadius = 0.05f * RANGE_SCALE_3D
private

Definition at line 93 of file 3d_spheres_gizmo.h.

◆ m_spheres

std::array<GizmoSphere, 6> SPHERES_GIZMO::m_spheres
private
Initial value:
= { { { { m_arrowSize, 0.0f, 0.0f },
{ m_arrowSize + 0.02f, 0.0f, 0.0f },
{ 0.9f, 0.0f, 0.0f },
{ 0.9f, 0.0f, 0.0f } },
{ { -m_arrowSize, 0.0f, 0.0f },
{ -m_arrowSize - 0.02f, 0.0f, 0.0f },
{ 0.4f, 0.0f, 0.0f },
{ 0.4f, 0.0f, 0.0f } },
{ { 0.0f, m_arrowSize, 0.0f },
{ 0.0f, m_arrowSize + 0.02f, 0.0f },
{ 0.0f, 0.9f, 0.0f },
{ 0.0f, 0.9f, 0.0f } },
{ { 0.0f, -m_arrowSize, 0.0f },
{ 0.0f, -m_arrowSize - 0.02f, 0.0f },
{ 0.0f, 0.4f, 0.0f },
{ 0.0f, 0.4f, 0.0f } },
{ { 0.0f, 0.0f, m_arrowSize },
{ 0.0f, 0.0f, m_arrowSize + 0.02f },
{ 0.0f, 0.0f, 0.9f },
{ 0.0f, 0.0f, 0.9f } },
{ { 0.0f, 0.0f, -m_arrowSize },
{ 0.0f, 0.0f, -m_arrowSize - 0.02f },
{ 0.0f, 0.0f, 0.4f },
{ 0.0f, 0.0f, 0.4f } } } }
const float m_arrowSize
const float m_sphereRadius

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().

◆ m_viewportH

int SPHERES_GIZMO::m_viewportH = 0
private

◆ m_viewportW

int SPHERES_GIZMO::m_viewportW = 0
private

Definition at line 76 of file 3d_spheres_gizmo.h.

Referenced by getViewport(), and setViewport().

◆ m_viewportX

int SPHERES_GIZMO::m_viewportX = 0
private

Definition at line 74 of file 3d_spheres_gizmo.h.

Referenced by getViewport(), and setViewport().

◆ m_viewportY

int SPHERES_GIZMO::m_viewportY = 0
private

Definition at line 75 of file 3d_spheres_gizmo.h.

Referenced by getViewport(), and setViewport().


The documentation for this class was generated from the following files: