Refactor Viewer/CompositeViewer so the both inherit from the a ViewerBase class

This commit is contained in:
Robert Osfield 2007-09-29 16:46:08 +00:00
parent 4ef1864432
commit f8729af8b2
18 changed files with 885 additions and 739 deletions

View File

@ -25,7 +25,7 @@ namespace osg {
* Note, if no slave cameras are attached to the view then the master camera does both the control and implementation of the rendering of the scene,
* but if slave cameras are present then the master controls the view onto the scene, while the slaves implement the rendering of the scene.
*/
class OSG_EXPORT View : public osg::Object
class OSG_EXPORT View : public virtual osg::Object
{
public :

View File

@ -22,7 +22,7 @@
namespace osgViewer {
/** CompsiteViewer holds a or more views to a one more scenes.*/
class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
class OSGVIEWER_EXPORT CompositeViewer : public ViewerBase, public virtual osg::Object
{
public:
@ -49,35 +49,25 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
/** Get whether at least of one of this viewers windows are realized.*/
bool isRealized() const;
virtual bool isRealized() const;
/** set up windows and associated threads.*/
void realize();
virtual void realize();
void setDone(bool done) { _done = done; }
bool done() const { return _done; }
void setStartTick(osg::Timer_t tick);
osg::Timer_t getStartTick() const { return _startTick; }
virtual void setStartTick(osg::Timer_t tick);
void setReferenceTime(double time=0.0);
osg::FrameStamp* getFrameStamp() { return _frameStamp.get(); }
const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
enum ThreadingModel
{
SingleThreaded,
ThreadPerContext,
ThreadPerCamera
};
/** Set the threading model the rendering traversals will use.*/
void setThreadingModel(ThreadingModel threadingModel);
/** Get the threading model the rendering traversals will use.*/
ThreadingModel getThreadingModel() const { return _threadingModel; }
virtual void setThreadingModel(ThreadingModel threadingModel);
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); }
enum BarrierPosition
{
@ -97,62 +87,6 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
/** Set the EventVisitor. */
void setEventVisitor(osgGA::EventVisitor* eventVisitor) { _eventVisitor = eventVisitor; }
/** Get the EventVisitor. */
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
/** Get the const EventVisitor. */
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); }
/** Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to
* signal end of viewers main loop.
* Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape).
* Setting to 0 switches off the feature.*/
void setKeyEventSetsDone(int key) { _keyEventSetsDone = key; }
/** get the key event that the viewer checks on each frame to see if the viewer's done flag.*/
int getKeyEventSetsDone() const { return _keyEventSetsDone; }
/** if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature */
void setQuitEventSetsDone(bool flag) { _quitEventSetsDone = flag; }
/** @return true if the viewer respond to the QUIT_APPLICATION-event */
bool getQuitEventSetsDone() const { return _quitEventSetsDone; }
/** Set the UpdateVisitor. */
void setUpdateVisitor(osgUtil::UpdateVisitor* updateVisitor) { _updateVisitor = updateVisitor; }
/** Get the UpdateVisitor. */
osgUtil::UpdateVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
/** Get the const UpdateVisitor. */
const osgUtil::UpdateVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
/** Set the Update OperationQueue. */
void setUpdateOperations(osg::OperationQueue* operations) { _updateOperations = operations; }
/** Get the Update OperationQueue. */
osg::OperationQueue* getUpdateOperations() { return _updateOperations.get(); }
/** Get the const Update OperationQueue. */
const osg::OperationQueue* getUpdateOperations() const { return _updateOperations.get(); }
/** Add an update operation.*/
void addUpdateOperation(osg::Operation* operation);
/** Remove an update operation.*/
void removeUpdateOperation(osg::Operation* operation);
/** Execute a main frame loop.
* Equivialant to while (!viewer.done()) viewer.frame();
@ -181,30 +115,30 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
osgViewer::View* getViewWithFocus() { return _viewWithFocus.get(); }
const osgViewer::View* getViewWithFocus() const { return _viewWithFocus.get(); }
typedef std::vector<osg::GraphicsContext*> Contexts;
void getContexts(Contexts& contexts, bool onlyValid=true);
virtual void getCameras(Cameras& cameras, bool onlyActive=true);
typedef std::vector<osgViewer::GraphicsWindow*> Windows;
void getWindows(Windows& windows, bool onlyValid=true);
virtual void getContexts(Contexts& contexts, bool onlyValid=true);
typedef std::vector<osgViewer::Scene*> Scenes;
void getScenes(Scenes& scenes, bool onlyValid=true);
virtual void getWindows(Windows& windows, bool onlyValid=true);
virtual void getAllThreads(Threads& threads, bool onlyActive=true);
virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
virtual void getScenes(Scenes& scenes, bool onlyValid=true);
/** Set the graphics operation to call on realization of the viewers graphics windows.*/
void setRealizeOperation(osg::Operation* op) { _realizeOperation = op; }
/** Get the graphics operation to call on realization of the viewers graphics windows.*/
osg::Operation* getRealizeOperation() { return _realizeOperation.get(); }
/** Return true if viewer threads are running. */
bool areThreadsRunning() const { return _threadsRunning; }
/** Set up the threading and processor affinity as per the viewers threading model.*/
virtual void setUpThreading();
/** Stop any threads begin run by viewer.*/
void stopThreading();
virtual void stopThreading();
/** Start any threads required by the viewer, as per viewers ThreadingModel.*/
void startThreading();
virtual void startThreading();
/** Get the keyboard and mouse usage of this viewer.*/
virtual void getUsage(osg::ApplicationUsage& usage) const;
protected:
@ -219,13 +153,6 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
bool _firstFrame;
bool _done;
int _keyEventSetsDone;
bool _quitEventSetsDone;
ThreadingModel _threadingModel;
bool _threadsRunning;
BarrierPosition _endBarrierPosition;
osg::ref_ptr<osg::BarrierOperation> _startRenderingBarrier;
@ -242,13 +169,6 @@ class OSGVIEWER_EXPORT CompositeViewer : public osg::Object
osg::observer_ptr<osgViewer::View> _viewWithFocus;
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
osg::ref_ptr<osgGA::EventVisitor> _eventVisitor;
osg::ref_ptr<osg::OperationQueue> _updateOperations;
osg::ref_ptr<osgUtil::UpdateVisitor> _updateVisitor;
osg::ref_ptr<osg::Operation> _realizeOperation;
};

View File

@ -15,8 +15,6 @@
#ifndef OSGVIEWER_EXPORT_
#define OSGVIEWER_EXPORT_ 1
#define USE_REFERENCE_TIME DBL_MAX
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
#pragma warning( disable : 4244 )
#pragma warning( disable : 4251 )

View File

