Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef HUDCAMERA_H_
00014 #define HUDCAMERA_H_
00015
00016 #include "SimulatorConfig.h"
00017 #include "CustomWidget.h"
00018
00019 #include <osg/Image>
00020
00022 class HUDCamera : public CustomWidget
00023 {
00024 osg::ref_ptr<osgWidget::Widget> widget;
00025
00026 class widgetUpdateCallback : public osg::Drawable::UpdateCallback
00027 {
00028 osg::ref_ptr<osg::Image> image;
00029 public:
00030 widgetUpdateCallback(osg::Image *i) :
00031 osg::Drawable::UpdateCallback()
00032 {
00033 this->image = i;
00034 }
00035 virtual void update(osg::NodeVisitor *nv, osg::Drawable *d)
00036 {
00037 (static_cast<osgWidget::Widget*>(d))->setImage(image, true, false);
00038 }
00039 };
00040
00041 public:
00042 unsigned int width, height;
00043 unsigned int posx, posy;
00044 double scale;
00045
00046 osg::ref_ptr<osg::Image> osg_image;
00047 bool ready_;
00048
00050 HUDCamera(unsigned int width, unsigned int height, unsigned int posx = 0, unsigned int posy = 0, double scale = 1,
00051 int blackWhite = 0);
00052
00053 bool ready()
00054 {
00055 return ready_;
00056 }
00057
00058
00059 osg::ref_ptr<osgWidget::Window> getWidgetWindow();
00060
00061 ~HUDCamera();
00062 };
00063
00064 #endif