Radium Engine  1.5.20
Loading...
Searching...
No Matches
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

 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 Enumeration Documentation

◆ Mode

enum Ra::Gui::Gizmo::Mode

Definition at line 44 of file Gizmo.hpp.

Constructor & Destructor Documentation

◆ Gizmo()

Ra::Gui::Gizmo::Gizmo ( Engine::Scene::Component * c,
const Core::Transform & worldTo,
const Core::Transform & t,
Mode mode )

Definition at line 20 of file Gizmo.cpp.

◆ ~Gizmo()

Ra::Gui::Gizmo::~Gizmo ( )
virtual

Definition at line 39 of file Gizmo.cpp.

Member Function Documentation

◆ addRenderObject()

void Ra::Gui::Gizmo::addRenderObject ( Engine::Rendering::RenderObject * ro)
protected

add a render object to display the Gizmo

Definition at line 83 of file Gizmo.cpp.

◆ findPointOnAxis()

bool Ra::Gui::Gizmo::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 )
staticprotected

Find a mouse-designed point on a 3D axis.

Definition at line 51 of file Gizmo.cpp.

+ Here is the call graph for this function:

◆ findPointOnPlane()

bool Ra::Gui::Gizmo::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 )
staticprotected

Find a mouse-designed point on a 3D plane.

Definition at line 70 of file Gizmo.cpp.

+ Here is the call graph for this function:

◆ getControler()

Gizmo::UiSelectionControler * Ra::Gui::Gizmo::getControler ( int ro)
protected

Returns the controler (ShaderParametersProvider) associated to the given gizmo component.

Definition at line 97 of file Gizmo.cpp.

◆ isSelected()

virtual bool Ra::Gui::Gizmo::isSelected ( )
pure virtual

return the selection state of the gizmo: true if the gizmo is selected, false if not.

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

◆ 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::RotateGizmo, Ra::Gui::ScaleGizmo, and Ra::Gui::TranslateGizmo.

◆ ros()

const std::vector< Engine::Rendering::RenderObject * > & Ra::Gui::Gizmo::ros ( ) const
inlineprotected

read access to the gizmo render objects id

Definition at line 100 of file Gizmo.hpp.

◆ selectConstraint()

virtual void Ra::Gui::Gizmo::selectConstraint ( int drawableIndex)
pure virtual

Called when one of the drawables of the gizmo has been selected.

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

◆ 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::RotateGizmo, Ra::Gui::ScaleGizmo, and Ra::Gui::TranslateGizmo.

◆ show()

void Ra::Gui::Gizmo::show ( bool on)

Definition at line 45 of file Gizmo.cpp.

◆ updateTransform()

virtual void Ra::Gui::Gizmo::updateTransform ( Mode mode,
const Core::Transform & worldTo,
const Core::Transform & t )
pure virtual

Called every time the underlying transform may have changed.

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

Member Data Documentation

◆ m_comp

Engine::Scene::Component* Ra::Gui::Gizmo::m_comp
protected

Engine Ui component.

Definition at line 122 of file Gizmo.hpp.

◆ m_mode

Mode Ra::Gui::Gizmo::m_mode
protected

local or global.

Definition at line 123 of file Gizmo.hpp.

◆ m_transform

Core::Transform Ra::Gui::Gizmo::m_transform
protected

Transform to be edited.

Definition at line 121 of file Gizmo.hpp.

◆ m_worldTo

Core::Transform Ra::Gui::Gizmo::m_worldTo
protected

World to local space where the transform lives.

Definition at line 120 of file Gizmo.hpp.

◆ 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 117 of file Gizmo.hpp.


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