Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ScenePlainOpenSceneGraph.hh
1 #ifndef __SCENE_PLAIN_OPENSCENEGRAPH_HH_
2 #define __SCENE_PLAIN_OPENSCENEGRAPH_HH_
3 
4 
5 //#include <mip_config.h>
6 #include <Gui/biasgl.h>
7 
8 #ifdef WIN32
9 #undef GL_VERSION_2_1
10 #endif
11 
12 #include <osgViewer/Viewer>
13 #include <osgViewer/ViewerEventHandlers>
14 #include <osgDB/ReadFile>
15 #include <Base/Math/Vector3.hh>
16 
17 #include <GLviewer/Scenes/SceneBase.hh>
18 
19 namespace BIAS {
20 /**
21  * \class ScenePlainOpenSceneGraph
22  * \brief Implements slim openscenegraph scene without extras
23  * \attention You must call Init()!
24  * \author Falko Kellner
25  * \ingroup g_glviewer
26  */
27 class BIASGLviewer_EXPORT ScenePlainOpenSceneGraph : public SceneBase {
28 
29  public:
31 
32  virtual ~ScenePlainOpenSceneGraph();
33 
34  int Init(unsigned int width = 1200, unsigned int height = 900);
35 
36  void SetLighting(bool on);
37 
39  return rootNode_;
40  }
41 
42  bool Load(std::string filename);
43 
44  int AppendSubTreeFromFile(const std::string& fileName,
45  osg::ref_ptr<osg::Node>& childNode);
46 
47  int AppendSubTreeFromFile(const std::string& fileName);
48 
49  void AppendNode(osg::ref_ptr<osg::Node> node);
50 
51  void RemoveNode(osg::ref_ptr<osg::Node> node);
52 
53  void SetRootNode(osg::ref_ptr<osg::Group> newRoot);
54 
55  virtual void GetBoundingBox(BIAS::Vector3<double> &themin, BIAS::Vector3<double> &themax);
56  virtual Vector3<double> GetBoundingBoxCenter();
57 
58  osgViewer::GraphicsWindow* window() {
59  return embedWindow_.get();
60  }
61 
62  void Clear();
63 
64  protected:
65 
66  virtual void Draw();
67 
69  osg::observer_ptr<osgViewer::GraphicsWindow> embedWindow_;
71 
72  osg::Timer timer_;
73  osg::Timer_t startTick_;
75  unsigned int w_,h_;
76 
77  private:
78  bool initialized_;
79  };
80 
81 }
82 
83 #endif // __SCENE_PLAIN_OPENSCENEGRAPH_HH_
osg::ref_ptr< osg::Group > rootNode_
osg::ref_ptr< osgViewer::Viewer > sceneView_
osg::ref_ptr< osg::Group > GetRootNode()
Base class for all scenes.
Definition: SceneBase.hh:68
Implements slim openscenegraph scene without extras.
osgViewer::GraphicsWindow * window()
osg::observer_ptr< osgViewer::GraphicsWindow > embedWindow_
osg::ref_ptr< osg::FrameStamp > frameStamp_