Scene 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSGVIEWER_SCENE
  14. #define OSGVIEWER_SCENE 1
  15. #include <osgGA/GUIEventHandler>
  16. #include <osgGA/EventVisitor>
  17. #include <osgDB/DatabasePager>
  18. #include <osgDB/ImagePager>
  19. #include <osgViewer/Export>
  20. #include <list>
  21. namespace osgViewer{
  22. /** Scene holds the higher level reference to a single scene graph.*/
  23. class OSGVIEWER_EXPORT Scene : public osg::Referenced
  24. {
  25. public:
  26. virtual const char* className() const { return "Scene"; }
  27. void setSceneData(osg::Node* node);
  28. osg::Node* getSceneData();
  29. const osg::Node* getSceneData() const;
  30. void setDatabasePager(osgDB::DatabasePager* dp);
  31. osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); }
  32. const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); }
  33. void setImagePager(osgDB::ImagePager* ip);
  34. osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
  35. const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
  36. virtual bool requiresUpdateSceneGraph() const;
  37. virtual void updateSceneGraph(osg::NodeVisitor& updateVisitor);
  38. virtual bool requiresRedraw() const;
  39. /** Get the Scene object that has the specified node assigned to it.
  40. * return 0 if no Scene has yet been assigned the specified node.*/
  41. static Scene* getScene(osg::Node* node);
  42. protected:
  43. Scene();
  44. virtual ~Scene();
  45. /** Get the Scene object that has the specified node assigned to it.
  46. * or return a new Scene if no Scene has yet been assigned the specified node.*/
  47. static Scene* getOrCreateScene(osg::Node* node);
  48. friend class View;
  49. osg::ref_ptr<osg::Node> _sceneData;
  50. osg::ref_ptr<osgDB::DatabasePager> _databasePager;
  51. osg::ref_ptr<osgDB::ImagePager> _imagePager;
  52. };
  53. }
  54. #endif