@ -18,13 +18,190 @@
#include <osgUtil/PolytopeIntersector>
#include <osgUtil/LineSegmentIntersector>
#include <osgUtil/UpdateVisitor>
#include <osgUtil/SceneView>
#include <osgGA/MatrixManipulator>
#include <osgGA/EventVisitor>
#include <osgGA/EventQueue>
#include <osgViewer/Scene>
#include <osgViewer/GraphicsWindow>
namespace osgViewer {
#define USE_REFERENCE_TIME DBL_MAX
/** ViewerBase is the view base class that is inhertied by both Viewer and CompositeViewer.*/
class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
{
public:
ViewerBase();
ViewerBase(const ViewerBase& vb);
/** read the viewer configuration from a configuration file.*/
virtual bool readConfiguration(const std::string& filename) = 0;
/** Get whether at least of one of this viewers windows are realized.*/
virtual bool isRealized() const = 0;
/** set up windows and associated threads.*/
virtual void realize() = 0;
enum ThreadingModel
{
SingleThreaded,
CullDrawThreadPerContext,
ThreadPerContext = CullDrawThreadPerContext,
DrawThreadPerContext,
CullThreadPerCameraDrawThreadPerContext,
ThreadPerCamera = CullThreadPerCameraDrawThreadPerContext,
AutomaticSelection
};
/** Set the threading model the rendering traversals will use.*/
virtual void setThreadingModel(ThreadingModel threadingModel) = 0;
/** Get the threading model the rendering traversals will use.*/
ThreadingModel getThreadingModel() const { return _threadingModel; }
/** Set the done flag to singnal the viewer's work is done and should exit the frame loop.*/
void setDone(bool done) { _done = done; }
/** Reurn true if viewer's work is done and should exit the frame loop.*/
bool done() const { return _done; }
/** Set the EventVisitor. */
void setEventVisitor(osgGA::EventVisitor* eventVisitor) { _eventVisitor = eventVisitor; }
/** Get the EventVisitor. */
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
/** Get the const EventVisitor. */
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
/** Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to
* signal end of viewers main loop.
* Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape).
* Setting to 0 switches off the feature.*/
void setKeyEventSetsDone(int key) { _keyEventSetsDone = key; }
/** get the key event that the viewer checks on each frame to see if the viewer's done flag.*/
int getKeyEventSetsDone() const { return _keyEventSetsDone; }
/** if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature */
void setQuitEventSetsDone(bool flag) { _quitEventSetsDone = flag; }
/** @return true if the viewer respond to the QUIT_APPLICATION-event */
bool getQuitEventSetsDone() const { return _quitEventSetsDone; }
/** Set the UpdateVisitor. */
void setUpdateVisitor(osgUtil::UpdateVisitor* updateVisitor) { _updateVisitor = updateVisitor; }
/** Get the UpdateVisitor. */
osgUtil::UpdateVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
/** Get the const UpdateVisitor. */
const osgUtil::UpdateVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
/** Set the Update OperationQueue. */
void setUpdateOperations(osg::OperationQueue* operations) { _updateOperations = operations; }
/** Get the Update OperationQueue. */
osg::OperationQueue* getUpdateOperations() { return _updateOperations.get(); }
/** Get the const Update OperationQueue. */
const osg::OperationQueue* getUpdateOperations() const { return _updateOperations.get(); }
/** Add an update operation.*/
void addUpdateOperation(osg::Operation* operation);
/** Remove an update operation.*/
void removeUpdateOperation(osg::Operation* operation);
/** Execute a main frame loop.
* Equivialant to while (!viewer.done()) viewer.frame();
* Also calls realize() if the viewer is not already realized,
* and installs trackball manipulator if one is not already assigned.
*/
virtual int run() = 0;
/** Render a complete new frame.
* Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals(). */
virtual void frame(double simulationTime=USE_REFERENCE_TIME) = 0;
virtual void advance(double simulationTime=USE_REFERENCE_TIME) = 0;
virtual void eventTraversal() = 0;
virtual void updateTraversal() = 0;
virtual void renderingTraversals() = 0;
typedef std::vector<osg::Camera*> Cameras;
virtual void getCameras(Cameras& cameras, bool onlyActive=true) = 0;
typedef std::vector<osg::GraphicsContext*> Contexts;
virtual void getContexts(Contexts& contexts, bool onlyValid=true) = 0;
typedef std::vector<osgViewer::GraphicsWindow*> Windows;
virtual void getWindows(Windows& windows, bool onlyValid=true) = 0;
typedef std::vector<OpenThreads::Thread*> Threads;
virtual void getAllThreads(Threads& threads, bool onlyActive=true) = 0;
typedef std::vector<osg::OperationThread*> OperationThreads;
virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true) = 0;
typedef std::vector<osgViewer::Scene*> Scenes;
virtual void getScenes(Scenes& scenes, bool onlyValid=true) = 0;
/** Set the graphics operation to call on realization of the viewers graphics windows.*/
void setRealizeOperation(osg::Operation* op) { _realizeOperation = op; }
/** Get the graphics operation to call on realization of the viewers graphics windows.*/
osg::Operation* getRealizeOperation() { return _realizeOperation.get(); }
/** Set up the threading and processor affinity as per the viewers threading model.*/
virtual void setUpThreading() = 0;
/** Return true if viewer threads are running. */
bool areThreadsRunning() const { return _threadsRunning; }
/** Stop any threads begin run by viewer.*/
virtual void stopThreading() = 0;
/** Start any threads required by the viewer.*/
virtual void startThreading() = 0;
/** Get the keyboard and mouse usage of this viewer.*/
virtual void getUsage(osg::ApplicationUsage& usage) const = 0;
protected:
bool _done;
int _keyEventSetsDone;
bool _quitEventSetsDone;
ThreadingModel _threadingModel;
bool _threadsRunning;
osg::ref_ptr<osgGA::EventVisitor> _eventVisitor;
osg::ref_ptr<osg::OperationQueue> _updateOperations;
osg::ref_ptr<osgUtil::UpdateVisitor> _updateVisitor;
osg::ref_ptr<osg::Operation> _realizeOperation;
};
/** View holds a single view on a scene, this view may be composed of one or more slave cameras.*/
class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
{
@ -36,6 +213,8 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
META_Object(osgViewer,View);
ViewerBase* getViewerBase() { return _viewerBase.get(); }
/** Take all the settings, Camera and Slaves from the passed in view, leaving it empty. */
virtual void take(osg::View& rhs);
@ -176,12 +355,6 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
virtual void requestContinuousUpdate(bool needed=true);
virtual void requestWarpPointer(float x,float y);
typedef std::vector<osg::Camera*> Cameras;
void getCameras(Cameras& cameras, bool onlyActive=true);
typedef std::vector<osg::GraphicsContext*> Contexts;
void getContexts(Contexts& contexts, bool onlyValid=true);
public:
void assignSceneDataToCameras();
@ -189,10 +362,15 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
protected:
friend class CompositeViewer;
virtual ~View();
virtual osg::GraphicsOperation* createRenderer(osg::Camera* camera);
osg::observer_ptr<ViewerBase> _viewerBase;
osg::Timer_t _startTick;
osg::ref_ptr<osg::FrameStamp> _frameStamp;

View File

@ -24,7 +24,7 @@
namespace osgViewer {
/** Viewer holds a single view on to a single scene.*/
class OSGVIEWER_EXPORT Viewer : public osgViewer::View
class OSGVIEWER_EXPORT Viewer : public ViewerBase, public osgViewer::View
{
public:
@ -42,20 +42,15 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
virtual void take(View& rhs);
/** read the viewer configuration from a configuration file.*/
bool readConfiguration(const std::string& filename);
virtual bool readConfiguration(const std::string& filename);
/** Get whether at least of one of this viewers windows are realized.*/
bool isRealized() const;
virtual bool isRealized() const;
/** set up windows and associated threads.*/
void realize();
virtual void realize();
void setDone(bool done) { _done = done; }
bool done() const { return _done; }
virtual void setStartTick(osg::Timer_t tick);
void setReferenceTime(double time=0.0);
/** Set the sene graph data that viewer with view.*/
@ -66,21 +61,9 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
* Returns the GraphicsWindowEmbedded that can be used by applications to pass in events to the viewer. */
virtual GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height);
enum ThreadingModel
{
SingleThreaded,
CullDrawThreadPerContext,
DrawThreadPerContext,
CullThreadPerCameraDrawThreadPerContext,
AutomaticSelection
};
/** Set the threading model the rendering traversals will use.*/
void setThreadingModel(ThreadingModel threadingModel);
virtual void setThreadingModel(ThreadingModel threadingModel);
/** Get the threading model the rendering traversals will use.*/
ThreadingModel getThreadingModel() const { return _threadingModel; }
/** Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available.*/
ThreadingModel suggestBestThreadingModel();
@ -102,61 +85,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
BarrierPosition getEndBarrierPosition() const { return _endBarrierPosition; }
/** Set the EventVisitor. */
void setEventVisitor(osgGA::EventVisitor* eventVisitor) { _eventVisitor = eventVisitor; }
/** Get the EventVisitor. */
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
/** Get the const EventVisitor. */
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
/** Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to
* signal end of viewers main loop.
* Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape).
* Setting to 0 switches off the feature.*/
void setKeyEventSetsDone(int key) { _keyEventSetsDone = key; }
/** get the key event that the viewer checks on each frame to see if the viewer's done flag.*/
int getKeyEventSetsDone() const { return _keyEventSetsDone; }
/** if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature */
void setQuitEventSetsDone(bool flag) { _quitEventSetsDone = flag; }
/** @return true if the viewer respond to the QUIT_APPLICATION-event */
bool getQuitEventSetsDone() const { return _quitEventSetsDone; }
/** Set the UpdateVisitor. */
void setUpdateVisitor(osgUtil::UpdateVisitor* updateVisitor) { _updateVisitor = updateVisitor; }
/** Get the UpdateVisitor. */
osgUtil::UpdateVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
/** Get the const UpdateVisitor. */
const osgUtil::UpdateVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
/** Set the Update OperationQueue. */
void setUpdateOperations(osg::OperationQueue* operations) { _updateOperations = operations; }
/** Get the Update OperationQueue. */
osg::OperationQueue* getUpdateOperations() { return _updateOperations.get(); }
/** Get the const Update OperationQueue. */
const osg::OperationQueue* getUpdateOperations() const { return _updateOperations.get(); }
/** Add an update operation.*/
void addUpdateOperation(osg::Operation* operation);
/** Remove an update operation.*/
void removeUpdateOperation(osg::Operation* operation);
/** Execute a main frame loop.
* Equivialant to while (!viewer.done()) viewer.frame();
* Also calls realize() if the viewer is not already realized,
@ -180,36 +108,33 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
osg::Camera* getCameraWithFocus() { return _cameraWithFocus.get(); }
const osg::Camera* getCameraWithFocus() const { return _cameraWithFocus.get(); }
typedef std::vector<osgViewer::GraphicsWindow*> Windows;
void getWindows(Windows& windows, bool onlyValid=true);
virtual void getCameras(Cameras& cameras, bool onlyActive=true);
virtual void getContexts(Contexts& contexts, bool onlyValid=true);
typedef std::vector<OpenThreads::Thread*> Threads;
void getAllThreads(Threads& threads, bool onlyActive=true);
virtual void getWindows(Windows& windows, bool onlyValid=true);
typedef std::vector<osg::OperationThread*> OperationThreads;
void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
virtual void getAllThreads(Threads& threads, bool onlyActive=true);
/** Set the graphics operation to call on realization of the viewers graphics windows.*/
void setRealizeOperation(osg::Operation* op) { _realizeOperation = op; }
virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
virtual void getScenes(Scenes& scenes, bool onlyValid=true);
/** Get the graphics operation to call on realization of the viewers graphics windows.*/
osg::Operation* getRealizeOperation() { return _realizeOperation.get(); }
/** Set up the threading and processor affinity as per the viewers threading model.*/
void setUpThreading();
/** Return true if viewer threads are running. */
bool areThreadsRunning() const { return _threadsRunning; }
virtual void setUpThreading();
/** Stop any threads begin run by viewer.*/
void stopThreading();
virtual void stopThreading();
/** Start any threads required by the viewer.*/
void startThreading();
virtual void startThreading();
/** Get the keyboard and mouse usage of this viewer.*/
virtual void getUsage(osg::ApplicationUsage& usage) const;
protected:
void constructorInit();
@ -237,12 +162,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
bool _firstFrame;
bool _done;
int _keyEventSetsDone;
bool _quitEventSetsDone;
ThreadingModel _threadingModel;
bool _threadsRunning;
BarrierPosition _endBarrierPosition;
@ -254,12 +173,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View
osg::observer_ptr<osg::Camera> _cameraWithFocus;
osg::ref_ptr<osgGA::EventVisitor> _eventVisitor;
osg::ref_ptr<osg::OperationQueue> _updateOperations;
osg::ref_ptr<osgUtil::UpdateVisitor> _updateVisitor;
osg::ref_ptr<osg::Operation> _realizeOperation;
osg::observer_ptr<osg::GraphicsContext> _currentContext;
};

View File

@ -125,7 +125,7 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler
osg::ref_ptr<osg::Switch> _switch;
unsigned int _threadingModel;
ViewerBase::ThreadingModel _threadingModel;
osg::ref_ptr<osgText::Text> _threadingModelText;
unsigned int _frameRateChildNum;

View File

@ -22,7 +22,7 @@ osgDB::RegisterDotOsgWrapperProxy CompositeViewer_Proxy
bool CompositeViewer_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgViewer::CompositeViewer& compositeViewer = static_cast<osgViewer::CompositeViewer&>(obj);
osgViewer::CompositeViewer* compositeViewer = dynamic_cast<osgViewer::CompositeViewer*>(&obj);
bool iteratorAdvanced = false;
osg::notify(osg::NOTICE)<<"CompositeViewer_readLocalData"<<std::endl;
@ -32,7 +32,7 @@ bool CompositeViewer_readLocalData(osg::Object &obj, osgDB::Input &fr)
bool CompositeViewer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgViewer::CompositeViewer& compositeViewer = static_cast<const osgViewer::CompositeViewer&>(obj);
const osgViewer::CompositeViewer* compositeViewer = dynamic_cast<const osgViewer::CompositeViewer*>(&obj);
osg::notify(osg::NOTICE)<<"CompositeViewer_writeLocalData"<<std::endl;

View File

@ -96,7 +96,7 @@ osg::Image* readIntensityImage(osgDB::Input& fr, bool& itrAdvanced)
bool View_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgViewer::View& view = static_cast<osgViewer::View&>(obj);
osgViewer::View& view = dynamic_cast<osgViewer::View&>(obj);
bool iteratorAdvanced = false;
bool matchedFirst = false;
@ -209,7 +209,7 @@ bool View_readLocalData(osg::Object &obj, osgDB::Input &fr)
bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgViewer::View& view = static_cast<const osgViewer::View&>(obj);
const osgViewer::View& view = dynamic_cast<const osgViewer::View&>(obj);
osg::notify(osg::NOTICE)<<"View_writeLocalData"<<std::endl;

View File

@ -22,7 +22,7 @@ osgDB::RegisterDotOsgWrapperProxy Viewer_Proxy
bool Viewer_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgViewer::Viewer& viewer = static_cast<osgViewer::Viewer&>(obj);
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&obj);
bool iteratorAdvanced = false;
return iteratorAdvanced;
@ -30,7 +30,6 @@ bool Viewer_readLocalData(osg::Object &obj, osgDB::Input &fr)
bool Viewer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgViewer::Viewer& viewer = static_cast<const osgViewer::Viewer&>(obj);
const osgViewer::Viewer* viewer = dynamic_cast<const osgViewer::Viewer*>(&obj);
return true;
}

