TDME2 1.9.121
Public Types | Public Member Functions | Private Attributes | List of all members
Gizmo Class Reference

Gizmo tool for views. More...

#include <tdme/tools/editor/misc/Gizmo.h>

Inheritance diagram for Gizmo:
Inheritance graph
Collaboration diagram for Gizmo:
Collaboration graph

Public Types

enum  GizmoType {
  GIZMOTYPE_NONE = 0 , GIZMOTYPE_TRANSLATE = 1 , GIZMOTYPE_ROTATE = 2 , GIZMOTYPE_SCALE = 4 ,
  GIZMOTYPE_ALL = 8
}
 
enum  GizmoMode {
  GIZMOMODE_NONE , GIZMOMODE_TRANSLATE_X , GIZMOMODE_TRANSLATE_Y , GIZMOMODE_TRANSLATE_Z ,
  GIZMOMODE_TRANSLATEPLANE_X , GIZMOMODE_TRANSLATEPLANE_Y , GIZMOMODE_TRANSLATEPLANE_Z , GIZMOMODE_SCALE_X ,
  GIZMOMODE_SCALE_Y , GIZMOMODE_SCALE_Z , GIZMOMODE_SCALEPLANE_X , GIZMOMODE_SCALEPLANE_Y ,
  GIZMOMODE_SCALEPLANE_Z , GIZMOMODE_ROTATE_X , GIZMOMODE_ROTATE_Y , GIZMOMODE_ROTATE_Z
}
 

Public Member Functions

 Gizmo (Engine *engine, const string &id, int32_t gizmoTypeMask=GIZMOTYPE_TRANSLATE|GIZMOTYPE_ROTATE|GIZMOTYPE_SCALE)
 Public constructor. More...
 
virtual ~Gizmo ()
 Destructor. More...
 
void setEngine (Engine *engine)
 Set engine. More...
 
int32_t getGizmoTypeMask () const
 
void setGizmoTypeMask (int gizmoTypeMask)
 Set GIZMO type mask. More...
 
GizmoType getGizmoType () const
 
void setGizmoType (GizmoType gizmoType)
 Set GIZMO type. More...
 
GizmoMode getGizmoMode () const
 
void setGizmoMode (GizmoMode gizmoMode)
 Set GIZMO mode. More...
 
void updateGizmo (const Vector3 &gizmoCenter, const Transformations &transformations)
 Update gizmo. More...
 
Object3DgetGizmoObject3D ()
 
void removeGizmo ()
 Remove gizmo. More...
 
bool determineGizmoMovement (int mouseX, int mouseY, vector< Vector3 > vertices, Vector3 &deltaMovement)
 Determine movement on a plane given by 4 vertices. More...
 
bool determineGizmoDeltaTransformations (int mouseLastX, int mouseLastY, int mouseX, int mouseY, Vector3 &deltaTranslation, Vector3 &deltaRotation, Vector3 &deltaScale)
 Determine GIZMO delta transformations. More...
 
bool determineGizmoMode (Entity *selectedEntity, Node *selectedEntityNode)
 Select GIZMO mode. More...
 
void setGizmoRotation (const Transformations &transformations)
 Set gizmo rotation. More...
 

Private Attributes

Engineengine { nullptr }
 
string id
 
GizmoType gizmoType
 
GizmoMode gizmoMode
 
Vector3 gizmoLastResult
 
bool gizmoLastResultAvailable
 
int32_t gizmoTypeMask
 

Detailed Description

Gizmo tool for views.

Author
Andreas Drewke

Definition at line 25 of file Gizmo.h.

Member Enumeration Documentation

◆ GizmoMode

enum GizmoMode
Enumerator
GIZMOMODE_NONE 
GIZMOMODE_TRANSLATE_X 
GIZMOMODE_TRANSLATE_Y 
GIZMOMODE_TRANSLATE_Z 
GIZMOMODE_TRANSLATEPLANE_X 
GIZMOMODE_TRANSLATEPLANE_Y 
GIZMOMODE_TRANSLATEPLANE_Z 
GIZMOMODE_SCALE_X 
GIZMOMODE_SCALE_Y 
GIZMOMODE_SCALE_Z 
GIZMOMODE_SCALEPLANE_X 
GIZMOMODE_SCALEPLANE_Y 
GIZMOMODE_SCALEPLANE_Z 
GIZMOMODE_ROTATE_X 
GIZMOMODE_ROTATE_Y 
GIZMOMODE_ROTATE_Z 

Definition at line 35 of file Gizmo.h.

◆ GizmoType

enum GizmoType
Enumerator
GIZMOTYPE_NONE 
GIZMOTYPE_TRANSLATE 
GIZMOTYPE_ROTATE 
GIZMOTYPE_SCALE 
GIZMOTYPE_ALL 

Definition at line 28 of file Gizmo.h.

