30 #include <boost/shared_ptr.hpp>
31 #include <boost/enable_shared_from_this.hpp>
34 #include <osg/Version>
35 #include <osgViewer/View>
36 #include <osgViewer/Viewer>
40 #if ( ( OPENSCENEGRAPH_MAJOR_VERSION > 2 ) || ( OPENSCENEGRAPH_MAJOR_VERSION == 2 && ( OPENSCENEGRAPH_MINOR_VERSION > 9 || \
41 ( OPENSCENEGRAPH_MINOR_VERSION == 9 && OPENSCENEGRAPH_PATCH_VERSION >= 8 ) ) ) )
42 #include <osgGA/CameraManipulator>
45 typedef CameraManipulator MatrixManipulator;
48 #include <osgGA/MatrixManipulator>
51 #include "../common/WColor.h"
52 #include "../common/WFlag.h"
54 #include "WGECamera.h"
55 #include "WGEGraphicsWindow.h"
56 #include "WGraphicsEngineMode.h"
58 #include "WGEScreenCapture.h"
60 #include "animation/WGEAnimationManipulator.h"
62 #include "WGEViewerEffectHorizon.h"
63 #include "WGEViewerEffectVignette.h"
64 #include "WGEViewerEffectImageOverlay.h"
72 public boost::enable_shared_from_this< WGEViewer >
78 typedef boost::shared_ptr< WGEViewer >
SPtr;
83 typedef boost::shared_ptr< const WGEViewer >
ConstSPtr;
97 WGEViewer( std::string name, osg::ref_ptr<osg::Referenced> wdata,
int x,
int y,
int width,
int height,
108 virtual void paint();
116 virtual void resize(
int width,
int height );
121 virtual void close();
128 #ifdef WGEMODE_SINGLETHREADED
129 osg::ref_ptr<osgViewer::Viewer>
getView();
131 osg::ref_ptr<osgViewer::View>
getView();
158 void setCamera( osg::ref_ptr< WGECamera > camera );
172 void setScene( osg::ref_ptr< WGEGroupNode > node );
179 osg::ref_ptr< WGEGroupNode >
getScene();
314 #ifdef WGEMODE_SINGLETHREADED
315 osg::ref_ptr< osgViewer::Viewer >
m_View;
369 virtual void operator()( osg::RenderInfo& renderInfo )
const;
457 #endif // WGEVIEWER_H
WGEViewerEffectVignette::SPtr m_effectVignette
Vignette effect.
osg::ref_ptr< WGEViewerEffectVignette > SPtr
Convenience typedef for a boost::shared_ptr< WGEViewerEffectVignette >.
osg::ref_ptr< WGEViewerEffectHorizon > SPtr
Convenience typedef for a boost::shared_ptr< WGEViewerEffectHorizon >.
virtual ~WGEViewer()
Destructor.
WBoolFlag::SPtr m_rendered
This flag is true and notifies after the first rendered frame.
std::string getVendor() const
Returns the queried vendor string.
void setEffectsActiveDefault(bool activeByDefault=true)
Activate viewer effects by default.
osg::ref_ptr< WPickHandler > getPickHandler()
Getter for the pick handler.
osg::ref_ptr< const WGEViewerEffectImageOverlay > ConstSPtr
Convenience typedef for a boost::shared_ptr< const WGEViewerEffectImageOverlay >. ...
WGEScreenCapture::RefPtr m_screenCapture
The screen capture callback.
virtual void close()
Close the viewer, but wait for the rendering thread to finish.
virtual void resize(int width, int height)
Updates size information.
WGEScreenCapture::RefPtr getScreenCapture() const
Returns the main cameras screen capture callback.
osg::ref_ptr< osgViewer::View > getView()
Getter for OpenSceneGraph View instance.
boost::shared_ptr< const WGEViewer > ConstSPtr
Convenience typedef.
osg::ref_ptr< osgGA::MatrixManipulator > m_animationModeManipulatorBackup
The manipulator that was set before entering animation mode.
void reset()
Resets the view using the installed manipulator.
boost::shared_ptr< WFlag< T > > SPtr
Convenience typedef for a boost::shared_ptr.
ProjectionMode
List of possible camera modes.
osg::ref_ptr< WGECamera > m_camera
The camera to which this was connected.
virtual void operator()(osg::RenderInfo &renderInfo) const
Query operator.
osg::ref_ptr< WGEGroupNode > getScene()
Returns the currently set OSG node.
osg::ref_ptr< WGEScreenCapture > RefPtr
Convenience typedef.
std::string getName() const
Returns the name of the viewer.
WPropBool m_throwing
The switch to enable the throw- functionality of some OSG manipulators.
std::string m_vendor
The vendor string.
osg::ref_ptr< WGEAnimationManipulator > RefPtr
Convenience typedef.
Class to handle events with a pick.
void setCameraManipulator(osg::ref_ptr< osgGA::MatrixManipulator > manipulator)
Sets the camera manipulator to use.
osg::ref_ptr< QueryCallback > m_queryCallback
The callback used for querying OpenGL features.
Class managing a single graphics context and OSG GraphicsWindow.
void updateBgColor()
Update the default clear color (bg color).
WGEAnimationManipulator::RefPtr animationMode(bool on=true)
The (de-)activates the animation mode.
WProperties::SPtr getProperties() const
Return a pointer to the properties object of the view.
virtual void paint()
Repaints the contents.
osg::ref_ptr< WGEGroupNode > m_scene
reference to the scene which is displayed by viewer
osg::ref_ptr< osgGA::MatrixManipulator > getCameraManipulator()
Returns current active camera manipulator.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
osg::ref_ptr< const WGEViewerEffectHorizon > ConstSPtr
Convenience typedef for a boost::shared_ptr< const WGEViewerEffectHorizon >.
WGEViewerEffectVignette::SPtr getVignette()
Return the vignette render effect for modification.
WBoolFlag::SPtr isFrameRendered() const
Returns the flag which denotes whether a frame was rendered.
WBoolFlag::SPtr m_run
True if callback was run once.
void setCamera(osg::ref_ptr< WGECamera > camera)
Sets the current camera.
osg::ref_ptr< WGEGroupNode > m_sceneMainNode
Keep the currently set scene node.
bool m_inAnimationMode
True -> animation mode on.
Class for managing one view to the scene.
osg::ref_ptr< WPickHandler > m_pickHandler
Pointer to the pick handler of the viewer.
std::string m_name
The name of the viewer.
Small class used for querying glGet info during rendering.
void setScene(osg::ref_ptr< WGEGroupNode > node)
Sets the scene graph node to be used for rendering.
boost::shared_ptr< WPropertyGroup > SPtr
shared pointer to object of this type
QueryCallback(osg::ref_ptr< WGECamera > camera, WBoolFlag::SPtr run)
Constructor.
WGEViewerEffectHorizon::SPtr getBackground()
Return the background render effect for modification.
void updateThrowing()
Update throw setting of the manipulator (if supported).
WGEViewerEffectImageOverlay::SPtr m_effectImageOverlay
Image overlay effect.
virtual ~QueryCallback()
Destructor.
WProperties::SPtr m_properties
The property object for the view.
WColor getBgColor() const
Returns the current default background color.
WGEViewerEffectImageOverlay::SPtr getImageOverlay()
Return the overlay render effect for modification.
osg::ref_ptr< WGECamera > getCamera()
Returns the camera currently in use.
WGEViewer(std::string name, osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height, WGECamera::ProjectionMode projectionMode=WGECamera::ORTHOGRAPHIC)
Default constructor.
osg::ref_ptr< WGEViewerEffectImageOverlay > SPtr
Convenience typedef for a boost::shared_ptr< WGEViewerEffectImageOverlay >.
WPropColor m_bgColor
The default clear color (bg color).
boost::shared_ptr< WGEViewer > SPtr
Convenience typedef.
WGEViewerEffectHorizon::SPtr m_effectHorizon
Horizon effect.
void setBgColor(const WColor &bgColor)
Determine the color of the viewer's background.
std::string getOpenGLVendor() const
Queries the OpenGL vendor info.
osg::ref_ptr< const WGEViewerEffectVignette > ConstSPtr
Convenience typedef for a boost::shared_ptr< const WGEViewerEffectVignette >.
osg::ref_ptr< osgViewer::View > m_View
The OpenSceneGraph view used in this (Composite)Viewer.
bool isAnimationMode() const
Checks if the viewer is in animation mode.