iMSTK
Interactive Medical Simulation Toolkit
|
Defines a control scheme to move the camera with joysticks. Relative to world space with Y up. Left joystick look/rotate around Y, right joystick move along XZ, a,b up/down along Y. More...
#include <VRCameraControl.h>
Public Member Functions | |
VRCameraControl (const std::string &name="VRCameraControl") | |
const Mat4d & | getDeltaTransform () |
void | setCamera (std::shared_ptr< Camera > camera) |
Get/Set the camera to be controlled. | |
std::shared_ptr< Camera > | getCamera () const |
void | printControls () override |
Prints the controls. | |
void | update (const double &dt) override |
Updates control based on current device state. | |
double | getTranslateSpeedScale () const |
Get/Set how fast the camera translates along XZ plane. | |
void | setTranslateSpeedScale (const double translateSpeedScale) |
double | getRotateSpeedScale () const |
Get/Set how fast the camera rotates around Y. | |
void | setRotateSpeedScale (const double rotateSpeedScale) |
double | getVerticalSpeedScale () const |
Get/Set the vertical speed, how fast you move along Y. | |
void | setVerticalSpeedScale (double verticalSpeed) |
std::shared_ptr< OpenVRDeviceClient > | getTranslateDevice () const |
Get/Set the device that can translate the camera along XZ. | |
void | setTranslateDevice (std::shared_ptr< OpenVRDeviceClient > translateDevice) |
std::shared_ptr< OpenVRDeviceClient > | getRotateDevice () const |
Get/Set the device that can rotate the camera around Y. | |
void | setRotateDevice (std::shared_ptr< OpenVRDeviceClient > rotateDevice) |
![]() | |
SIGNAL (DeviceControl, modified) | |
std::shared_ptr< DeviceClient > | getDevice () const |
Set/Get the device client used in the control. | |
virtual void | setDevice (std::shared_ptr< DeviceClient > device) |
![]() | |
virtual void | update (const UpdateInfo &imstkNotUsed(updateData)) |
virtual void | visualUpdate (const UpdateInfo &imstkNotUsed(updateData)) |
void | initTaskGraphEdges () |
Setup the edges/connections of the TaskGraph. | |
std::shared_ptr< TaskGraph > | getTaskGraph () const |
![]() | |
const std::string & | getName () const |
void | setName (const std::string &name) |
std::weak_ptr< Entity > | getEntity () const |
Get parent entity. | |
void | initialize () |
Initialize the component, called at a later time after all component construction is complete. | |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Attributes | |
std::shared_ptr< OpenVRDeviceClient > | m_translateDevice = nullptr |
std::shared_ptr< OpenVRDeviceClient > | m_rotateDevice = nullptr |
std::shared_ptr< Camera > | m_camera = nullptr |
double | m_rotateSpeedScale = 1.0 |
double | m_translateSpeedScale = 1.0 |
double | m_translateVerticalSpeedScale = 1.0 |
Mat4d | m_deltaTransform = Mat4d::Identity() |
![]() | |
std::shared_ptr< DeviceClient > | m_deviceClient |
![]() | |
std::shared_ptr< TaskGraph > | m_taskGraph = nullptr |
![]() | |
std::string | m_name |
std::weak_ptr< Entity > | m_entity |
Parent entity this component exists on. | |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Additional Inherited Members | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
![]() | |
DeviceControl (const std::string &name="DeviceControl") | |
![]() | |
Behaviour (const std::string &name="Behaviour") | |
Behaviour (const bool useTaskGraph, const std::string &name="Behaviour") | |
virtual void | initGraphEdges (std::shared_ptr< TaskNode > imstkNotUsed(source), std::shared_ptr< TaskNode > imstkNotUsed(sink)) |
Setup the edges/connections of the TaskGraph. More... | |
![]() | |
Component (const std::string &name="Component") | |
virtual void | init () |
Initialize the component, called at a later time after all component construction is complete. | |
Defines a control scheme to move the camera with joysticks. Relative to world space with Y up. Left joystick look/rotate around Y, right joystick move along XZ, a,b up/down along Y.
Definition at line 28 of file VRCameraControl.h.