Constructor & Destructor Documentation

◆ Gizmo()

Gizmo ( Engine engine,
const string &  id,
int32_t  gizmoTypeMask = GIZMOTYPE_TRANSLATE | GIZMOTYPE_ROTATE | GIZMOTYPE_SCALE 
)

Public constructor.

Parameters
engineengine
idid
gizmoTypeMaskgizmo type mask

Definition at line 38 of file Gizmo.cpp.

◆ ~Gizmo()

~Gizmo ( )
virtual

Destructor.

Definition at line 48 of file Gizmo.cpp.

Member Function Documentation

◆ determineGizmoDeltaTransformations()

bool determineGizmoDeltaTransformations ( int  mouseLastX,
int  mouseLastY,
int  mouseX,
int  mouseY,
Vector3 deltaTranslation,
Vector3 deltaRotation,
Vector3 deltaScale 
)

Determine GIZMO delta transformations.

Parameters
mouseLastXlast mouse X position
mouseLastYlast mouse Y position
mouseXmouse X position
mouseYmouse Y position
deltaTranslationdetermined delta translation
deltaRotationdetermined delta rotations
deltaScaledetermined delta scale

Definition at line 254 of file Gizmo.cpp.

◆ determineGizmoMode()

bool determineGizmoMode ( Entity selectedEntity,
Node selectedEntityNode 
)

Select GIZMO mode.

Parameters
selectedEntityselected entity
selectedEntityNodeselected entity node

Definition at line 400 of file Gizmo.cpp.

◆ determineGizmoMovement()

bool determineGizmoMovement ( int  mouseX,
int  mouseY,
vector< Vector3 vertices,
Vector3 deltaMovement 
)

Determine movement on a plane given by 4 vertices.

Parameters
mouseXcurrent mouse X position
mouseYcurrent mouse Y position
vertices4 vertices that span a plane
deltaMovementdelta movement result
Returns
success

Definition at line 219 of file Gizmo.cpp.

◆ getGizmoMode()

GizmoMode getGizmoMode ( ) const
inline
Returns
GIZMO mode

Definition at line 120 of file Gizmo.h.

◆ getGizmoObject3D()

Object3D * getGizmoObject3D ( )
Returns
GIZMO object

Definition at line 203 of file Gizmo.cpp.

◆ getGizmoType()

GizmoType getGizmoType ( ) const
inline
Returns
GIZMO type

Definition at line 104 of file Gizmo.h.

◆ getGizmoTypeMask()

int32_t getGizmoTypeMask ( ) const
inline
Returns
GIZMO type mask

Definition at line 88 of file Gizmo.h.

◆ removeGizmo()

void removeGizmo ( )

Remove gizmo.

Definition at line 211 of file Gizmo.cpp.

◆ setEngine()

void setEngine ( Engine engine)
inline

Set engine.

Parameters
engineengine

Definition at line 81 of file Gizmo.h.

◆ setGizmoMode()

void setGizmoMode ( GizmoMode  gizmoMode)
inline

Set GIZMO mode.

Parameters
gizmoModegizmo mode

Definition at line 128 of file Gizmo.h.

◆ setGizmoRotation()

void setGizmoRotation ( const Transformations transformations)

Set gizmo rotation.

Parameters
transformationstransformations containing rotations

Definition at line 426 of file Gizmo.cpp.

◆ setGizmoType()

void setGizmoType ( GizmoType  gizmoType)
inline

Set GIZMO type.

Parameters
gizmoTypeGIZMO type

Definition at line 112 of file Gizmo.h.

◆ setGizmoTypeMask()

void setGizmoTypeMask ( int  gizmoTypeMask)
inline

Set GIZMO type mask.

Parameters
gizmoTypeMaskGIZMO type mask

Definition at line 96 of file Gizmo.h.

◆ updateGizmo()

void updateGizmo ( const Vector3 gizmoCenter,
const Transformations transformations 
)

Update gizmo.

Parameters
gizmoCenterGIZMO center
transformationstransformations used for rotation

Definition at line 51 of file Gizmo.cpp.

Member Data Documentation

◆ engine

Engine* engine { nullptr }
private

Definition at line 55 of file Gizmo.h.

◆ gizmoLastResult

Vector3 gizmoLastResult
private

Definition at line 59 of file Gizmo.h.

◆ gizmoLastResultAvailable

bool gizmoLastResultAvailable
private

Definition at line 60 of file Gizmo.h.

◆ gizmoMode

GizmoMode gizmoMode
private

Definition at line 58 of file Gizmo.h.

◆ gizmoType

GizmoType gizmoType
private

Definition at line 57 of file Gizmo.h.

◆ gizmoTypeMask

int32_t gizmoTypeMask
private

Definition at line 61 of file Gizmo.h.

◆ id

string id
private

Definition at line 56 of file Gizmo.h.


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