From 3b3776df856ae8c92e556b94b7867b635341ce11 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 2 Oct 2007 21:28:27 +0000 Subject: [PATCH] Updated wrappers --- src/osgWrappers/osgViewer/CompositeViewer.cpp | 79 +++--------- src/osgWrappers/osgViewer/Viewer.cpp | 83 +++--------- src/osgWrappers/osgViewer/ViewerBase.cpp | 119 +++++++++++++----- 3 files changed, 118 insertions(+), 163 deletions(-) diff --git a/src/osgWrappers/osgViewer/CompositeViewer.cpp b/src/osgWrappers/osgViewer/CompositeViewer.cpp index 5a934c05c..202b2498a 100644 --- a/src/osgWrappers/osgViewer/CompositeViewer.cpp +++ b/src/osgWrappers/osgViewer/CompositeViewer.cpp @@ -30,12 +30,6 @@ #undef OUT #endif -BEGIN_ENUM_REFLECTOR(osgViewer::CompositeViewer::BarrierPosition) - I_DeclaringFile("osgViewer/CompositeViewer"); - I_EnumLabel(osgViewer::CompositeViewer::BeforeSwapBuffers); - I_EnumLabel(osgViewer::CompositeViewer::AfterSwapBuffers); -END_REFLECTOR - BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) I_DeclaringFile("osgViewer/CompositeViewer"); I_BaseType(osgViewer::ViewerBase); @@ -137,10 +131,15 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __C5_osg_FrameStamp_P1__getFrameStamp, "", ""); - I_Method1(void, setThreadingModel, IN, osgViewer::ViewerBase::ThreadingModel, threadingModel, + I_Method0(double, elapsedTime, Properties::VIRTUAL, - __void__setThreadingModel__ThreadingModel, - "Set the threading model the rendering traversals will use. ", + __double__elapsedTime, + "", + ""); + I_Method0(osg::FrameStamp *, getViewerFrameStamp, + Properties::VIRTUAL, + __osg_FrameStamp_P1__getViewerFrameStamp, + "", ""); I_Method1(void, setEventQueue, IN, osgGA::EventQueue *, eventQueue, Properties::NON_VIRTUAL, @@ -157,26 +156,11 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __C5_osgGA_EventQueue_P1__getEventQueue, "", ""); - 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_Method0(int, run, Properties::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::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::VIRTUAL, __void__advance__double, @@ -192,11 +176,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __void__updateTraversal, "", ""); - I_Method0(void, renderingTraversals, - Properties::VIRTUAL, - __void__renderingTraversals, - "", - ""); I_Method1(void, setCameraWithFocus, IN, osg::Camera *, camera, Properties::NON_VIRTUAL, __void__setCameraWithFocus__osg_Camera_P1, @@ -257,21 +236,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __void__getViews__Views_R1__bool, "", ""); - 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::VIRTUAL, - __void__stopThreading, - "Stop any threads begin run by viewer. ", - ""); - I_Method0(void, startThreading, - 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, @@ -283,30 +247,15 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) __void__constructorInit, "", ""); - I_ProtectedMethod0(void, init, - Properties::NON_VIRTUAL, + I_ProtectedMethod0(void, viewerInit, + Properties::VIRTUAL, Properties::NON_CONST, - __void__init, - "", - ""); - I_ProtectedMethod0(void, checkWindowStatus, - Properties::NON_VIRTUAL, - Properties::NON_CONST, - __void__checkWindowStatus, - "", - ""); - I_ProtectedMethod0(unsigned int, computeNumberOfThreadsIncludingMainRequired, - Properties::NON_VIRTUAL, - Properties::NON_CONST, - __unsigned_int__computeNumberOfThreadsIncludingMainRequired, + __void__viewerInit, "", ""); I_SimpleProperty(osg::Camera *, CameraWithFocus, __osg_Camera_P1__getCameraWithFocus, __void__setCameraWithFocus__osg_Camera_P1); - 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); @@ -319,9 +268,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) I_SimpleProperty(osg::Timer_t, StartTick, 0, __void__setStartTick__osg_Timer_t); - I_SimpleProperty(osgViewer::ViewerBase::ThreadingModel, ThreadingModel, - 0, - __void__setThreadingModel__ThreadingModel); I_ArrayProperty(osgViewer::View *, View, __osgViewer_View_P1__getView__unsigned, 0, @@ -332,5 +278,8 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::CompositeViewer) I_SimpleProperty(osgViewer::View *, ViewWithFocus, __osgViewer_View_P1__getViewWithFocus, 0); + I_SimpleProperty(osg::FrameStamp *, ViewerFrameStamp, + __osg_FrameStamp_P1__getViewerFrameStamp, + 0); END_REFLECTOR diff --git a/src/osgWrappers/osgViewer/Viewer.cpp b/src/osgWrappers/osgViewer/Viewer.cpp index 80a2e373a..d95c854d2 100644 --- a/src/osgWrappers/osgViewer/Viewer.cpp +++ b/src/osgWrappers/osgViewer/Viewer.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -30,12 +31,6 @@ #undef OUT #endif -BEGIN_ENUM_REFLECTOR(osgViewer::Viewer::BarrierPosition) - I_DeclaringFile("osgViewer/Viewer"); - I_EnumLabel(osgViewer::Viewer::BeforeSwapBuffers); - I_EnumLabel(osgViewer::Viewer::AfterSwapBuffers); -END_REFLECTOR - BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) I_DeclaringFile("osgViewer/Viewer"); I_BaseType(osgViewer::ViewerBase); @@ -117,36 +112,21 @@ 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::ViewerBase::ThreadingModel, threadingModel, + I_Method0(double, elapsedTime, Properties::VIRTUAL, - __void__setThreadingModel__ThreadingModel, - "Set the threading model the rendering traversals will use. ", + __double__elapsedTime, + "", ""); - 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. ", - ""); - I_Method1(void, setEndBarrierPosition, IN, osgViewer::Viewer::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::Viewer::BarrierPosition, getEndBarrierPosition, - Properties::NON_VIRTUAL, - __BarrierPosition__getEndBarrierPosition, - "Get the end barrier position. ", + I_Method0(osg::FrameStamp *, getViewerFrameStamp, + Properties::VIRTUAL, + __osg_FrameStamp_P1__getViewerFrameStamp, + "", ""); I_Method0(int, run, Properties::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::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::VIRTUAL, __void__advance__double, @@ -162,11 +142,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) __void__updateTraversal, "", ""); - I_Method0(void, renderingTraversals, - Properties::VIRTUAL, - __void__renderingTraversals, - "", - ""); I_Method1(void, setCameraWithFocus, IN, osg::Camera *, camera, Properties::NON_VIRTUAL, __void__setCameraWithFocus__osg_Camera_P1, @@ -217,21 +192,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) __void__getViews__Views_R1__bool, "", ""); - 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::VIRTUAL, - __void__stopThreading, - "Stop any threads begin run by viewer. ", - ""); - I_Method0(void, startThreading, - Properties::VIRTUAL, - __void__startThreading, - "Start any threads required by the viewer. ", - ""); I_Method1(void, getUsage, IN, osg::ApplicationUsage &, usage, Properties::VIRTUAL, __void__getUsage__osg_ApplicationUsage_R1, @@ -243,30 +203,15 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) __void__constructorInit, "", ""); - I_ProtectedMethod0(void, checkWindowStatus, - Properties::NON_VIRTUAL, + I_ProtectedMethod0(void, viewerInit, + Properties::VIRTUAL, Properties::NON_CONST, - __void__checkWindowStatus, - "", - ""); - I_ProtectedMethod1(void, makeCurrent, IN, osg::GraphicsContext *, gc, - Properties::NON_VIRTUAL, - Properties::NON_CONST, - __void__makeCurrent__osg_GraphicsContext_P1, - "", - ""); - I_ProtectedMethod0(void, releaseContext, - Properties::NON_VIRTUAL, - Properties::NON_CONST, - __void__releaseContext, + __void__viewerInit, "", ""); I_SimpleProperty(osg::Camera *, CameraWithFocus, __osg_Camera_P1__getCameraWithFocus, __void__setCameraWithFocus__osg_Camera_P1); - I_SimpleProperty(osgViewer::Viewer::BarrierPosition, EndBarrierPosition, - __BarrierPosition__getEndBarrierPosition, - __void__setEndBarrierPosition__BarrierPosition); I_SimpleProperty(double, ReferenceTime, 0, __void__setReferenceTime__double); @@ -276,8 +221,8 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::Viewer) I_SimpleProperty(osg::Timer_t, StartTick, 0, __void__setStartTick__osg_Timer_t); - I_SimpleProperty(osgViewer::ViewerBase::ThreadingModel, ThreadingModel, - 0, - __void__setThreadingModel__ThreadingModel); + I_SimpleProperty(osg::FrameStamp *, ViewerFrameStamp, + __osg_FrameStamp_P1__getViewerFrameStamp, + 0); END_REFLECTOR diff --git a/src/osgWrappers/osgViewer/ViewerBase.cpp b/src/osgWrappers/osgViewer/ViewerBase.cpp index d70bb5335..e680d1d0f 100644 --- a/src/osgWrappers/osgViewer/ViewerBase.cpp +++ b/src/osgWrappers/osgViewer/ViewerBase.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,12 @@ BEGIN_ENUM_REFLECTOR(osgViewer::ViewerBase::ThreadingModel) I_EnumLabel(osgViewer::ViewerBase::AutomaticSelection); END_REFLECTOR +BEGIN_ENUM_REFLECTOR(osgViewer::ViewerBase::BarrierPosition) + I_DeclaringFile("osgViewer/ViewerBase"); + I_EnumLabel(osgViewer::ViewerBase::BeforeSwapBuffers); + I_EnumLabel(osgViewer::ViewerBase::AfterSwapBuffers); +END_REFLECTOR + BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) I_DeclaringFile("osgViewer/ViewerBase"); I_VirtualBaseType(osg::Object); @@ -94,7 +101,7 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) "set up windows and associated threads. ", ""); I_Method1(void, setThreadingModel, IN, osgViewer::ViewerBase::ThreadingModel, threadingModel, - Properties::PURE_VIRTUAL, + Properties::VIRTUAL, __void__setThreadingModel__ThreadingModel, "Set the threading model the rendering traversals will use. ", ""); @@ -103,6 +110,41 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) __ThreadingModel__getThreadingModel, "Get the threading model the rendering traversals will use. ", ""); + I_Method0(osgViewer::ViewerBase::ThreadingModel, suggestBestThreadingModel, + Properties::VIRTUAL, + __ThreadingModel__suggestBestThreadingModel, + "Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available. ", + ""); + I_Method0(void, setUpThreading, + 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::VIRTUAL, + __void__stopThreading, + "Stop any threads begin run by viewer. ", + ""); + I_Method0(void, startThreading, + Properties::VIRTUAL, + __void__startThreading, + "Start any threads required by the viewer. ", + ""); + I_Method1(void, setEndBarrierPosition, IN, osgViewer::ViewerBase::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::ViewerBase::BarrierPosition, getEndBarrierPosition, + Properties::NON_VIRTUAL, + __BarrierPosition__getEndBarrierPosition, + "Get the end barrier position. ", + ""); I_Method1(void, setDone, IN, bool, done, Properties::NON_VIRTUAL, __void__setDone__bool, @@ -188,13 +230,28 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) __void__removeUpdateOperation__osg_Operation_P1, "Remove an update operation. ", ""); + 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, checkWindowStatus, + Properties::NON_VIRTUAL, + __void__checkWindowStatus, + "Check to see if windows are still open, if not set viewer done to true. ", + ""); 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, + Properties::VIRTUAL, __void__frame__double, "Render a complete new frame. ", "Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals(). "); @@ -214,7 +271,7 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) "", ""); I_Method0(void, renderingTraversals, - Properties::PURE_VIRTUAL, + Properties::VIRTUAL, __void__renderingTraversals, "", ""); @@ -253,44 +310,45 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) __void__getViews__Views_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, + I_Method0(double, elapsedTime, Properties::PURE_VIRTUAL, - __void__setUpThreading, - "Set up the threading and processor affinity as per the viewers threading model. ", + __double__elapsedTime, + "", ""); - I_Method0(bool, areThreadsRunning, - Properties::NON_VIRTUAL, - __bool__areThreadsRunning, - "Return true if viewer threads are running. ", - ""); - I_Method0(void, stopThreading, + I_Method0(osg::FrameStamp *, getViewerFrameStamp, 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. ", + __osg_FrameStamp_P1__getViewerFrameStamp, + "", ""); 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_ProtectedMethod1(void, makeCurrent, IN, osg::GraphicsContext *, gc, + Properties::NON_VIRTUAL, + Properties::NON_CONST, + __void__makeCurrent__osg_GraphicsContext_P1, + "", + ""); + I_ProtectedMethod0(void, releaseContext, + Properties::NON_VIRTUAL, + Properties::NON_CONST, + __void__releaseContext, + "", + ""); + I_ProtectedMethod0(void, viewerInit, + Properties::PURE_VIRTUAL, + Properties::NON_CONST, + __void__viewerInit, + "", + ""); I_SimpleProperty(bool, Done, 0, __void__setDone__bool); + I_SimpleProperty(osgViewer::ViewerBase::BarrierPosition, EndBarrierPosition, + __BarrierPosition__getEndBarrierPosition, + __void__setEndBarrierPosition__BarrierPosition); I_SimpleProperty(osgGA::EventVisitor *, EventVisitor, __osgGA_EventVisitor_P1__getEventVisitor, __void__setEventVisitor__osgGA_EventVisitor_P1); @@ -315,6 +373,9 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ViewerBase) I_SimpleProperty(osgUtil::UpdateVisitor *, UpdateVisitor, __osgUtil_UpdateVisitor_P1__getUpdateVisitor, __void__setUpdateVisitor__osgUtil_UpdateVisitor_P1); + I_SimpleProperty(osg::FrameStamp *, ViewerFrameStamp, + __osg_FrameStamp_P1__getViewerFrameStamp, + 0); END_REFLECTOR STD_VECTOR_REFLECTOR(std::vector< OpenThreads::Thread * >)