Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGVIEW_H
17 #define SURGSIM_GRAPHICS_OSGVIEW_H
19 #include <osgViewer/Viewer>
26 class DisplaySettings;
47 class OsgTrackballZoomManipulator;
49 SURGSIM_STATIC_REGISTRATION(OsgView);
72 void setPosition(
const std::array<int, 2>& position)
override;
76 void setDimensions(
const std::array<int, 2>& dimensions)
override;
92 void setCamera(std::shared_ptr<SurgSim::Framework::Component> camera)
override;
152 void update(
double dt)
override;
155 osg::ref_ptr<osgViewer::View>
getOsgView()
const;
214 #endif // SURGSIM_GRAPHICS_OSGVIEW_H
void setDimensions(const std::array< int, 2 > &dimensions) override
Set the dimensions of this view.
Definition: OsgView.cpp:128
virtual osg::ref_ptr< osg::DisplaySettings > createDisplaySettings() const
Definition: OsgView.cpp:279
void setWindowBorderEnabled(bool enabled) override
Sets whether the view window has a border.
Definition: OsgView.cpp:167
bool m_keyboardEnabled
Indicate if a keyboard device is enabled.
Definition: OsgView.h:202
bool m_isWindowBorderEnabled
Whether the view window has a border.
Definition: OsgView.h:183
SurgSim::Math::Vector3d getManipulatorPosition()
Definition: OsgView.cpp:521
bool doInitialize() override
Initialize the view.
Definition: OsgView.cpp:230
bool isMouseDeviceEnabled()
Definition: OsgView.cpp:484
bool doWakeUp() override
Wake up the view.
Definition: OsgView.cpp:235
OSG-based implementation of graphics view class.
Definition: OsgView.h:56
void fixupStatsHandler(osgViewer::StatsHandler *statsHandler)
Patch the StatsHandler rendering.
Definition: OsgView.cpp:298
std::shared_ptr< SurgSim::Devices::KeyboardDevice > m_keyboardDevice
Definition: OsgView.h:203
void setManipulatorLookAt(const SurgSim::Math::Vector3d &lookAt)
Set the camera manipulator lookAt.
Definition: OsgView.cpp:526
void enableMouseDevice(bool val)
Turn on/off the mouse device to be used.
Definition: OsgView.cpp:461
bool isManipulatorEnabled()
Definition: OsgView.cpp:415
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
bool m_isFirstUpdate
Whether the next update will be the first time the view has been updated On the first update,...
Definition: OsgView.h:187
osg::ref_ptr< osgViewer::View > getOsgView() const
Definition: OsgView.cpp:390
~OsgView()
Destructor.
Definition: OsgView.cpp:107
Definition: CompoundShapeToGraphics.cpp:29
void setCamera(std::shared_ptr< SurgSim::Framework::Component > camera) override
Sets the camera which provides the viewpoint in the scene Only allows OsgCamera components,...
Definition: OsgView.cpp:178
std::array< int, 2 > getPosition() const override
Get the position of this view.
Definition: OsgView.cpp:123
void setOsgMapsUniforms(bool val)
Enable osg modelview uniforms mapping, in this mode osg replaces the gl builtins with osg_* names,...
Definition: OsgView.cpp:379
OsgView(const std::string &name)
Constructor.
Definition: OsgView.cpp:73
bool isWindowBorderEnabled() const override
Returns whether the view window has a border.
Definition: OsgView.cpp:173
bool m_osgMapUniforms
Wether to enable osg uniform mapping.
Definition: OsgView.h:195
std::array< int, 2 > m_dimensions
Dimensions of the view on the screen (in pixels)
Definition: OsgView.h:180
void setPosition(const std::array< int, 2 > &position) override
Set the position of this view.
Definition: OsgView.cpp:114
void setManipulatorParameters(const SurgSim::Math::Vector3d &position, const SurgSim::Math::Vector3d &lookat)
As the camera is not accessible from here and as it cannot be controlled from the outside any more we...
Definition: OsgView.cpp:503
osg::ref_ptr< OsgTrackballZoomManipulator > m_manipulator
Definition: OsgView.h:197
osg::ref_ptr< osgViewer::View > m_view
OSG view which performs the actual work involved in setting up and rendering to a window.
Definition: OsgView.h:192
SurgSim::Math::Vector3d m_manipulatorLookat
Definition: OsgView.h:199
std::array< int, 2 > m_screenDimensions
Definition: OsgView.h:181
SurgSim::Math::Vector3d m_manipulatorPosition
Definition: OsgView.h:198
bool m_areWindowSettingsDirty
Whether the settings have been changed and the window needs to be updated.
Definition: OsgView.h:189
std::array< int, 2 > getDimensions() const override
Get the dimensions of this view.
Definition: OsgView.cpp:137
void update(double dt) override
Updates the view.
Definition: OsgView.cpp:187
bool m_mouseEnabled
Indicate if a mouse device is enabled.
Definition: OsgView.h:206
Base graphics view class, which defines the basic interface for all graphics views.
Definition: View.h:39
MouseDevice
Definition: CMakeLists.txt:35
void setManipulatorPosition(const SurgSim::Math::Vector3d &position)
Set the camera manipulator position.
Definition: OsgView.cpp:516
int doSetTargetScreen(int val) override
Determine Screen Size.
Definition: OsgView.cpp:347
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgView)
std::shared_ptr< SurgSim::Input::CommonDevice > getKeyboardDevice()
Return the keyboard to be used with this view.
Definition: OsgView.cpp:448
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
void enableManipulator(bool val)
Enables a camera manipulator, implemented via a trackball, this is a temporary solution as it uses th...
Definition: OsgView.cpp:395
void enableKeyboardDevice(bool val)
Turn on/off the keyboard device to be used.
Definition: OsgView.cpp:420
bool getOsgMapsUniforms()
Definition: OsgView.cpp:385
std::array< double, 2 > getDimensionsDouble() const override
Get the dimensions of this view in doubles.
Definition: OsgView.cpp:159
bool isKeyboardDeviceEnabled()
Definition: OsgView.cpp:443
std::shared_ptr< SurgSim::Devices::MouseDevice > m_mouseDevice
Definition: OsgView.h:207
SurgSim::Math::Vector3d getManipulatorLookAt()
Definition: OsgView.cpp:531
KeyboardDevice
Definition: CMakeLists.txt:35
std::shared_ptr< SurgSim::Input::CommonDevice > getMouseDevice()
Return the mouse to be used with this view.
Definition: OsgView.cpp:489
std::array< int, 2 > m_position
Position of the view on the screen (in pixels)
Definition: OsgView.h:178
void setDimensionsDouble(const std::array< double, 2 > &dimensions) override
Set the dimensions of this view in doubles.
Definition: OsgView.cpp:149