9#ifndef GEPETTO_VIEWER_WINDOWMANAGER_HH
10#define GEPETTO_VIEWER_WINDOWMANAGER_HH
14#include <osgGA/KeySwitchMatrixManipulator>
15#include <osgViewer/Viewer>
16#include <osgViewer/ViewerEventHandlers>
27 const int nodeTrackerManipulatorIndex;
30 GroupNodePtr_t scene_ptr_;
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,
72 const unsigned int& width,
const unsigned int& height);
76 WindowManager(osgViewer::Viewer* v, osg::GraphicsContext* gc);
81 const unsigned int& width,
const unsigned int& height);
86 void initWeakPtr(WindowManagerWeakPtr other_weak_ptr);
90 enum TextAlignment { TOP = 0, CENTER = 1, BOTTOM = 2, RIGHT = 0, LEFT = 2 };
98 static WindowManagerPtr_t
create(osg::GraphicsContext* gc);
100 static WindowManagerPtr_t
create(osgViewer::Viewer* v,
101 osg::GraphicsContext* gc);
106 static WindowManagerPtr_t
create(
const unsigned int& x,
const unsigned int& y,
107 const unsigned int& width,
108 const unsigned int& height);
112 static WindowManagerPtr_t
createCopy(WindowManagerPtr_t other);
116 virtual WindowManagerPtr_t
clone(
void)
const;
120 WindowManagerPtr_t
self(
void)
const;
124 virtual bool addNode(NodePtr_t graphical_object_ptr);
128 virtual GroupNodePtr_t
getScene()
const {
return self(); }
163 const std::string& text,
float size = 20);
172 void startCapture(
const std::string& filename,
const std::string& extension);
180 applyBackgroundColor();
185 applyBackgroundColor();
Definition group-node.h:19
Definition window-manager.h:25
void attachCameraToNode(NodePtr_t node)
virtual void setWindowPosition(const osgVector2 &position)
virtual WindowManagerPtr_t clone(void) const
void setCameraTransform(const osg::Vec3d &pos, const osg::Quat &rot)
WindowManagerPtr_t self(void) const
void getCameraTransform(osg::Vec3d &pos, osg::Quat &rot)
static WindowManagerPtr_t create(osgViewer::Viewer *v, osg::GraphicsContext *gc)
bool writeNodeFile(const std::string &filename)
void setBackgroundColor2(const osg::Vec4 &color)
Definition window-manager.h:183
static WindowManagerPtr_t create()
::osgViewer::ViewerRefPtr getViewerClone()
void captureFrame(const std::string &filename)
static WindowManagerPtr_t create(const unsigned int &x, const unsigned int &y, const unsigned int &width, const unsigned int &height)
virtual void setWindowDimension(const osgVector2 &size)
void startCapture(const std::string &filename, const std::string &extension)
osgVector2 getWindowPosition() const
virtual bool addNode(NodePtr_t graphical_object_ptr)
virtual GroupNodePtr_t getScene() const
Definition window-manager.h:128
void setBackgroundColor1(const osg::Vec4 &color)
Definition window-manager.h:178
osgVector2 getWindowDimension() const
TextAlignment
Definition window-manager.h:90
static WindowManagerPtr_t createCopy(WindowManagerPtr_t other)
std::string getText(TextAlignment verticalPos, TextAlignment horizontalPos) const
static WindowManagerPtr_t create(osg::GraphicsContext *gc)
void setText(TextAlignment verticalPos, TextAlignment horizontalPos, const std::string &text, float size=20)
::osg::Vec2f osgVector2
Definition config-osg.h:98
#define DEF_CLASS_SMART_PTR(className)
Definition macros.h:51
Definition action-search-bar.hh:27