View File

@ -28,7 +28,7 @@ CompositeViewer::CompositeViewer()
}
CompositeViewer::CompositeViewer(const CompositeViewer& cv,const osg::CopyOp& copyop):
osg::Object(cv,copyop)
ViewerBase()
{
constructorInit();
}
@ -53,12 +53,6 @@ CompositeViewer::CompositeViewer(osg::ArgumentParser& arguments)
void CompositeViewer::constructorInit()
{
_firstFrame = true;
_done = false;
_keyEventSetsDone = osgGA::GUIEventAdapter::KEY_Escape;
_quitEventSetsDone = true;
_threadingModel = ThreadPerContext;
_threadsRunning = false;
_endBarrierPosition = AfterSwapBuffers;
_numThreadsOnBarrier = 0;
_startTick = 0;
@ -70,15 +64,14 @@ void CompositeViewer::constructorInit()
_frameStamp->setFrameNumber(0);
_frameStamp->setReferenceTime(0);
_frameStamp->setSimulationTime(0);
setEventQueue(new osgGA::EventQueue);
_eventVisitor = new osgGA::EventVisitor;
_eventVisitor->setFrameStamp(_frameStamp.get());
_updateVisitor = new osgUtil::UpdateVisitor;
_updateVisitor->setFrameStamp(_frameStamp.get());
}
CompositeViewer::~CompositeViewer()
@ -130,6 +123,8 @@ void CompositeViewer::addView(osgViewer::View* view)
_views.push_back(view);
view->_viewerBase = this;
view->setFrameStamp(_frameStamp.get());
view->setStats(new osg::Stats("CompositeViewer"));
@ -147,6 +142,8 @@ void CompositeViewer::removeView(osgViewer::View* view)
bool threadsWereRuinning = _threadsRunning;
if (threadsWereRuinning) stopThreading();
view->_viewerBase = 0;
_views.erase(itr);
if (threadsWereRuinning) startThreading();
@ -305,6 +302,21 @@ unsigned int CompositeViewer::computeNumberOfThreadsIncludingMainRequired()
return firstContextAsMainThread ? contexts.size() : contexts.size()+1;
}
void CompositeViewer::setUpThreading()
{
Contexts contexts;
getContexts(contexts);
if (_threadingModel==SingleThreaded)
{
if (_threadsRunning) stopThreading();
}
else
{
if (!_threadsRunning) startThreading();
}
}
void CompositeViewer::startThreading()
{
@ -498,6 +510,29 @@ void CompositeViewer::getContexts(Contexts& contexts, bool onlyValid)
}
}
void CompositeViewer::getCameras(Cameras& cameras, bool onlyActive)
{
cameras.clear();
for(Views::iterator vitr = _views.begin();
vitr != _views.end();
++vitr)
{
View* view = vitr->get();
if (view->getCamera() &&
(!onlyActive || (view->getCamera()->getGraphicsContext() && view->getCamera()->getGraphicsContext()->valid())) ) cameras.push_back(view->getCamera());
for(View::Slaves::iterator itr = view->_slaves.begin();
itr != view->_slaves.end();
++itr)
{
if (itr->_camera.valid() &&
(!onlyActive || (itr->_camera->getGraphicsContext() && itr->_camera->getGraphicsContext()->valid())) ) cameras.push_back(itr->_camera.get());
}
}
}
void CompositeViewer::getWindows(Windows& windows, bool onlyValid)
{
windows.clear();
@ -538,6 +573,69 @@ void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid)
}
}
void CompositeViewer::getAllThreads(Threads& threads, bool onlyActive)
{
OperationThreads operationThreads;
getOperationThreads(operationThreads);
for(OperationThreads::iterator itr = operationThreads.begin();
itr != operationThreads.end();
++itr)
{
threads.push_back(*itr);
}
Scenes scenes;
getScenes(scenes);
for(Scenes::iterator sitr = scenes.begin();
sitr != scenes.end();
++sitr)
{
Scene* scene = *sitr;
if (scene->getDatabasePager() &&
(!onlyActive || scene->getDatabasePager()->isRunning()))
{
threads.push_back(scene->getDatabasePager());
}
}
}
void CompositeViewer::getOperationThreads(OperationThreads& threads, bool onlyActive)
{
threads.clear();
Contexts contexts;
getContexts(contexts);
for(Contexts::iterator gcitr = contexts.begin();
gcitr != contexts.end();
++gcitr)
{
osg::GraphicsContext* gc = *gcitr;
if (gc->getGraphicsThread() &&
(!onlyActive || gc->getGraphicsThread()->isRunning()) )
{
threads.push_back(gc->getGraphicsThread());
}
}
Cameras cameras;
getCameras(cameras);
for(Cameras::iterator citr = cameras.begin();
citr != cameras.end();
++citr)
{
osg::Camera* camera = *citr;
if (camera->getCameraThread() &&
(!onlyActive || camera->getCameraThread()->isRunning()) )
{
threads.push_back(camera->getCameraThread());
}
}
}
void CompositeViewer::realize()
{
//osg::notify(osg::INFO)<<"CompositeViewer::realize()"<<std::endl;
@ -1062,25 +1160,6 @@ void CompositeViewer::eventTraversal()
}
void CompositeViewer::addUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (!_updateOperations) _updateOperations = new osg::OperationQueue;
_updateOperations->add(operation);
}
void CompositeViewer::removeUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (_updateOperations.valid())
{
_updateOperations->remove(operation);
}
}
void CompositeViewer::updateTraversal()
{
if (_done) return;
@ -1240,3 +1319,24 @@ void CompositeViewer::renderingTraversals()
}
}
}
void CompositeViewer::getUsage(osg::ApplicationUsage& usage) const
{
for(Views::const_iterator vitr = _views.begin();
vitr != _views.end();
++vitr)
{
const View* view = vitr->get();
if (view->getCameraManipulator())
{
view->getCameraManipulator()->getUsage(usage);
}
for(View::EventHandlers::const_iterator hitr = view->_eventHandlers.begin();
hitr != view->_eventHandlers.end();
++hitr)
{
(*hitr)->getUsage(usage);
}
}
}

View File

