9 #ifndef GEPETTO_VIEWER_WINDOWMANAGER_HH 10 #define GEPETTO_VIEWER_WINDOWMANAGER_HH 12 #include <osgGA/KeySwitchMatrixManipulator> 13 #include <osgViewer/Viewer> 14 #include <osgViewer/ViewerEventHandlers> 23 class WindowManager :
public GroupNode
27 const int nodeTrackerManipulatorIndex;
33 ::osgViewer::ViewerRefPtr viewer_ptr_;
36 ::osg::CameraRefPtr main_camera_;
37 ::osg::GraphicsContextRefPtr gc_;
40 ::osg::CameraRefPtr bg_camera_;
41 ::osg::Vec4 bg_color1_;
42 ::osg::Vec4 bg_color2_;
43 ::osg::GeometryRefPtr bg_geom_;
46 osg::ref_ptr < ::osgViewer::ScreenCaptureHandler> screen_capture_ptr_;
49 ::osg::CameraRefPtr hud_camera_;
50 osg::ref_ptr<osgText::Text> texts_[3][3];
51 osg::ref_ptr<osg::Geode> textGeode_;
52 bool textActive_[3][3];
54 bool lastSceneWasDisrty_;
56 osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> manipulator_ptr;
58 WindowManagerWeakPtr weak_ptr_;
60 void createManipulator();
62 void createBackground();
63 void applyBackgroundColor();
65 void createHUDcamera();
67 void init(osg::GraphicsContext* gc);
69 void init(osgViewer::Viewer* v, osg::GraphicsContext* gc);
71 void init(
const unsigned int& x,
const unsigned int& y,
const unsigned int& width,
const unsigned int& height);
75 WindowManager (osgViewer::Viewer* v, osg::GraphicsContext* gc);
77 WindowManager (osg::GraphicsContext* gc);
79 WindowManager(
const unsigned int& x,
const unsigned int& y,
const unsigned int& width,
const unsigned int& height);
81 WindowManager(
const WindowManager& other);
84 void initWeakPtr (WindowManagerWeakPtr other_weak_ptr);
108 static WindowManagerPtr_t create(
const unsigned int& x,
const unsigned int& y,
const unsigned int& width,
const unsigned int& height);
132 virtual bool done ();
136 virtual bool frame ();
162 const std::string& text,
float size = 20);
172 const std::string& extension);
179 { bg_color1_ = color; applyBackgroundColor(); }
182 { bg_color2_ = color; applyBackgroundColor(); }
std::string getText(TextAlignment verticalPos, TextAlignment horizontalPos) const
void attachCameraToNode(NodePtr_t node)
void startCapture(const std::string &filename, const std::string &extension)
TextAlignment
Definition: window-manager.h:88
virtual void setWindowDimension(const osgVector2 &size)
Definition: window-manager.h:89
viewer::WindowManagerPtr_t WindowManagerPtr_t
Definition: osgwidget.hh:40
osgVector2 getWindowPosition() const
virtual bool addNode(NodePtr_t graphical_object_ptr)
void getCameraTransform(osg::Vec3d &pos, osg::Quat &rot)
void setBackgroundColor2(const osg::Vec4 &color)
Definition: window-manager.h:181
::osg::Vec2f osgVector2
Definition: config-osg.h:108
static WindowManagerPtr_t createCopy(WindowManagerPtr_t other)
Definition: window-manager.h:92
void captureFrame(const std::string &filename)
Definition: window-manager.h:93
Definition: window-manager.h:91
viewer::NodePtr_t NodePtr_t
Definition: fwd.hh:47
Definition: action-search-bar.hh:27
::osgViewer::ViewerRefPtr getViewerClone()
Definition: window-manager.h:90
viewer::GroupNodePtr_t GroupNodePtr_t
Definition: fwd.hh:50
void setCameraTransform(const osg::Vec3d &pos, const osg::Quat &rot)
bool writeNodeFile(const std::string &filename)
void setText(TextAlignment verticalPos, TextAlignment horizontalPos, const std::string &text, float size=20)
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
virtual GroupNodePtr_t getScene() const
Definition: window-manager.h:128
virtual void setWindowPosition(const osgVector2 &position)
osgVector2 getWindowDimension() const
virtual WindowManagerPtr_t clone(void) const
void setBackgroundColor1(const osg::Vec4 &color)
Definition: window-manager.h:178
static WindowManagerPtr_t create()