2006-11-27 22:52:07 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGVIEWER_VIEW
|
|
|
|
#define OSGVIEWER_VIEW 1
|
|
|
|
|
|
|
|
#include <osg/View>
|
|
|
|
#include <osgGA/MatrixManipulator>
|
|
|
|
#include <osgViewer/Scene>
|
|
|
|
|
2006-12-23 01:46:21 +08:00
|
|
|
#include <osgUtil/SceneView>
|
|
|
|
|
2006-11-29 04:35:31 +08:00
|
|
|
namespace osgViewer {
|
|
|
|
|
2006-11-27 22:52:07 +08:00
|
|
|
/** View holds a single view on a scene, this view may be composed of one or more slave cameras.*/
|
2007-01-02 02:20:10 +08:00
|
|
|
class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
2006-11-27 22:52:07 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
View();
|
|
|
|
|
|
|
|
void setSceneData(osg::Node* node);
|
2006-12-20 00:00:51 +08:00
|
|
|
osg::Node* getSceneData() { return _scene.valid() ? _scene->getSceneData() : 0; }
|
|
|
|
const osg::Node* getSceneData() const { return _scene.valid() ? _scene->getSceneData() : 0; }
|
2006-11-27 22:52:07 +08:00
|
|
|
|
2006-12-21 05:13:29 +08:00
|
|
|
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
|
|
|
|
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
|
|
|
|
const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); }
|
|
|
|
|
2006-11-27 22:52:07 +08:00
|
|
|
void setCameraManipulator(osgGA::MatrixManipulator* manipulator);
|
|
|
|
osgGA::MatrixManipulator* getCameraManipulator() { return _cameraManipulator.get(); }
|
|
|
|
const osgGA::MatrixManipulator* getCameraManipulator() const { return _cameraManipulator.get(); }
|
|
|
|
|
|
|
|
typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlers;
|
|
|
|
|
|
|
|
void addEventHandler(osgGA::GUIEventHandler* eventHandler);
|
|
|
|
EventHandlers& getEventHandlers() { return _eventHandlers; }
|
|
|
|
const EventHandlers& getEventHandlers() const { return _eventHandlers; }
|
2006-12-20 00:00:51 +08:00
|
|
|
|
|
|
|
/** Convinience method for creating slave Cameras and associated GraphicsWindows across all screens.*/
|
|
|
|
void setUpViewAcrossAllScreens();
|
|
|
|
|
2007-01-02 02:20:10 +08:00
|
|
|
virtual void requestRedraw();
|
|
|
|
virtual void requestContinuousUpdate(bool needed=true);
|
|
|
|
virtual void requestWarpPointer(float x,float y);
|
2006-11-27 22:52:07 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2006-12-20 00:00:51 +08:00
|
|
|
void setUpRenderingSupport();
|
|
|
|
|
|
|
|
void assignSceneDataToCameras();
|
2006-11-27 22:52:07 +08:00
|
|
|
|
2007-01-02 02:20:10 +08:00
|
|
|
|
2006-11-27 22:52:07 +08:00
|
|
|
protected:
|
|
|
|
|
2006-11-29 04:35:31 +08:00
|
|
|
virtual ~View();
|
2006-11-27 22:52:07 +08:00
|
|
|
|
|
|
|
osg::ref_ptr<osgViewer::Scene> _scene;
|
2006-12-21 05:13:29 +08:00
|
|
|
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
|
2006-11-27 22:52:07 +08:00
|
|
|
osg::ref_ptr<osgGA::MatrixManipulator> _cameraManipulator;
|
|
|
|
EventHandlers _eventHandlers;
|
|
|
|
|
2006-12-23 01:46:21 +08:00
|
|
|
typedef std::map<osg::ref_ptr<osg::Camera>, osg::ref_ptr<osgUtil::SceneView> > CameraSceneViewMap;
|
|
|
|
CameraSceneViewMap _cameraSceneViewMap;
|
|
|
|
|
2006-11-27 22:52:07 +08:00
|
|
|
};
|
|
|
|
|
2006-11-29 04:35:31 +08:00
|
|
|
}
|
|
|
|
|
2006-11-27 22:52:07 +08:00
|
|
|
#endif
|