1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGVIEWER_SCENE
15#define OSGVIEWER_SCENE 1
17#include <osgGA/GUIEventHandler>
18#include <osgGA/EventVisitor>
19#include <osgDB/DatabasePager>
20#include <osgDB/ImagePager>
22#include <osgViewer/Export>
28/** Scene holds the higher level reference to a single scene graph.*/
29class OSGVIEWER_EXPORT Scene : public osg::Referenced
33 virtual const char* className() const { return "Scene"; }
35 void setSceneData(osg::Node* node);
36 osg::Node* getSceneData();
37 const osg::Node* getSceneData() const;
40 void setDatabasePager(osgDB::DatabasePager* dp);
41 osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); }
42 const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); }
44 void setImagePager(osgDB::ImagePager* ip);
45 osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
46 const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
48 virtual bool requiresUpdateSceneGraph() const;
50 virtual void updateSceneGraph(osg::NodeVisitor& updateVisitor);
52 virtual bool requiresRedraw() const;
54 /** Get the Scene object that has the specified node assigned to it.
55 * return 0 if no Scene has yet been assigned the specified node.*/
56 static Scene* getScene(osg::Node* node);
63 /** Get the Scene object that has the specified node assigned to it.
64 * or return a new Scene if no Scene has yet been assigned the specified node.*/
65 static Scene* getOrCreateScene(osg::Node* node);
69 osg::ref_ptr<osg::Node> _sceneData;
71 osg::ref_ptr<osgDB::DatabasePager> _databasePager;
72 osg::ref_ptr<osgDB::ImagePager> _imagePager;