@ -27,7 +27,7 @@ StatsHandler::StatsHandler():
_keyEventPrintsOutStats('S'),
_statsType(NO_STATS),
_initialized(false),
_threadingModel(0xffff),
_threadingModel(ViewerBase::SingleThreaded),
_frameRateChildNum(0),
_viewerChildNum(0),
_sceneChildNum(0),
@ -45,7 +45,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if (!view) return false;
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
osgViewer::ViewerBase* viewer = view->getViewerBase();
if (viewer && _threadingModelText.valid() && viewer->getThreadingModel()!=_threadingModel)
{
_threadingModel = viewer->getThreadingModel();
@ -73,8 +73,8 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
if (_statsType==LAST) _statsType = NO_STATS;
osgViewer::View::Cameras cameras;
view->getCameras(cameras);
osgViewer::ViewerBase::Cameras cameras;
viewer->getCameras(cameras);
switch(_statsType)
{
@ -84,7 +84,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
view->getStats()->collectStats("event",false);
view->getStats()->collectStats("update",false);
for(osgViewer::View::Cameras::iterator itr = cameras.begin();
for(osgViewer::ViewerBase::Cameras::iterator itr = cameras.begin();
itr != cameras.end();
++itr)
{
@ -114,7 +114,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
view->getStats()->collectStats("event",true);
view->getStats()->collectStats("update",true);
for(osgViewer::View::Cameras::iterator itr = cameras.begin();
for(osgViewer::ViewerBase::Cameras::iterator itr = cameras.begin();
itr != cameras.end();
++itr)
{
@ -151,9 +151,9 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
StatsList statsList;
statsList.push_back(view->getStats());
osgViewer::View::Contexts contexts;
view->getContexts(contexts);
for(osgViewer::View::Contexts::iterator gcitr = contexts.begin();
osgViewer::ViewerBase::Contexts contexts;
viewer->getContexts(contexts);
for(osgViewer::ViewerBase::Contexts::iterator gcitr = contexts.begin();
gcitr != contexts.end();
++gcitr)
{
@ -214,11 +214,8 @@ void StatsHandler::reset()
void StatsHandler::setUpHUDCamera(osgViewer::View* view)
{
osgViewer::GraphicsWindow* window = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(view);
osgViewer::ViewerBase* viewer = view->getViewerBase();
osg::GraphicsContext* context;
if (viewer && !window)

View File

@ -123,6 +123,45 @@ protected:
osg::observer_ptr<osgViewer::View> _view;
};
ViewerBase::ViewerBase():
osg::Object(true)
{
_done = false;
_keyEventSetsDone = osgGA::GUIEventAdapter::KEY_Escape;
_quitEventSetsDone = true;
_threadingModel = AutomaticSelection;
_threadsRunning = false;
}
ViewerBase::ViewerBase(const ViewerBase& base):
osg::Object(true)
{
}
void ViewerBase::addUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (!_updateOperations) _updateOperations = new osg::OperationQueue;
_updateOperations->add(operation);
}
void ViewerBase::removeUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (_updateOperations.valid())
{
_updateOperations->remove(operation);
}
}
View::View():
_fusionDistanceMode(osgUtil::SceneView::PROPORTIONAL_TO_SCREEN_DISTANCE),
_fusionDistanceValue(1.0f)
@ -1626,84 +1665,3 @@ bool View::computeIntersections(float x,float y, osg::NodePath& nodePath, osgUti
}
}
void View::getCameras(Cameras& cameras, bool onlyActive)
{
cameras.clear();
if (_camera.valid() &&
(!onlyActive || (_camera->getGraphicsContext() && _camera->getGraphicsContext()->valid())) ) cameras.push_back(_camera.get());
for(Slaves::iterator itr = _slaves.begin();
itr != _slaves.end();
++itr)
{
if (itr->_camera.valid() &&
(!onlyActive || (itr->_camera->getGraphicsContext() && itr->_camera->getGraphicsContext()->valid())) ) cameras.push_back(itr->_camera.get());
}
}
struct LessGraphicsContext
{
bool operator () (const osg::GraphicsContext* lhs, const osg::GraphicsContext* rhs) const
{
int screenLeft = lhs->getTraits()? lhs->getTraits()->screenNum : 0;
int screenRight = rhs->getTraits()? rhs->getTraits()->screenNum : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
screenLeft = lhs->getTraits()? lhs->getTraits()->x : 0;
screenRight = rhs->getTraits()? rhs->getTraits()->x : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
screenLeft = lhs->getTraits()? lhs->getTraits()->y : 0;
screenRight = rhs->getTraits()? rhs->getTraits()->y : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
return lhs < rhs;
}
};
void View::getContexts(Contexts& contexts, bool onlyValid)
{
typedef std::set<osg::GraphicsContext*> ContextSet;
ContextSet contextSet;
if (_camera.valid() &&
_camera->getGraphicsContext() &&
(_camera->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(_camera->getGraphicsContext());
}
for(unsigned int i=0; i<getNumSlaves(); ++i)
{
Slave& slave = getSlave(i);
if (slave._camera.valid() &&
slave._camera->getGraphicsContext() &&
(slave._camera->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(slave._camera->getGraphicsContext());
}
}
contexts.clear();
contexts.reserve(contextSet.size());
for(ContextSet::iterator itr = contextSet.begin();
itr != contextSet.end();
++itr)
{
contexts.push_back(const_cast<osg::GraphicsContext*>(*itr));
}
if (contexts.size()>=2)
{
std::sort(contexts.begin(), contexts.end(), LessGraphicsContext());
}
}

View File

@ -38,11 +38,15 @@ static osg::ApplicationUsageProxy Viewer_e3(osg::ApplicationUsage::ENVIRONMENTAL
Viewer::Viewer()
{
_viewerBase = this;
constructorInit();
}
Viewer::Viewer(osg::ArgumentParser& arguments)
{
_viewerBase = this;
constructorInit();
std::string filename;
@ -119,16 +123,12 @@ Viewer::Viewer(osg::ArgumentParser& arguments)
Viewer::Viewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop):
View(viewer,copyop)
{
_viewerBase = this;
}
void Viewer::constructorInit()
{
_firstFrame = true;
_done = false;
_keyEventSetsDone = osgGA::GUIEventAdapter::KEY_Escape;
_quitEventSetsDone = true;
_threadingModel = AutomaticSelection;
_threadsRunning = false;
_endBarrierPosition = AfterSwapBuffers;
_numWindowsOpenAtLastSetUpThreading = 0;
@ -343,7 +343,6 @@ void Viewer::setStartTick(osg::Timer_t tick)
}
}
void Viewer::setReferenceTime(double time)
{
osg::Timer_t tick = osg::Timer::instance()->tick();
@ -1412,25 +1411,6 @@ void Viewer::eventTraversal()
}
void Viewer::addUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (!_updateOperations) _updateOperations = new osg::OperationQueue;
_updateOperations->add(operation);
}
void Viewer::removeUpdateOperation(osg::Operation* operation)
{
if (!operation) return;
if (_updateOperations.valid())
{
_updateOperations->remove(operation);
}
}
void Viewer::updateTraversal()
{
if (_done) return;
@ -1600,6 +1580,93 @@ void Viewer::renderingTraversals()
}
}
void Viewer::getScenes(Scenes& scenes, bool onlyValid)
{
scenes.push_back(_scene.get());
}
struct LessGraphicsContext
{
bool operator () (const osg::GraphicsContext* lhs, const osg::GraphicsContext* rhs) const
{
int screenLeft = lhs->getTraits()? lhs->getTraits()->screenNum : 0;
int screenRight = rhs->getTraits()? rhs->getTraits()->screenNum : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
screenLeft = lhs->getTraits()? lhs->getTraits()->x : 0;
screenRight = rhs->getTraits()? rhs->getTraits()->x : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
screenLeft = lhs->getTraits()? lhs->getTraits()->y : 0;
screenRight = rhs->getTraits()? rhs->getTraits()->y : 0;
if (screenLeft < screenRight) return true;
if (screenLeft > screenRight) return false;
return lhs < rhs;
}
};
void Viewer::getContexts(Contexts& contexts, bool onlyValid)
{
typedef std::set<osg::GraphicsContext*> ContextSet;
ContextSet contextSet;
if (_camera.valid() &&
_camera->getGraphicsContext() &&
(_camera->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(_camera->getGraphicsContext());
}
for(unsigned int i=0; i<getNumSlaves(); ++i)
{
Slave& slave = getSlave(i);
if (slave._camera.valid() &&
slave._camera->getGraphicsContext() &&
(slave._camera->getGraphicsContext()->valid() || !onlyValid))
{
contextSet.insert(slave._camera->getGraphicsContext());
}
}
contexts.clear();
contexts.reserve(contextSet.size());
for(ContextSet::iterator itr = contextSet.begin();
itr != contextSet.end();
++itr)
{
contexts.push_back(const_cast<osg::GraphicsContext*>(*itr));
}
if (contexts.size()>=2)
{
std::sort(contexts.begin(), contexts.end(), LessGraphicsContext());
}
}
void Viewer::getCameras(Cameras& cameras, bool onlyActive)
{
cameras.clear();
if (_camera.valid() &&
(!onlyActive || (_camera->getGraphicsContext() && _camera->getGraphicsContext()->valid())) ) cameras.push_back(_camera.get());
for(Slaves::iterator itr = _slaves.begin();
itr != _slaves.end();
++itr)
{
if (itr->_camera.valid() &&
(!onlyActive || (itr->_camera->getGraphicsContext() && itr->_camera->getGraphicsContext()->valid())) ) cameras.push_back(itr->_camera.get());
}
}
void Viewer::getUsage(osg::ApplicationUsage& usage) const
{
if (_cameraManipulator.valid())
@ -1613,5 +1680,6 @@ void Viewer::getUsage(osg::ApplicationUsage& usage) const
{
(*hitr)->getUsage(usage);
}
}

View File

@ -36,7 +36,7 @@ END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osg::View)
I_DeclaringFile("osg/View");
I_BaseType(osg::Object);
I_VirtualBaseType(osg::Object);
I_Constructor0(____View,
"",
"");

View File

@ -10,16 +10,14 @@
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/ApplicationUsage>
#include <osg/ArgumentParser>
#include <osg/Camera>
#include <osg/CopyOp>
#include <osg/FrameStamp>
#include <osg/Object>
#include <osg/OperationThread>
#include <osg/Timer>
#include <osgGA/EventQueue>
#include <osgGA/EventVisitor>
#include <osgUtil/UpdateVisitor>
#include <osgViewer/CompositeViewer>
#include <osgViewer/View>
@ -31,19 +29,6 @@
#undef OUT
#endif
TYPE_NAME_ALIAS(std::vector< osg::GraphicsContext * >, osgViewer::CompositeViewer::Contexts)
TYPE_NAME_ALIAS(std::vector< osgViewer::GraphicsWindow * >, osgViewer::CompositeViewer::Windows)
TYPE_NAME_ALIAS(std::vector< osgViewer::Scene * >, osgViewer::CompositeViewer::Scenes)
BEGIN_ENUM_REFLECTOR(osgViewer::CompositeViewer::ThreadingModel)
I_DeclaringFile("osgViewer/CompositeViewer");
I_EnumLabel(osgViewer::CompositeViewer::SingleThreaded);
I_EnumLabel(osgViewer::CompositeViewer::ThreadPerContext);
I_EnumLabel(osgViewer::CompositeViewer::ThreadPerCamera);
END_REFLECTOR
BEGIN_ENUM_REFLECTOR(osgViewer::CompositeViewer::BarrierPosition)
I_DeclaringFile("osgViewer/CompositeViewer");
I_EnumLabel(osgViewer::CompositeViewer::BeforeSwapBuffers);
@ -52,7 +37,8 @@ END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
I_DeclaringFile("osgViewer/CompositeViewer");
I_BaseType(osg::Object);
I_BaseType(osgViewer::ViewerBase);
I_VirtualBaseType(osg::Object);
I_Constructor0(____CompositeViewer,
"",
"");
@ -91,7 +77,7 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method1(bool, readConfiguration, IN, const std::string &, filename,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__bool__readConfiguration__C5_std_string_R1,
"read the viewer configuration from a configuration file. ",
"");
@ -121,35 +107,20 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
"",
"");
I_Method0(bool, isRealized,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__bool__isRealized,
"Get whether at least of one of this viewers windows are realized. ",
"");
I_Method0(void, realize,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__realize,
"set up windows and associated threads. ",
"");
I_Method1(void, setDone, IN, bool, done,
Properties::NON_VIRTUAL,
__void__setDone__bool,
"",
"");
I_Method0(bool, done,
Properties::NON_VIRTUAL,
__bool__done,
"",
"");
I_Method1(void, setStartTick, IN, osg::Timer_t, tick,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__setStartTick__osg_Timer_t,
"",
"");
I_Method0(osg::Timer_t, getStartTick,
Properties::NON_VIRTUAL,
__osg_Timer_t__getStartTick,
"",
"");
I_MethodWithDefaults1(void, setReferenceTime, IN, double, time, 0.0,
Properties::NON_VIRTUAL,
__void__setReferenceTime__double,
@ -165,41 +136,11 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
__C5_osg_FrameStamp_P1__getFrameStamp,
"",
"");
I_Method1(void, setThreadingModel, IN, osgViewer::CompositeViewer::ThreadingModel, threadingModel,
Properties::NON_VIRTUAL,
I_Method1(void, setThreadingModel, IN, osgViewer::ViewerBase::ThreadingModel, threadingModel,
Properties::VIRTUAL,
__void__setThreadingModel__ThreadingModel,
"Set the threading model the rendering traversals will use. ",
"");
I_Method0(osgViewer::CompositeViewer::ThreadingModel, getThreadingModel,
Properties::NON_VIRTUAL,
__ThreadingModel__getThreadingModel,
"Get the threading model the rendering traversals will use. ",
"");
I_Method1(void, setEndBarrierPosition, IN, osgViewer::CompositeViewer::BarrierPosition, bp,
Properties::NON_VIRTUAL,
__void__setEndBarrierPosition__BarrierPosition,
"Set the position of the end barrier. ",
"AfterSwapBuffers will may result is slightly higher framerates, by may lead to inconcistent swapping between different windows. BeforeSwapBuffers may lead to slightly lower framerate, but improve consistency in timing of swap buffers, especially important if you are likely to consistently break frame. ");
I_Method0(osgViewer::CompositeViewer::BarrierPosition, getEndBarrierPosition,
Properties::NON_VIRTUAL,
__BarrierPosition__getEndBarrierPosition,
"Get the end barrier position. ",
"");
I_Method1(void, setEventVisitor, IN, osgGA::EventVisitor *, eventVisitor,
Properties::NON_VIRTUAL,
__void__setEventVisitor__osgGA_EventVisitor_P1,
"Set the EventVisitor. ",
"");
I_Method0(osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__osgGA_EventVisitor_P1__getEventVisitor,
"Get the EventVisitor. ",
"");
I_Method0(const osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__C5_osgGA_EventVisitor_P1__getEventVisitor,
"Get the const EventVisitor. ",
"");
I_Method1(void, setEventQueue, IN, osgGA::EventQueue *, eventQueue,
Properties::NON_VIRTUAL,
__void__setEventQueue__osgGA_EventQueue_P1,
@ -215,65 +156,15 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
__C5_osgGA_EventQueue_P1__getEventQueue,
"",
"");
I_Method1(void, setKeyEventSetsDone, IN, int, key,
I_Method1(void, setEndBarrierPosition, IN, osgViewer::CompositeViewer::BarrierPosition, bp,
Properties::NON_VIRTUAL,
__void__setKeyEventSetsDone__int,
"Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to signal end of viewers main loop. ",
"Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape). Setting to 0 switches off the feature. ");
I_Method0(int, getKeyEventSetsDone,
__void__setEndBarrierPosition__BarrierPosition,
"Set the position of the end barrier. ",
"AfterSwapBuffers will may result is slightly higher framerates, by may lead to inconcistent swapping between different windows. BeforeSwapBuffers may lead to slightly lower framerate, but improve consistency in timing of swap buffers, especially important if you are likely to consistently break frame. ");
I_Method0(osgViewer::CompositeViewer::BarrierPosition, getEndBarrierPosition,
Properties::NON_VIRTUAL,
__int__getKeyEventSetsDone,
"get the key event that the viewer checks on each frame to see if the viewer's done flag. ",
"");
I_Method1(void, setQuitEventSetsDone, IN, bool, flag,
Properties::NON_VIRTUAL,
__void__setQuitEventSetsDone__bool,
"if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature ",
"");
I_Method0(bool, getQuitEventSetsDone,
Properties::NON_VIRTUAL,
__bool__getQuitEventSetsDone,
"",
"true if the viewer respond to the QUIT_APPLICATION-event ");
I_Method1(void, setUpdateVisitor, IN, osgUtil::UpdateVisitor *, updateVisitor,
Properties::NON_VIRTUAL,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1,
"Set the UpdateVisitor. ",
"");
I_Method0(osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the UpdateVisitor. ",
"");
I_Method0(const osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__C5_osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the const UpdateVisitor. ",
"");
I_Method1(void, setUpdateOperations, IN, osg::OperationQueue *, operations,
Properties::NON_VIRTUAL,
__void__setUpdateOperations__osg_OperationQueue_P1,
"Set the Update OperationQueue. ",
"");
I_Method0(osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__osg_OperationQueue_P1__getUpdateOperations,
"Get the Update OperationQueue. ",
"");
I_Method0(const osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__C5_osg_OperationQueue_P1__getUpdateOperations,
"Get the const Update OperationQueue. ",
"");
I_Method1(void, addUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__addUpdateOperation__osg_Operation_P1,
"Add an update operation. ",
"");
I_Method1(void, removeUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__removeUpdateOperation__osg_Operation_P1,
"Remove an update operation. ",
__BarrierPosition__getEndBarrierPosition,
"Get the end barrier position. ",
"");
I_Method0(int, run,
Properties::VIRTUAL,
@ -330,46 +221,56 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
__C5_osgViewer_View_P1__getViewWithFocus,
"",
"");
I_MethodWithDefaults2(void, getContexts, IN, osgViewer::CompositeViewer::Contexts &, contexts, , IN, bool, onlyValid, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getCameras, IN, osgViewer::ViewerBase::Cameras &, cameras, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getCameras__Cameras_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getContexts, IN, osgViewer::ViewerBase::Contexts &, contexts, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getContexts__Contexts_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getWindows, IN, osgViewer::CompositeViewer::Windows &, windows, , IN, bool, onlyValid, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getWindows, IN, osgViewer::ViewerBase::Windows &, windows, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getWindows__Windows_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getScenes, IN, osgViewer::CompositeViewer::Scenes &, scenes, , IN, bool, onlyValid, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getAllThreads, IN, osgViewer::ViewerBase::Threads &, threads, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getAllThreads__Threads_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getOperationThreads, IN, osgViewer::ViewerBase::OperationThreads &, threads, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getOperationThreads__OperationThreads_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getScenes, IN, osgViewer::ViewerBase::Scenes &, scenes, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getScenes__Scenes_R1__bool,
"",
"");
I_Method1(void, setRealizeOperation, IN, osg::Operation *, op,
Properties::NON_VIRTUAL,
__void__setRealizeOperation__osg_Operation_P1,
"Set the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_Method0(osg::Operation *, getRealizeOperation,
Properties::NON_VIRTUAL,
__osg_Operation_P1__getRealizeOperation,
"Get the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_Method0(bool, areThreadsRunning,
Properties::NON_VIRTUAL,
__bool__areThreadsRunning,
"Return true if viewer threads are running. ",
I_Method0(void, setUpThreading,
Properties::VIRTUAL,
__void__setUpThreading,
"Set up the threading and processor affinity as per the viewers threading model. ",
"");
I_Method0(void, stopThreading,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__stopThreading,
"Stop any threads begin run by viewer. ",
"");
I_Method0(void, startThreading,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__startThreading,
"Start any threads required by the viewer, as per viewers ThreadingModel. ",
"");
I_Method1(void, getUsage, IN, osg::ApplicationUsage &, usage,
Properties::VIRTUAL,
__void__getUsage__osg_ApplicationUsage_R1,
"Get the keyboard and mouse usage of this viewer. ",
"");
I_ProtectedMethod0(void, constructorInit,
Properties::NON_VIRTUAL,
Properties::NON_CONST,
@ -397,45 +298,24 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
I_SimpleProperty(osg::Camera *, CameraWithFocus,
__osg_Camera_P1__getCameraWithFocus,
__void__setCameraWithFocus__osg_Camera_P1);
I_SimpleProperty(bool, Done,
0,
__void__setDone__bool);
I_SimpleProperty(osgViewer::CompositeViewer::BarrierPosition, EndBarrierPosition,
__BarrierPosition__getEndBarrierPosition,
__void__setEndBarrierPosition__BarrierPosition);
I_SimpleProperty(osgGA::EventQueue *, EventQueue,
__osgGA_EventQueue_P1__getEventQueue,
__void__setEventQueue__osgGA_EventQueue_P1);
I_SimpleProperty(osgGA::EventVisitor *, EventVisitor,
__osgGA_EventVisitor_P1__getEventVisitor,
__void__setEventVisitor__osgGA_EventVisitor_P1);
I_SimpleProperty(osg::FrameStamp *, FrameStamp,
__osg_FrameStamp_P1__getFrameStamp,
0);
I_SimpleProperty(int, KeyEventSetsDone,
__int__getKeyEventSetsDone,
__void__setKeyEventSetsDone__int);
I_SimpleProperty(bool, QuitEventSetsDone,
__bool__getQuitEventSetsDone,
__void__setQuitEventSetsDone__bool);
I_SimpleProperty(osg::Operation *, RealizeOperation,
__osg_Operation_P1__getRealizeOperation,
__void__setRealizeOperation__osg_Operation_P1);
I_SimpleProperty(double, ReferenceTime,
0,
__void__setReferenceTime__double);
I_SimpleProperty(osg::Timer_t, StartTick,
__osg_Timer_t__getStartTick,
0,
__void__setStartTick__osg_Timer_t);
I_SimpleProperty(osgViewer::CompositeViewer::ThreadingModel, ThreadingModel,
__ThreadingModel__getThreadingModel,
I_SimpleProperty(osgViewer::ViewerBase::ThreadingModel, ThreadingModel,
0,
__void__setThreadingModel__ThreadingModel);
I_SimpleProperty(osg::OperationQueue *, UpdateOperations,
__osg_OperationQueue_P1__getUpdateOperations,
__void__setUpdateOperations__osg_OperationQueue_P1);
I_SimpleProperty(osgUtil::UpdateVisitor *, UpdateVisitor,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1);
I_ArrayProperty(osgViewer::View *, View,
__osgViewer_View_P1__getView__unsigned,
0,
@ -448,7 +328,3 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer)
0);
END_REFLECTOR
STD_VECTOR_REFLECTOR(std::vector< osgViewer::GraphicsWindow * >)
STD_VECTOR_REFLECTOR(std::vector< osgViewer::Scene * >)

View File

@ -10,6 +10,7 @@
#include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/ApplicationUsage>
#include <osg/Camera>
#include <osg/CopyOp>
#include <osg/DisplaySettings>
@ -17,14 +18,17 @@
#include <osg/Image>
#include <osg/Node>
#include <osg/Object>
#include <osg/OperationThread>
#include <osg/Timer>
#include <osg/View>
#include <osgDB/DatabasePager>
#include <osgGA/EventQueue>
#include <osgGA/EventVisitor>
#include <osgGA/GUIEventHandler>
#include <osgGA/MatrixManipulator>
#include <osgUtil/LineSegmentIntersector>
#include <osgUtil/SceneView>
#include <osgUtil/UpdateVisitor>
#include <osgViewer/Scene>
#include <osgViewer/View>
@ -74,6 +78,11 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::View)
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method0(osgViewer::ViewerBase *, getViewerBase,
Properties::NON_VIRTUAL,
__ViewerBase_P1__getViewerBase,
"",
"");
I_Method1(void, take, IN, osg::View &, rhs,
Properties::VIRTUAL,
__void__take__osg_View_R1,
@ -354,6 +363,274 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::View)
I_SimpleProperty(unsigned int, UpViewOnSingleScreen,
0,
__void__setUpViewOnSingleScreen__unsigned_int);
I_SimpleProperty(osgViewer::ViewerBase *, ViewerBase,
__ViewerBase_P1__getViewerBase,
0);
END_REFLECTOR
TYPE_NAME_ALIAS(std::vector< osg::Camera * >, osgViewer::ViewerBase::Cameras)
TYPE_NAME_ALIAS(std::vector< osg::GraphicsContext * >, osgViewer::ViewerBase::Contexts)
TYPE_NAME_ALIAS(std::vector< osgViewer::GraphicsWindow * >, osgViewer::ViewerBase::Windows)
TYPE_NAME_ALIAS(std::vector< OpenThreads::Thread * >, osgViewer::ViewerBase::Threads)
TYPE_NAME_ALIAS(std::vector< osg::OperationThread * >, osgViewer::ViewerBase::OperationThreads)
TYPE_NAME_ALIAS(std::vector< osgViewer::Scene * >, osgViewer::ViewerBase::Scenes)
BEGIN_ENUM_REFLECTOR(osgViewer::ViewerBase::ThreadingModel)
I_DeclaringFile("osgViewer/View");
I_EnumLabel(osgViewer::ViewerBase::SingleThreaded);
I_EnumLabel(osgViewer::ViewerBase::CullDrawThreadPerContext);
I_EnumLabel(osgViewer::ViewerBase::ThreadPerContext);
I_EnumLabel(osgViewer::ViewerBase::DrawThreadPerContext);
I_EnumLabel(osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext);
I_EnumLabel(osgViewer::ViewerBase::ThreadPerCamera);
I_EnumLabel(osgViewer::ViewerBase::AutomaticSelection);
END_REFLECTOR
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase)
I_DeclaringFile("osgViewer/View");
I_VirtualBaseType(osg::Object);
I_Constructor0(____ViewerBase,
"",
"");
I_Constructor1(IN, const osgViewer::ViewerBase &, vb,
Properties::NON_EXPLICIT,
____ViewerBase__C5_ViewerBase_R1,
"",
"");
I_Method1(bool, readConfiguration, IN, const std::string &, filename,
Properties::PURE_VIRTUAL,
__bool__readConfiguration__C5_std_string_R1,
"read the viewer configuration from a configuration file. ",
"");
I_Method0(bool, isRealized,
Properties::PURE_VIRTUAL,
__bool__isRealized,
"Get whether at least of one of this viewers windows are realized. ",
"");
I_Method0(void, realize,
Properties::PURE_VIRTUAL,
__void__realize,
"set up windows and associated threads. ",
"");
I_Method1(void, setThreadingModel, IN, osgViewer::ViewerBase::ThreadingModel, threadingModel,
Properties::PURE_VIRTUAL,
__void__setThreadingModel__ThreadingModel,
"Set the threading model the rendering traversals will use. ",
"");
I_Method0(osgViewer::ViewerBase::ThreadingModel, getThreadingModel,
Properties::NON_VIRTUAL,
__ThreadingModel__getThreadingModel,
"Get the threading model the rendering traversals will use. ",
"");
I_Method1(void, setDone, IN, bool, done,
Properties::NON_VIRTUAL,
__void__setDone__bool,
"Set the done flag to singnal the viewer's work is done and should exit the frame loop. ",
"");
I_Method0(bool, done,
Properties::NON_VIRTUAL,
__bool__done,
"Reurn true if viewer's work is done and should exit the frame loop. ",
"");
I_Method1(void, setEventVisitor, IN, osgGA::EventVisitor *, eventVisitor,
Properties::NON_VIRTUAL,
__void__setEventVisitor__osgGA_EventVisitor_P1,
"Set the EventVisitor. ",
"");
I_Method0(osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__osgGA_EventVisitor_P1__getEventVisitor,
"Get the EventVisitor. ",
"");
I_Method0(const osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__C5_osgGA_EventVisitor_P1__getEventVisitor,
"Get the const EventVisitor. ",
"");
I_Method1(void, setKeyEventSetsDone, IN, int, key,
Properties::NON_VIRTUAL,
__void__setKeyEventSetsDone__int,
"Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to signal end of viewers main loop. ",
"Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape). Setting to 0 switches off the feature. ");
I_Method0(int, getKeyEventSetsDone,
Properties::NON_VIRTUAL,
__int__getKeyEventSetsDone,
"get the key event that the viewer checks on each frame to see if the viewer's done flag. ",
"");
I_Method1(void, setQuitEventSetsDone, IN, bool, flag,
Properties::NON_VIRTUAL,
__void__setQuitEventSetsDone__bool,
"if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature ",
"");
I_Method0(bool, getQuitEventSetsDone,
Properties::NON_VIRTUAL,
__bool__getQuitEventSetsDone,
"",
"true if the viewer respond to the QUIT_APPLICATION-event ");
I_Method1(void, setUpdateVisitor, IN, osgUtil::UpdateVisitor *, updateVisitor,
Properties::NON_VIRTUAL,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1,
"Set the UpdateVisitor. ",
"");
I_Method0(osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the UpdateVisitor. ",
"");
I_Method0(const osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__C5_osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the const UpdateVisitor. ",
"");
I_Method1(void, setUpdateOperations, IN, osg::OperationQueue *, operations,
Properties::NON_VIRTUAL,
__void__setUpdateOperations__osg_OperationQueue_P1,
"Set the Update OperationQueue. ",
"");
I_Method0(osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__osg_OperationQueue_P1__getUpdateOperations,
"Get the Update OperationQueue. ",
"");
I_Method0(const osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__C5_osg_OperationQueue_P1__getUpdateOperations,
"Get the const Update OperationQueue. ",
"");
I_Method1(void, addUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__addUpdateOperation__osg_Operation_P1,
"Add an update operation. ",
"");
I_Method1(void, removeUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__removeUpdateOperation__osg_Operation_P1,
"Remove an update operation. ",
"");
I_Method0(int, run,
Properties::PURE_VIRTUAL,
__int__run,
"Execute a main frame loop. ",
"Equivialant to while (!viewer.done()) viewer.frame(); Also calls realize() if the viewer is not already realized, and installs trackball manipulator if one is not already assigned. ");
I_MethodWithDefaults1(void, frame, IN, double, simulationTime, USE_REFERENCE_TIME,
Properties::PURE_VIRTUAL,
__void__frame__double,
"Render a complete new frame. ",
"Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals(). ");
I_MethodWithDefaults1(void, advance, IN, double, simulationTime, USE_REFERENCE_TIME,
Properties::PURE_VIRTUAL,
__void__advance__double,
"",
"");
I_Method0(void, eventTraversal,
Properties::PURE_VIRTUAL,
__void__eventTraversal,
"",
"");
I_Method0(void, updateTraversal,
Properties::PURE_VIRTUAL,
__void__updateTraversal,
"",
"");
I_Method0(void, renderingTraversals,
Properties::PURE_VIRTUAL,
__void__renderingTraversals,
"",
"");
I_MethodWithDefaults2(void, getCameras, IN, osgViewer::ViewerBase::Cameras &, cameras, , IN, bool, onlyActive, true,
Properties::PURE_VIRTUAL,
__void__getCameras__Cameras_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getContexts, IN, osgViewer::ViewerBase::Contexts &, contexts, , IN, bool, onlyValid, true,
Properties::PURE_VIRTUAL,
__void__getContexts__Contexts_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getWindows, IN, osgViewer::ViewerBase::Windows &, windows, , IN, bool, onlyValid, true,
Properties::PURE_VIRTUAL,
__void__getWindows__Windows_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getAllThreads, IN, osgViewer::ViewerBase::Threads &, threads, , IN, bool, onlyActive, true,
Properties::PURE_VIRTUAL,
__void__getAllThreads__Threads_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getOperationThreads, IN, osgViewer::ViewerBase::OperationThreads &, threads, , IN, bool, onlyActive, true,
Properties::PURE_VIRTUAL,
__void__getOperationThreads__OperationThreads_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getScenes, IN, osgViewer::ViewerBase::Scenes &, scenes, , IN, bool, onlyValid, true,
Properties::PURE_VIRTUAL,
__void__getScenes__Scenes_R1__bool,
"",
"");
I_Method1(void, setRealizeOperation, IN, osg::Operation *, op,
Properties::NON_VIRTUAL,
__void__setRealizeOperation__osg_Operation_P1,
"Set the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_Method0(osg::Operation *, getRealizeOperation,
Properties::NON_VIRTUAL,
__osg_Operation_P1__getRealizeOperation,
"Get the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_Method0(void, setUpThreading,
Properties::PURE_VIRTUAL,
__void__setUpThreading,
"Set up the threading and processor affinity as per the viewers threading model. ",
"");
I_Method0(bool, areThreadsRunning,
Properties::NON_VIRTUAL,
__bool__areThreadsRunning,
"Return true if viewer threads are running. ",
"");
I_Method0(void, stopThreading,
Properties::PURE_VIRTUAL,
__void__stopThreading,
"Stop any threads begin run by viewer. ",
"");
I_Method0(void, startThreading,
Properties::PURE_VIRTUAL,
__void__startThreading,
"Start any threads required by the viewer. ",
"");
I_Method1(void, getUsage, IN, osg::ApplicationUsage &, usage,
Properties::PURE_VIRTUAL,
__void__getUsage__osg_ApplicationUsage_R1,
"Get the keyboard and mouse usage of this viewer. ",
"");
I_SimpleProperty(bool, Done,
0,
__void__setDone__bool);
I_SimpleProperty(osgGA::EventVisitor *, EventVisitor,
__osgGA_EventVisitor_P1__getEventVisitor,
__void__setEventVisitor__osgGA_EventVisitor_P1);
I_SimpleProperty(int, KeyEventSetsDone,
__int__getKeyEventSetsDone,
__void__setKeyEventSetsDone__int);
I_SimpleProperty(bool, QuitEventSetsDone,
__bool__getQuitEventSetsDone,
__void__setQuitEventSetsDone__bool);
I_SimpleProperty(osg::Operation *, RealizeOperation,
__osg_Operation_P1__getRealizeOperation,
__void__setRealizeOperation__osg_Operation_P1);
I_SimpleProperty(osgViewer::ViewerBase::ThreadingModel, ThreadingModel,
__ThreadingModel__getThreadingModel,
__void__setThreadingModel__ThreadingModel);
I_SimpleProperty(osg::OperationQueue *, UpdateOperations,
__osg_OperationQueue_P1__getUpdateOperations,
__void__setUpdateOperations__osg_OperationQueue_P1);
I_SimpleProperty(osgUtil::UpdateVisitor *, UpdateVisitor,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgGA::GUIEventHandler >)
@ -398,3 +675,13 @@ END_REFLECTOR
STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osgGA::GUIEventHandler > >)
STD_VECTOR_REFLECTOR(std::vector< OpenThreads::Thread * >)
STD_VECTOR_REFLECTOR(std::vector< osg::Camera * >)
STD_VECTOR_REFLECTOR(std::vector< osg::OperationThread * >)
STD_VECTOR_REFLECTOR(std::vector< osgViewer::GraphicsWindow * >)
STD_VECTOR_REFLECTOR(std::vector< osgViewer::Scene * >)

View File

@ -16,10 +16,7 @@
#include <osg/CopyOp>
#include <osg/Node>
#include <osg/Object>
#include <osg/OperationThread>
#include <osg/Timer>
#include <osgGA/EventVisitor>
#include <osgUtil/UpdateVisitor>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/View>
#include <osgViewer/Viewer>
@ -32,25 +29,6 @@
#undef OUT
#endif
TYPE_NAME_ALIAS(std::vector< osg::GraphicsContext * >, osgViewer::Viewer::Contexts)
TYPE_NAME_ALIAS(std::vector< osgViewer::GraphicsWindow * >, osgViewer::Viewer::Windows)
TYPE_NAME_ALIAS(std::vector< osg::Camera * >, osgViewer::Viewer::Cameras)
TYPE_NAME_ALIAS(std::vector< OpenThreads::Thread * >, osgViewer::Viewer::Threads)
TYPE_NAME_ALIAS(std::vector< osg::OperationThread * >, osgViewer::Viewer::OperationThreads)
BEGIN_ENUM_REFLECTOR(osgViewer::Viewer::ThreadingModel)
I_DeclaringFile("osgViewer/Viewer");
I_EnumLabel(osgViewer::Viewer::SingleThreaded);
I_EnumLabel(osgViewer::Viewer::CullDrawThreadPerContext);
I_EnumLabel(osgViewer::Viewer::DrawThreadPerContext);
I_EnumLabel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
I_EnumLabel(osgViewer::Viewer::AutomaticSelection);
END_REFLECTOR
BEGIN_ENUM_REFLECTOR(osgViewer::Viewer::BarrierPosition)
I_DeclaringFile("osgViewer/Viewer");
I_EnumLabel(osgViewer::Viewer::BeforeSwapBuffers);
@ -59,6 +37,7 @@ END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
I_DeclaringFile("osgViewer/Viewer");
I_BaseType(osgViewer::ViewerBase);
I_BaseType(osgViewer::View);
I_Constructor0(____Viewer,
"",
@ -103,30 +82,20 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
"Take all the settings, Camera and Slaves from the passed in view(er), leaving it empty. ",
"");
I_Method1(bool, readConfiguration, IN, const std::string &, filename,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__bool__readConfiguration__C5_std_string_R1,
"read the viewer configuration from a configuration file. ",
"");
I_Method0(bool, isRealized,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__bool__isRealized,
"Get whether at least of one of this viewers windows are realized. ",
"");
I_Method0(void, realize,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__realize,
"set up windows and associated threads. ",
"");
I_Method1(void, setDone, IN, bool, done,
Properties::NON_VIRTUAL,
__void__setDone__bool,
"",
"");
I_Method0(bool, done,
Properties::NON_VIRTUAL,
__bool__done,
"",
"");
I_Method1(void, setStartTick, IN, osg::Timer_t, tick,
Properties::VIRTUAL,
__void__setStartTick__osg_Timer_t,
@ -147,17 +116,12 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
__GraphicsWindowEmbedded_P1__setUpViewerAsEmbeddedInWindow__int__int__int__int,
"Convenience method for setting up the viewer so it can be used embedded in an external managed window. ",
"Returns the GraphicsWindowEmbedded that can be used by applications to pass in events to the viewer. ");
I_Method1(void, setThreadingModel, IN, osgViewer::Viewer::ThreadingModel, threadingModel,
Properties::NON_VIRTUAL,
I_Method1(void, setThreadingModel, IN, osgViewer::ViewerBase::ThreadingModel, threadingModel,
Properties::VIRTUAL,
__void__setThreadingModel__ThreadingModel,
"Set the threading model the rendering traversals will use. ",
"");
I_Method0(osgViewer::Viewer::ThreadingModel, getThreadingModel,
Properties::NON_VIRTUAL,
__ThreadingModel__getThreadingModel,
"Get the threading model the rendering traversals will use. ",
"");
I_Method0(osgViewer::Viewer::ThreadingModel, suggestBestThreadingModel,
I_Method0(osgViewer::ViewerBase::ThreadingModel, suggestBestThreadingModel,
Properties::NON_VIRTUAL,
__ThreadingModel__suggestBestThreadingModel,
"Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available. ",
@ -172,81 +136,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
__BarrierPosition__getEndBarrierPosition,
"Get the end barrier position. ",
"");
I_Method1(void, setEventVisitor, IN, osgGA::EventVisitor *, eventVisitor,
Properties::NON_VIRTUAL,
__void__setEventVisitor__osgGA_EventVisitor_P1,
"Set the EventVisitor. ",
"");
I_Method0(osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__osgGA_EventVisitor_P1__getEventVisitor,
"Get the EventVisitor. ",
"");
I_Method0(const osgGA::EventVisitor *, getEventVisitor,
Properties::NON_VIRTUAL,
__C5_osgGA_EventVisitor_P1__getEventVisitor,
"Get the const EventVisitor. ",
"");
I_Method1(void, setKeyEventSetsDone, IN, int, key,
Properties::NON_VIRTUAL,
__void__setKeyEventSetsDone__int,
"Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to signal end of viewers main loop. ",
"Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape). Setting to 0 switches off the feature. ");
I_Method0(int, getKeyEventSetsDone,
Properties::NON_VIRTUAL,
__int__getKeyEventSetsDone,
"get the key event that the viewer checks on each frame to see if the viewer's done flag. ",
"");
I_Method1(void, setQuitEventSetsDone, IN, bool, flag,
Properties::NON_VIRTUAL,
__void__setQuitEventSetsDone__bool,
"if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature ",
"");
I_Method0(bool, getQuitEventSetsDone,
Properties::NON_VIRTUAL,
__bool__getQuitEventSetsDone,
"",
"true if the viewer respond to the QUIT_APPLICATION-event ");
I_Method1(void, setUpdateVisitor, IN, osgUtil::UpdateVisitor *, updateVisitor,
Properties::NON_VIRTUAL,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1,
"Set the UpdateVisitor. ",
"");
I_Method0(osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the UpdateVisitor. ",
"");
I_Method0(const osgUtil::UpdateVisitor *, getUpdateVisitor,
Properties::NON_VIRTUAL,
__C5_osgUtil_UpdateVisitor_P1__getUpdateVisitor,
"Get the const UpdateVisitor. ",
"");
I_Method1(void, setUpdateOperations, IN, osg::OperationQueue *, operations,
Properties::NON_VIRTUAL,
__void__setUpdateOperations__osg_OperationQueue_P1,
"Set the Update OperationQueue. ",
"");
I_Method0(osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__osg_OperationQueue_P1__getUpdateOperations,
"Get the Update OperationQueue. ",
"");
I_Method0(const osg::OperationQueue *, getUpdateOperations,
Properties::NON_VIRTUAL,
__C5_osg_OperationQueue_P1__getUpdateOperations,
"Get the const Update OperationQueue. ",
"");
I_Method1(void, addUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__addUpdateOperation__osg_Operation_P1,
"Add an update operation. ",
"");
I_Method1(void, removeUpdateOperation, IN, osg::Operation *, operation,
Properties::NON_VIRTUAL,
__void__removeUpdateOperation__osg_Operation_P1,
"Remove an update operation. ",
"");
I_Method0(int, run,
Properties::VIRTUAL,
__int__run,
@ -292,58 +181,48 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
__C5_osg_Camera_P1__getCameraWithFocus,
"",
"");
I_MethodWithDefaults2(void, getContexts, IN, osgViewer::Viewer::Contexts &, contexts, , IN, bool, onlyValid, true,
Properties::NON_VIRTUAL,
__void__getContexts__Contexts_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getWindows, IN, osgViewer::Viewer::Windows &, windows, , IN, bool, onlyValid, true,
Properties::NON_VIRTUAL,
__void__getWindows__Windows_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getCameras, IN, osgViewer::Viewer::Cameras &, cameras, , IN, bool, onlyActive, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getCameras, IN, osgViewer::ViewerBase::Cameras &, cameras, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getCameras__Cameras_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getAllThreads, IN, osgViewer::Viewer::Threads &, threads, , IN, bool, onlyActive, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getContexts, IN, osgViewer::ViewerBase::Contexts &, contexts, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getContexts__Contexts_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getWindows, IN, osgViewer::ViewerBase::Windows &, windows, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getWindows__Windows_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getAllThreads, IN, osgViewer::ViewerBase::Threads &, threads, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getAllThreads__Threads_R1__bool,
"",
"");
I_MethodWithDefaults2(void, getOperationThreads, IN, osgViewer::Viewer::OperationThreads &, threads, , IN, bool, onlyActive, true,
Properties::NON_VIRTUAL,
I_MethodWithDefaults2(void, getOperationThreads, IN, osgViewer::ViewerBase::OperationThreads &, threads, , IN, bool, onlyActive, true,
Properties::VIRTUAL,
__void__getOperationThreads__OperationThreads_R1__bool,
"",
"");
I_Method1(void, setRealizeOperation, IN, osg::Operation *, op,
Properties::NON_VIRTUAL,
__void__setRealizeOperation__osg_Operation_P1,
"Set the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_Method0(osg::Operation *, getRealizeOperation,
Properties::NON_VIRTUAL,
__osg_Operation_P1__getRealizeOperation,
"Get the graphics operation to call on realization of the viewers graphics windows. ",
"");
I_MethodWithDefaults2(void, getScenes, IN, osgViewer::ViewerBase::Scenes &, scenes, , IN, bool, onlyValid, true,
Properties::VIRTUAL,
__void__getScenes__Scenes_R1__bool,
"",
"");
I_Method0(void, setUpThreading,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__setUpThreading,
"Set up the threading and processor affinity as per the viewers threading model. ",
"");
I_Method0(bool, areThreadsRunning,
Properties::NON_VIRTUAL,
__bool__areThreadsRunning,
"Return true if viewer threads are running. ",
"");
I_Method0(void, stopThreading,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__stopThreading,
"Stop any threads begin run by viewer. ",
"");
I_Method0(void, startThreading,
Properties::NON_VIRTUAL,
Properties::VIRTUAL,
__void__startThreading,
"Start any threads required by the viewer. ",
"");
@ -379,24 +258,9 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
I_SimpleProperty(osg::Camera *, CameraWithFocus,
__osg_Camera_P1__getCameraWithFocus,
__void__setCameraWithFocus__osg_Camera_P1);
I_SimpleProperty(bool, Done,
0,
__void__setDone__bool);
I_SimpleProperty(osgViewer::Viewer::BarrierPosition, EndBarrierPosition,
__BarrierPosition__getEndBarrierPosition,
__void__setEndBarrierPosition__BarrierPosition);
I_SimpleProperty(osgGA::EventVisitor *, EventVisitor,
__osgGA_EventVisitor_P1__getEventVisitor,
__void__setEventVisitor__osgGA_EventVisitor_P1);
I_SimpleProperty(int, KeyEventSetsDone,
__int__getKeyEventSetsDone,
__void__setKeyEventSetsDone__int);
I_SimpleProperty(bool, QuitEventSetsDone,
__bool__getQuitEventSetsDone,
__void__setQuitEventSetsDone__bool);
I_SimpleProperty(osg::Operation *, RealizeOperation,
__osg_Operation_P1__getRealizeOperation,
__void__setRealizeOperation__osg_Operation_P1);
I_SimpleProperty(double, ReferenceTime,
0,
__void__setReferenceTime__double);
@ -406,20 +270,8 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer)
I_SimpleProperty(osg::Timer_t, StartTick,
0,
__void__setStartTick__osg_Timer_t);
I_SimpleProperty(osgViewer::Viewer::ThreadingModel, ThreadingModel,
__ThreadingModel__getThreadingModel,
I_SimpleProperty(osgViewer::ViewerBase::ThreadingModel, ThreadingModel,
0,
__void__setThreadingModel__ThreadingModel);
I_SimpleProperty(osg::OperationQueue *, UpdateOperations,
__osg_OperationQueue_P1__getUpdateOperations,
__void__setUpdateOperations__osg_OperationQueue_P1);
I_SimpleProperty(osgUtil::UpdateVisitor *, UpdateVisitor,
__osgUtil_UpdateVisitor_P1__getUpdateVisitor,
__void__setUpdateVisitor__osgUtil_UpdateVisitor_P1);
END_REFLECTOR
STD_VECTOR_REFLECTOR(std::vector< OpenThreads::Thread * >)
STD_VECTOR_REFLECTOR(std::vector< osg::Camera * >)
STD_VECTOR_REFLECTOR(std::vector< osg::OperationThread * >)

View File

@ -215,10 +215,10 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::StatsHandler)
__void__getUsage__osg_ApplicationUsage_R1,
"Get the keyboard and mouse usage of this manipulator. ",
"");
I_ProtectedMethod1(void, setUpHUDCamera, IN, osgViewer::Viewer *, viewer,
I_ProtectedMethod1(void, setUpHUDCamera, IN, osgViewer::View *, view,
Properties::NON_VIRTUAL,
Properties::NON_CONST,
__void__setUpHUDCamera__osgViewer_Viewer_P1,
__void__setUpHUDCamera__osgViewer_View_P1,
"",
"");
I_ProtectedMethod4(osg::Geometry *, createGeometry, IN, const osg::Vec3 &, pos, IN, float, height, IN, const osg::Vec4 &, colour, IN, unsigned int, numBlocks,
@ -245,10 +245,10 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::StatsHandler)
__osg_Node_P1__createCameraStats__C5_std_string_R1__osg_Vec3_R1__float__bool__float__osg_Stats_P1__osg_Camera_P1,
"",
"");
I_ProtectedMethod1(void, setUpScene, IN, osgViewer::Viewer *, viewer,
I_ProtectedMethod1(void, setUpScene, IN, osgViewer::View *, view,
Properties::NON_VIRTUAL,
Properties::NON_CONST,
__void__setUpScene__osgViewer_Viewer_P1,
__void__setUpScene__osgViewer_View_P1,
"",
"");
I_ProtectedMethod0(void, updateThreadingModelText,