Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp > Class Template Reference
Inheritance diagram for vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >:

Public Types

using MatrixType = Matrix44< Scalar >
 
using PointType = Point3< Scalar >
 
using ScalarType = Scalar
 
using TrackBallType = vcl::TrackBall< Scalar >
 

Public Member Functions

const Camera< Scalar > & camera () const
 
void fitScene (const Point3< Scalar > &center, Scalar radius)
 
void focus (const Point3< Scalar > &center)
 
Matrix44< Scalar > gizmoMatrix () const
 
DirectionalLight< Scalar > light () const
 
Matrix44< Scalar > lightGizmoMatrix () const
 
void onKeyPress (Key::Enum key, const KeyModifiers &modifiers) override
 
void onKeyRelease (Key::Enum key, const KeyModifiers &modifiers) override
 
void onMouseMove (double x, double y, const KeyModifiers &modifiers) override
 
void onMousePress (MouseButton::Enum button, double x, double y, const KeyModifiers &modifiers) override
 
void onMouseRelease (MouseButton::Enum button, double x, double y, const KeyModifiers &modifiers) override
 
void onMouseScroll (double dx, double dy, const KeyModifiers &modifiers) override
 
void onResize (unsigned int width, unsigned int height) override
 
Matrix44< Scalar > projectionMatrix () const
 
void reset ()
 
 TrackBallEventDrawerT (uint width=1024, uint height=768)
 
Matrix44< Scalar > viewMatrix () const
 
- Public Member Functions inherited from vcl::EventDrawer< DerivedRenderApp >
 EventDrawer (uint, uint)
 
virtual void onMouseDoubleClick (MouseButton::Enum button, double x, double y, const KeyModifiers &modifiers)
 
- Public Member Functions inherited from vcl::PlainDrawer< DerivedRenderApp >
virtual void onDraw (uint viewId)
 
virtual void onDrawContent (uint viewId)
 
virtual void onDrawId (uint viewId)
 
virtual void onInit (uint viewId)
 
virtual void onPostDraw ()
 
virtual void onResize (uint width, uint height)
 
 PlainDrawer (uint, uint)
 

Static Public Attributes

static const Point3< Scalar > UNIT_X = {1, 0, 0}
 
static const Point3< Scalar > UNIT_Y = {0, 1, 0}
 
- Static Public Attributes inherited from vcl::EventDrawer< DerivedRenderApp >
static const bool CAN_BLOCK_EVENT_PROPAGATION = false
 

Protected Member Functions

MotionType currentMotion () const
 
bool isDragging () const
 
- Protected Member Functions inherited from vcl::PlainDrawer< DerivedRenderApp >
autoderived ()
 
const autoderived () const
 

Private Types

using Axis = unsigned char
 
using Base = EventDrawer< DerivedRenderApp >
 
using MotionType = vcl::TrackBall< Scalar >::MotionType
 

Private Member Functions

void keyPress (Key::Enum key)
 
void keyRelease (Key::Enum key)
 
void moveMouse (int x, int y)
 
void pressMouse (MouseButton::Enum button)
 
void releaseMouse (MouseButton::Enum button)
 
void resizeViewer (uint w, uint h)
 
void scroll (Scalar pixelDeltaX, Scalar pixelDeltaY)
 
void setKeyModifiers (KeyModifiers keys)
 

Static Private Member Functions

static void rotate (TrackBallType &t, const Point3< Scalar > &axis, Scalar angle=M_PI/6)
 
static void rotateLight (TrackBallType &t, const Point3< Scalar > &axis, Scalar angle=M_PI/6)
 
static void translate (TrackBallType &t, const Point3< Scalar > &translation)
 

Private Attributes

KeyModifiers mCurrentKeyModifiers = {KeyModifier::NO_MODIFIER}
 
MouseButton::Enum mCurrentMouseButton = MouseButton::NO_BUTTON
 
Point3< Scalar > mDefaultTrackBallCenter
 
float mDefaultTrackBallRadius = 1.0
 
std::map< std::pair< MouseButton::Enum, KeyModifiers >, MotionType > mDragMotionMap
 
uint mHeight = 768
 
std::map< std::pair< Key::Enum, KeyModifiers >, std::function< void(TrackBallType &t)> > mKeyAtomicMap
 
std::map< std::pair< KeyModifiers, Axis >, MotionType > mScrollAtomicMap
 
vcl::TrackBall< Scalar > mTrackball
 
uint mWidth = 1024
 

Static Private Attributes

static constexpr double DISCRETE_ROTATION_STEP = M_PI_4 / 3.0
 
static constexpr double DISCRETE_TRANSLATION_STEP = 0.1
 

Additional Inherited Members

- Protected Types inherited from vcl::PlainDrawer< DerivedRenderApp >
using DRA = DerivedRenderApp
 

Member Function Documentation

◆ onKeyPress()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onKeyPress ( Key::Enum  key,
const KeyModifiers modifiers 
)
inlineoverridevirtual

◆ onKeyRelease()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onKeyRelease ( Key::Enum  key,
const KeyModifiers modifiers 
)
inlineoverridevirtual

◆ onMouseMove()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onMouseMove ( double  x,
double  y,
const KeyModifiers modifiers 
)
inlineoverridevirtual

◆ onMousePress()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onMousePress ( MouseButton::Enum  button,
double  x,
double  y,
const KeyModifiers modifiers 
)
inlineoverridevirtual

◆ onMouseRelease()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onMouseRelease ( MouseButton::Enum  button,
double  x,
double  y,
const KeyModifiers modifiers 
)
inlineoverridevirtual

◆ onMouseScroll()

template<typename Scalar , typename DerivedRenderApp >
void vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::onMouseScroll ( double  dx,
double  dy,
const KeyModifiers modifiers 
)
inlineoverridevirtual

Member Data Documentation

◆ mDragMotionMap

template<typename Scalar , typename DerivedRenderApp >
std::map<std::pair<MouseButton::Enum, KeyModifiers>, MotionType> vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::mDragMotionMap
private
Initial value:
= {
{{MouseButton::LEFT, {KeyModifier::NO_MODIFIER}},
TrackBallType::ARC },
{{MouseButton::LEFT, {KeyModifier::CONTROL}}, TrackBallType::PAN },
{{MouseButton::LEFT, {KeyModifier::ALT}}, TrackBallType::ZMOVE},
{{MouseButton::LEFT, {KeyModifier::SHIFT}}, TrackBallType::SCALE},
{{MouseButton::MIDDLE, {KeyModifier::NO_MODIFIER}},
TrackBallType::PAN },
{{MouseButton::MIDDLE, {KeyModifier::CONTROL}},
TrackBallType::ROLL },
{{MouseButton::LEFT, {KeyModifier::SHIFT, KeyModifier::CONTROL}},
TrackBallType::DIR_LIGHT_ARC },
}

◆ mScrollAtomicMap

template<typename Scalar , typename DerivedRenderApp >
std::map<std::pair<KeyModifiers, Axis>, MotionType> vcl::TrackBallEventDrawerT< Scalar, DerivedRenderApp >::mScrollAtomicMap
private
Initial value:
= {
{{{KeyModifier::NO_MODIFIER}, 1}, TrackBallType::SCALE},
{{{KeyModifier::CONTROL}, 1}, TrackBallType::ROLL },
{{{KeyModifier::SHIFT}, 1}, TrackBallType::FOV },
}

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