Radium Engine  1.5.0
Ra::Gui::Gizmo Class Referenceabstract

#include <Gui/Viewer/Gizmo/Gizmo.hpp>

+ Inheritance diagram for Ra::Gui::Gizmo:
+ Collaboration diagram for Ra::Gui::Gizmo:

Classes

class  UiSelectionControler
 

Public Types

enum  Mode { LOCAL , GLOBAL }
 

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW Gizmo (Engine::Scene::Component *c, const Core::Transform &worldTo, const Core::Transform &t, Mode mode)
 
void show (bool on)
 
virtual void updateTransform (Mode mode, const Core::Transform &worldTo, const Core::Transform &t)=0
 Called every time the underlying transform may have changed.
 
virtual void selectConstraint (int drawableIndex)=0
 Called when one of the drawables of the gizmo has been selected.
 
virtual bool isSelected ()=0
 return the selection state of the gizmo: true if the gizmo is selected, false if not.
 
virtual void setInitialState (const Core::Asset::Camera &cam, const Core::Vector2 &initialXY)=0
 
virtual Core::Transform mouseMove (const Core::Asset::Camera &cam, const Core::Vector2 &nextXY, bool stepped=false, bool whole=false)=0
 

Protected Member Functions

const std::vector< Engine::Rendering::RenderObject * > & ros () const
 read access to the gizmo render objects id
 
void addRenderObject (Engine::Rendering::RenderObject *ro)
 add a render object to display the Gizmo
 
Gizmo::UiSelectionControlergetControler (int ro)
 Returns the controler (ShaderParametersProvider) associated to the given gizmo component.
 

Static Protected Member Functions

static bool findPointOnAxis (const Core::Asset::Camera &cam, const Core::Vector3 &origin, const Core::Vector3 &axis, const Core::Vector2 &pix, Core::Vector3 &pointOut, std::vector< Scalar > &hits)
 Find a mouse-designed point on a 3D axis.
 
static bool findPointOnPlane (const Core::Asset::Camera &cam, const Core::Vector3 &origin, const Core::Vector3 &axis, const Core::Vector2 &pix, Core::Vector3 &pointOut, std::vector< Scalar > &hits)
 Find a mouse-designed point on a 3D plane.
 
static std::shared_ptr< Engine::Rendering::RenderTechniquemakeRenderTechnique (int color)
 

Protected Attributes

Core::Transform m_worldTo
 World to local space where the transform lives.
 
Core::Transform m_transform
 Transform to be edited.
 
Engine::Scene::Componentm_comp
 Engine Ui component.
 
Mode m_mode
 local or global.
 

Static Protected Attributes

static std::array< std::shared_ptr< Ra::Engine::Data::PlainMaterial >, 3 > s_material
 

Detailed Description

Base class for gizmos, i.e. graphic tools to manipulate a transform.

Todo:
There is a lot of duplicated code shared between the different Gizmos (rotate, translate, scale). This is due to the fact that they all have Render Objects in xyz directions, and which can be selected with the same logic. An alternative would be to have an intermediate class , e.g. XYZGizmo which performs all the generic operations (e.g. render object coloring in selectConstraint and mouseMove).

Definition at line 41 of file Gizmo.hpp.

Member Function Documentation

◆ makeRenderTechnique()

std::shared_ptr< Engine::Rendering::RenderTechnique > Ra::Gui::Gizmo::makeRenderTechnique ( int  color)
staticprotected

Generate a the rendertechnique to draw the gizmo using the required color : 0-Red, 1-Green, 2-Blue. The build render technique has a selection-dependent parameter provider for the shader configuration used to draw the gizmo. It is this provider that manage the appeartance changes when the selection state changes on the gizmo.

Definition at line 88 of file Gizmo.cpp.

+ Here is the call graph for this function:

◆ mouseMove()

virtual Core::Transform Ra::Gui::Gizmo::mouseMove ( const Core::Asset::Camera cam,
const Core::Vector2 &  nextXY,
bool  stepped = false,
bool  whole = false 
)
pure virtual

Called when the mouse movement is recorder with the camera parameters and the current pixel coordinates.

Implemented in Ra::Gui::TranslateGizmo, Ra::Gui::ScaleGizmo, and Ra::Gui::RotateGizmo.

◆ setInitialState()

virtual void Ra::Gui::Gizmo::setInitialState ( const Core::Asset::Camera cam,
const Core::Vector2 &  initialXY 
)
pure virtual

Called when the gizmo is first clicked, with the camera parameters and the initial pixel coordinates.

Implemented in Ra::Gui::TranslateGizmo, Ra::Gui::ScaleGizmo, and Ra::Gui::RotateGizmo.

Member Data Documentation

◆ s_material

std::array< std::shared_ptr< Ra::Engine::Data::PlainMaterial >, 3 > Ra::Gui::Gizmo::s_material
staticprotected

The Materials used to diplay the gizmo: 0-Red, 1-Green, 2-Blue. The material are shared accros gizmos. This might allow coherent dynamic style for Ui objects.

Definition at line 118 of file Gizmo.hpp.


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