From 19e3b1624d671f50552633c669b99b4920cfdccb Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Jul 2008 23:42:59 +0000 Subject: [PATCH] Moved osgViewer::ScreenCaptureHandler's WindowCaptureCallback from head into .cpp to clean up headers and avoid wrapper build issues. Updated wrappers --- include/osgViewer/ViewerEventHandlers | 169 +++--------- src/osgViewer/ScreenCaptureHandler.cpp | 177 ++++++++++-- src/osgWrappers/osgUtil/Tessellator.cpp | 30 +- src/osgWrappers/osgUtil/TriStripVisitor.cpp | 10 - .../osgViewer/ViewerEventHandlers.cpp | 257 +++--------------- 5 files changed, 247 insertions(+), 396 deletions(-) diff --git a/include/osgViewer/ViewerEventHandlers b/include/osgViewer/ViewerEventHandlers index a5d88ac7d..1667be4e1 100644 --- a/include/osgViewer/ViewerEventHandlers +++ b/include/osgViewer/ViewerEventHandlers @@ -290,144 +290,54 @@ class OSGVIEWER_EXPORT LODScaleHandler : public osgGA::GUIEventHandler }; -/** Abstract base class for what to do when a screen capture happens. */ -class OSGVIEWER_EXPORT CaptureOperation : public osg::Referenced -{ - public: - virtual void operator()(const osg::Image& image, const unsigned int context_id) = 0; -}; - -/** Concrete implementation of a CaptureOperation that writes the screen capture to a file. */ -class OSGVIEWER_EXPORT WriteToFileCaptureOperation : public osgViewer::CaptureOperation -{ - public: - enum SavePolicy - { - OVERWRITE, - SEQUENTIAL_NUMBER - // ... any others? - }; - - WriteToFileCaptureOperation(const std::string& filename, const std::string& extension, SavePolicy savePolicy = OVERWRITE); - - virtual void operator()(const osg::Image& image, const unsigned int context_id); - - void setSavePolicy(SavePolicy savePolicy) { _savePolicy = savePolicy; } - SavePolicy getSavePolicy() const { return _savePolicy; } - - protected: - const std::string _filename; - const std::string _extension; - - SavePolicy _savePolicy; - - std::vector _contextSaveCounter; -}; - -// From osgscreencapture example -/** Callback which will be added to a viewer's camera to do the actual screen capture. */ -class OSGVIEWER_EXPORT WindowCaptureCallback : public osg::Camera::DrawCallback -{ - public: - - enum Mode - { - READ_PIXELS, - SINGLE_PBO, - DOUBLE_PBO, - TRIPLE_PBO - }; - - enum FramePosition - { - START_FRAME, - END_FRAME - }; - - struct ContextData : public osg::Referenced - { - static unsigned int COUNTER; - - ContextData(osg::GraphicsContext* gc, Mode mode, GLenum readBuffer); - - void getSize(osg::GraphicsContext* gc, int& width, int& height); - - void updateTimings(osg::Timer_t tick_start, - osg::Timer_t tick_afterReadPixels, - osg::Timer_t tick_afterMemCpy, - osg::Timer_t tick_afterCaptureOperation, - unsigned int dataSize); - - void read(); - void readPixels(); - void singlePBO(osg::BufferObject::Extensions* ext); - void multiPBO(osg::BufferObject::Extensions* ext); - - typedef std::vector< osg::ref_ptr > ImageBuffer; - typedef std::vector< GLuint > PBOBuffer; - - osg::GraphicsContext* _gc; - unsigned int _index; - Mode _mode; - GLenum _readBuffer; - - GLenum _pixelFormat; - GLenum _type; - int _width; - int _height; - - unsigned int _currentImageIndex; - ImageBuffer _imageBuffer; - - unsigned int _currentPboIndex; - PBOBuffer _pboBuffer; - - unsigned int _reportTimingFrequency; - unsigned int _numTimeValuesRecorded; - double _timeForReadPixels; - double _timeForMemCpy; - double _timeForCaptureOperation; - double _timeForFullCopy; - double _timeForFullCopyAndOperation; - osg::Timer_t _previousFrameTick; - - osg::ref_ptr _captureOperation; - }; - - WindowCaptureCallback(Mode mode, FramePosition position, GLenum readBuffer); - - FramePosition getFramePosition() const { return _position; } - - ContextData* createContextData(osg::GraphicsContext* gc) const; - ContextData* getContextData(osg::GraphicsContext* gc) const; - - void setCaptureOperation(CaptureOperation* operation); - CaptureOperation* getCaptureOperation() { return _contextDataMap.begin()->second->_captureOperation.get(); } - - virtual void operator () (osg::RenderInfo& renderInfo) const; - - typedef std::map > ContextDataMap; - - Mode _mode; - FramePosition _position; - GLenum _readBuffer; - mutable OpenThreads::Mutex _mutex; - mutable ContextDataMap _contextDataMap; - - osg::ref_ptr _defaultCaptureOperation; -}; /** Event handler that will capture the screen on key press. */ class OSGVIEWER_EXPORT ScreenCaptureHandler : public osgGA::GUIEventHandler { public: + + /** Abstract base class for what to do when a screen capture happens. */ + class CaptureOperation : public osg::Referenced + { + public: + virtual void operator()(const osg::Image& image, const unsigned int context_id) = 0; + }; + + /** Concrete implementation of a CaptureOperation that writes the screen capture to a file. */ + class OSGVIEWER_EXPORT WriteToFile : public CaptureOperation + { + public: + enum SavePolicy + { + OVERWRITE, + SEQUENTIAL_NUMBER + // ... any others? + }; + + WriteToFile(const std::string& filename, const std::string& extension, SavePolicy savePolicy = OVERWRITE); + + virtual void operator()(const osg::Image& image, const unsigned int context_id); + + void setSavePolicy(SavePolicy savePolicy) { _savePolicy = savePolicy; } + SavePolicy getSavePolicy() const { return _savePolicy; } + + protected: + const std::string _filename; + const std::string _extension; + + SavePolicy _savePolicy; + + std::vector _contextSaveCounter; + }; + + ScreenCaptureHandler(CaptureOperation* defaultOperation = 0); void setKeyEventTakeScreenShot(int key) { _keyEventTakeScreenShot = key; } int getKeyEventTakeScreenShot() const { return _keyEventTakeScreenShot; } - void setCaptureOperation(CaptureOperation* operation) { _callback->setCaptureOperation(operation); } - CaptureOperation* getCaptureOperation() const { return _callback->getCaptureOperation(); } + void setCaptureOperation(CaptureOperation* operation); + CaptureOperation* getCaptureOperation() const; // aa will point to an osgViewer::View, so we will take a screenshot // of that view's graphics contexts. @@ -440,7 +350,8 @@ class OSGVIEWER_EXPORT ScreenCaptureHandler : public osgGA::GUIEventHandler int _keyEventTakeScreenShot; // there could be a key to start taking screenshots every new frame - osg::ref_ptr _callback; + osg::ref_ptr _operation; + osg::ref_ptr _callback; void addCallbackToViewer(osgViewer::ViewerBase& viewer); }; diff --git a/src/osgViewer/ScreenCaptureHandler.cpp b/src/osgViewer/ScreenCaptureHandler.cpp index c6d8c37b7..9a93b1c36 100644 --- a/src/osgViewer/ScreenCaptureHandler.cpp +++ b/src/osgViewer/ScreenCaptureHandler.cpp @@ -21,42 +21,103 @@ namespace osgViewer { +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// WindowCaptureCallback +// -WriteToFileCaptureOperation::WriteToFileCaptureOperation(const std::string& filename, - const std::string& extension, - SavePolicy savePolicy) - : _filename(filename), _extension(extension), _savePolicy(savePolicy) +// From osgscreencapture example +/** Callback which will be added to a viewer's camera to do the actual screen capture. */ +class WindowCaptureCallback : public osg::Camera::DrawCallback { -} + public: -void WriteToFileCaptureOperation::operator () (const osg::Image& image, const unsigned int context_id) -{ - if (_savePolicy == SEQUENTIAL_NUMBER) - { - if (_contextSaveCounter.size() <= context_id) + enum Mode { - _contextSaveCounter.resize(context_id + 1); - _contextSaveCounter[context_id] = 0; - } - } + READ_PIXELS, + SINGLE_PBO, + DOUBLE_PBO, + TRIPLE_PBO + }; - std::stringstream filename; - filename << _filename << "_" << context_id; + enum FramePosition + { + START_FRAME, + END_FRAME + }; - if (_savePolicy == SEQUENTIAL_NUMBER) - filename << "_" << _contextSaveCounter[context_id]; + WindowCaptureCallback(Mode mode, FramePosition position, GLenum readBuffer); - filename << "." << _extension; + FramePosition getFramePosition() const { return _position; } - osgDB::writeImageFile(image, filename.str()); + void setCaptureOperation(ScreenCaptureHandler::CaptureOperation* operation); + ScreenCaptureHandler::CaptureOperation* getCaptureOperation() { return _contextDataMap.begin()->second->_captureOperation.get(); } - osg::notify(osg::INFO)<<"ScreenCaptureHandler: Taking a screenshot, saved as '"< > ImageBuffer; + typedef std::vector< GLuint > PBOBuffer; + + osg::GraphicsContext* _gc; + unsigned int _index; + Mode _mode; + GLenum _readBuffer; + + GLenum _pixelFormat; + GLenum _type; + int _width; + int _height; + + unsigned int _currentImageIndex; + ImageBuffer _imageBuffer; + + unsigned int _currentPboIndex; + PBOBuffer _pboBuffer; + + unsigned int _reportTimingFrequency; + unsigned int _numTimeValuesRecorded; + double _timeForReadPixels; + double _timeForMemCpy; + double _timeForCaptureOperation; + double _timeForFullCopy; + double _timeForFullCopyAndOperation; + osg::Timer_t _previousFrameTick; + + osg::ref_ptr _captureOperation; + }; + + typedef std::map > ContextDataMap; + + ContextData* createContextData(osg::GraphicsContext* gc) const; + ContextData* getContextData(osg::GraphicsContext* gc) const; + + Mode _mode; + FramePosition _position; + GLenum _readBuffer; + mutable OpenThreads::Mutex _mutex; + mutable ContextDataMap _contextDataMap; + + osg::ref_ptr _defaultCaptureOperation; +}; unsigned int WindowCaptureCallback::ContextData::COUNTER = 0; @@ -411,7 +472,7 @@ WindowCaptureCallback::ContextData* WindowCaptureCallback::getContextData(osg::G return data.get(); } -void WindowCaptureCallback::setCaptureOperation(CaptureOperation* operation) +void WindowCaptureCallback::setCaptureOperation(ScreenCaptureHandler::CaptureOperation* operation) { _defaultCaptureOperation = operation; @@ -449,6 +510,52 @@ void WindowCaptureCallback::operator () (osg::RenderInfo& renderInfo) const } + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ScreenCaptureHandler::WriteToFile +// +ScreenCaptureHandler::WriteToFile::WriteToFile(const std::string& filename, + const std::string& extension, + SavePolicy savePolicy) + : _filename(filename), _extension(extension), _savePolicy(savePolicy) +{ +} + +void ScreenCaptureHandler::WriteToFile::operator () (const osg::Image& image, const unsigned int context_id) +{ + if (_savePolicy == SEQUENTIAL_NUMBER) + { + if (_contextSaveCounter.size() <= context_id) + { + _contextSaveCounter.resize(context_id + 1); + _contextSaveCounter[context_id] = 0; + } + } + + std::stringstream filename; + filename << _filename << "_" << context_id; + + if (_savePolicy == SEQUENTIAL_NUMBER) + filename << "_" << _contextSaveCounter[context_id]; + + filename << "." << _extension; + + osgDB::writeImageFile(image, filename.str()); + + osg::notify(osg::INFO)<<"ScreenCaptureHandler: Taking a screenshot, saved as '"<(_callback.get())->setCaptureOperation(operation); +} + +ScreenCaptureHandler::CaptureOperation* ScreenCaptureHandler::getCaptureOperation() const +{ + return static_cast(_callback.get())->getCaptureOperation(); +} + + void ScreenCaptureHandler::addCallbackToViewer(osgViewer::ViewerBase& viewer) { // Select either the first or the last active camera, depending on the @@ -472,8 +590,9 @@ void ScreenCaptureHandler::addCallbackToViewer(osgViewer::ViewerBase& viewer) // handler has been initialized, but stats are not displayed. In that // case, there is a post render camera on the viewer, but its node mask // is zero, so the callback added to that camera would never be called. + WindowCaptureCallback* callback = static_cast(_callback.get()); - if (_callback->getFramePosition() == WindowCaptureCallback::START_FRAME) + if (callback->getFramePosition() == WindowCaptureCallback::START_FRAME) { osgViewer::ViewerBase::Windows windows; viewer.getWindows(windows); diff --git a/src/osgWrappers/osgUtil/Tessellator.cpp b/src/osgWrappers/osgUtil/Tessellator.cpp index f71bf8d4d..51ec8a7b8 100644 --- a/src/osgWrappers/osgUtil/Tessellator.cpp +++ b/src/osgWrappers/osgUtil/Tessellator.cpp @@ -53,9 +53,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Tessellator) __void__setBoundaryOnly__C5_bool, "Set and get tessellation request boundary only on/off. ", ""); - I_Method0(const bool, getBoundaryOnly, + I_Method0(bool, getBoundaryOnly, Properties::NON_VIRTUAL, - __C5_bool__getBoundaryOnly, + __bool__getBoundaryOnly, "", ""); I_Method1(void, setWindingType, IN, const osgUtil::Tessellator::WindingType, wt, @@ -63,9 +63,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Tessellator) __void__setWindingType__C5_WindingType, "Set and get tessellation windong rule. ", ""); - I_Method0(const osgUtil::Tessellator::WindingType, getWindingType, + I_Method0(osgUtil::Tessellator::WindingType, getWindingType, Properties::NON_VIRTUAL, - __C5_WindingType__getWindingType, + __WindingType__getWindingType, "", ""); I_Method1(void, setTessellationType, IN, const osgUtil::Tessellator::TessellationType, tt, @@ -73,9 +73,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Tessellator) __void__setTessellationType__C5_TessellationType, "Set and get tessellation type. ", ""); - I_Method0(const osgUtil::Tessellator::TessellationType, getTessellationType, + I_Method0(osgUtil::Tessellator::TessellationType, getTessellationType, Properties::NON_VIRTUAL, - __C5_TessellationType__getTessellationType, + __TessellationType__getTessellationType, "", ""); I_Method1(void, retessellatePolygons, IN, osg::Geometry &, cxgeom, @@ -183,9 +183,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Tessellator) __void__error__GLenum, "", ""); - I_SimpleProperty(const bool, BoundaryOnly, - __C5_bool__getBoundaryOnly, - __void__setBoundaryOnly__C5_bool); + I_SimpleProperty(bool, BoundaryOnly, + __bool__getBoundaryOnly, + 0); I_SimpleProperty(osg::Geometry::PrimitiveSetList, Contours, __osg_Geometry_PrimitiveSetList__getContours, 0); @@ -195,12 +195,12 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::Tessellator) I_SimpleProperty(const osg::Vec3, TessellationNormal, 0, __void__setTessellationNormal__C5_osg_Vec3); - I_SimpleProperty(const osgUtil::Tessellator::TessellationType, TessellationType, - __C5_TessellationType__getTessellationType, - __void__setTessellationType__C5_TessellationType); - I_SimpleProperty(const osgUtil::Tessellator::WindingType, WindingType, - __C5_WindingType__getWindingType, - __void__setWindingType__C5_WindingType); + I_SimpleProperty(osgUtil::Tessellator::TessellationType, TessellationType, + __TessellationType__getTessellationType, + 0); + I_SimpleProperty(osgUtil::Tessellator::WindingType, WindingType, + __WindingType__getWindingType, + 0); END_REFLECTOR TYPE_NAME_ALIAS(std::vector< osg::Vec3 * >, osgUtil::Tessellator::Prim::VecList) diff --git a/src/osgWrappers/osgUtil/TriStripVisitor.cpp b/src/osgWrappers/osgUtil/TriStripVisitor.cpp index a6c828afa..a0e8a0cf9 100644 --- a/src/osgWrappers/osgUtil/TriStripVisitor.cpp +++ b/src/osgWrappers/osgUtil/TriStripVisitor.cpp @@ -56,11 +56,6 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::TriStripVisitor) __unsigned_int__getCacheSize, "", ""); - I_Method0(const unsigned int, getCacheSize, - Properties::NON_VIRTUAL, - __C5_unsigned_int__getCacheSize, - "", - ""); I_Method1(void, setMinStripSize, IN, unsigned int, size, Properties::NON_VIRTUAL, __void__setMinStripSize__unsigned_int, @@ -71,11 +66,6 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::TriStripVisitor) __unsigned_int__getMinStripSize, "", ""); - I_Method0(const unsigned int, getMinStripSize, - Properties::NON_VIRTUAL, - __C5_unsigned_int__getMinStripSize, - "", - ""); I_Method1(void, setGenerateFourPointPrimitivesQuads, IN, bool, flag, Properties::NON_VIRTUAL, __void__setGenerateFourPointPrimitivesQuads__bool, diff --git a/src/osgWrappers/osgViewer/ViewerEventHandlers.cpp b/src/osgWrappers/osgViewer/ViewerEventHandlers.cpp index fc87b6fe8..7ce478d8e 100644 --- a/src/osgWrappers/osgViewer/ViewerEventHandlers.cpp +++ b/src/osgWrappers/osgViewer/ViewerEventHandlers.cpp @@ -11,12 +11,8 @@ #include #include -#include #include -#include #include -#include -#include #include #include #include @@ -29,14 +25,6 @@ #undef OUT #endif -BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::CaptureOperation) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_BaseType(osg::Referenced); - I_Constructor0(____CaptureOperation, - "", - ""); -END_REFLECTOR - BEGIN_OBJECT_REFLECTOR(osgViewer::HelpHandler) I_DeclaringFile("osgViewer/ViewerEventHandlers"); I_BaseType(osgGA::GUIEventHandler); @@ -219,9 +207,11 @@ END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler) I_DeclaringFile("osgViewer/ViewerEventHandlers"); I_BaseType(osgGA::GUIEventHandler); - I_Constructor0(____ScreenCaptureHandler, - "", - ""); + I_ConstructorWithDefaults1(IN, osgViewer::ScreenCaptureHandler::CaptureOperation *, defaultOperation, 0, + Properties::NON_EXPLICIT, + ____ScreenCaptureHandler__CaptureOperation_P1, + "", + ""); I_Method1(void, setKeyEventTakeScreenShot, IN, int, key, Properties::NON_VIRTUAL, __void__setKeyEventTakeScreenShot__int, @@ -232,12 +222,12 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler) __int__getKeyEventTakeScreenShot, "", ""); - I_Method1(void, setCaptureOperation, IN, osgViewer::CaptureOperation *, operation, + I_Method1(void, setCaptureOperation, IN, osgViewer::ScreenCaptureHandler::CaptureOperation *, operation, Properties::NON_VIRTUAL, __void__setCaptureOperation__CaptureOperation_P1, "", ""); - I_Method0(osgViewer::CaptureOperation *, getCaptureOperation, + I_Method0(osgViewer::ScreenCaptureHandler::CaptureOperation *, getCaptureOperation, Properties::NON_VIRTUAL, __CaptureOperation_P1__getCaptureOperation, "", @@ -258,7 +248,7 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler) __void__addCallbackToViewer__osgViewer_ViewerBase_R1, "", ""); - I_SimpleProperty(osgViewer::CaptureOperation *, CaptureOperation, + I_SimpleProperty(osgViewer::ScreenCaptureHandler::CaptureOperation *, CaptureOperation, __CaptureOperation_P1__getCaptureOperation, __void__setCaptureOperation__CaptureOperation_P1); I_SimpleProperty(int, KeyEventTakeScreenShot, @@ -266,6 +256,42 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler) __void__setKeyEventTakeScreenShot__int); END_REFLECTOR +BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler::CaptureOperation) + I_DeclaringFile("osgViewer/ViewerEventHandlers"); + I_BaseType(osg::Referenced); + I_Constructor0(____CaptureOperation, + "", + ""); +END_REFLECTOR + +BEGIN_ENUM_REFLECTOR(osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy) + I_DeclaringFile("osgViewer/ViewerEventHandlers"); + I_EnumLabel(osgViewer::ScreenCaptureHandler::WriteToFile::OVERWRITE); + I_EnumLabel(osgViewer::ScreenCaptureHandler::WriteToFile::SEQUENTIAL_NUMBER); +END_REFLECTOR + +BEGIN_OBJECT_REFLECTOR(osgViewer::ScreenCaptureHandler::WriteToFile) + I_DeclaringFile("osgViewer/ViewerEventHandlers"); + I_BaseType(osgViewer::ScreenCaptureHandler::CaptureOperation); + I_ConstructorWithDefaults3(IN, const std::string &, filename, , IN, const std::string &, extension, , IN, osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy, savePolicy, osgViewer::ScreenCaptureHandler::WriteToFile::OVERWRITE, + ____WriteToFile__C5_std_string_R1__C5_std_string_R1__SavePolicy, + "", + ""); + I_Method1(void, setSavePolicy, IN, osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy, savePolicy, + Properties::NON_VIRTUAL, + __void__setSavePolicy__SavePolicy, + "", + ""); + I_Method0(osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy, getSavePolicy, + Properties::NON_VIRTUAL, + __SavePolicy__getSavePolicy, + "", + ""); + I_SimpleProperty(osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy, SavePolicy, + __SavePolicy__getSavePolicy, + __void__setSavePolicy__SavePolicy); +END_REFLECTOR + BEGIN_ENUM_REFLECTOR(osgViewer::StatsHandler::StatsType) I_DeclaringFile("osgViewer/ViewerEventHandlers"); I_EnumLabel(osgViewer::StatsHandler::NO_STATS); @@ -456,129 +482,6 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::ThreadingHandler) __void__setKeyEventChangeThreadingModel__int); END_REFLECTOR -TYPE_NAME_ALIAS(std::map< osg::GraphicsContext * COMMA osg::ref_ptr< osgViewer::WindowCaptureCallback::ContextData > >, osgViewer::WindowCaptureCallback::ContextDataMap) - -BEGIN_ENUM_REFLECTOR(osgViewer::WindowCaptureCallback::Mode) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_EnumLabel(osgViewer::WindowCaptureCallback::READ_PIXELS); - I_EnumLabel(osgViewer::WindowCaptureCallback::SINGLE_PBO); - I_EnumLabel(osgViewer::WindowCaptureCallback::DOUBLE_PBO); - I_EnumLabel(osgViewer::WindowCaptureCallback::TRIPLE_PBO); -END_REFLECTOR - -BEGIN_ENUM_REFLECTOR(osgViewer::WindowCaptureCallback::FramePosition) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_EnumLabel(osgViewer::WindowCaptureCallback::START_FRAME); - I_EnumLabel(osgViewer::WindowCaptureCallback::END_FRAME); -END_REFLECTOR - -BEGIN_OBJECT_REFLECTOR(osgViewer::WindowCaptureCallback) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_BaseType(osg::Camera::DrawCallback); - I_Constructor3(IN, osgViewer::WindowCaptureCallback::Mode, mode, IN, osgViewer::WindowCaptureCallback::FramePosition, position, IN, GLenum, readBuffer, - ____WindowCaptureCallback__Mode__FramePosition__GLenum, - "", - ""); - I_Method0(osgViewer::WindowCaptureCallback::FramePosition, getFramePosition, - Properties::NON_VIRTUAL, - __FramePosition__getFramePosition, - "", - ""); - I_Method1(osgViewer::WindowCaptureCallback::ContextData *, createContextData, IN, osg::GraphicsContext *, gc, - Properties::NON_VIRTUAL, - __ContextData_P1__createContextData__osg_GraphicsContext_P1, - "", - ""); - I_Method1(osgViewer::WindowCaptureCallback::ContextData *, getContextData, IN, osg::GraphicsContext *, gc, - Properties::NON_VIRTUAL, - __ContextData_P1__getContextData__osg_GraphicsContext_P1, - "", - ""); - I_Method1(void, setCaptureOperation, IN, osgViewer::CaptureOperation *, operation, - Properties::NON_VIRTUAL, - __void__setCaptureOperation__CaptureOperation_P1, - "", - ""); - I_Method0(osgViewer::CaptureOperation *, getCaptureOperation, - Properties::NON_VIRTUAL, - __CaptureOperation_P1__getCaptureOperation, - "", - ""); - I_SimpleProperty(osgViewer::CaptureOperation *, CaptureOperation, - __CaptureOperation_P1__getCaptureOperation, - __void__setCaptureOperation__CaptureOperation_P1); - I_SimpleProperty(osgViewer::WindowCaptureCallback::FramePosition, FramePosition, - __FramePosition__getFramePosition, - 0); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::Mode, _mode); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::FramePosition, _position); - I_PublicMemberProperty(GLenum, _readBuffer); - I_PublicMemberProperty(OpenThreads::Mutex, _mutex); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::ContextDataMap, _contextDataMap); -END_REFLECTOR - -TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osg::Image > >, osgViewer::WindowCaptureCallback::ContextData::ImageBuffer) - -TYPE_NAME_ALIAS(std::vector< GLuint >, osgViewer::WindowCaptureCallback::ContextData::PBOBuffer) - -BEGIN_OBJECT_REFLECTOR(osgViewer::WindowCaptureCallback::ContextData) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_BaseType(osg::Referenced); - I_Constructor3(IN, osg::GraphicsContext *, gc, IN, osgViewer::WindowCaptureCallback::Mode, mode, IN, GLenum, readBuffer, - ____ContextData__osg_GraphicsContext_P1__Mode__GLenum, - "", - ""); - I_Method3(void, getSize, IN, osg::GraphicsContext *, gc, IN, int &, width, IN, int &, height, - Properties::NON_VIRTUAL, - __void__getSize__osg_GraphicsContext_P1__int_R1__int_R1, - "", - ""); - I_Method4(void, updateTimings, IN, osg::Timer_t, tick_start, IN, osg::Timer_t, tick_afterReadPixels, IN, osg::Timer_t, tick_afterMemCpy, IN, unsigned int, dataSize, - Properties::NON_VIRTUAL, - __void__updateTimings__osg_Timer_t__osg_Timer_t__osg_Timer_t__unsigned_int, - "", - ""); - I_Method0(void, read, - Properties::NON_VIRTUAL, - __void__read, - "", - ""); - I_Method0(void, readPixels, - Properties::NON_VIRTUAL, - __void__readPixels, - "", - ""); - I_Method1(void, singlePBO, IN, osg::BufferObject::Extensions *, ext, - Properties::NON_VIRTUAL, - __void__singlePBO__osg_BufferObject_Extensions_P1, - "", - ""); - I_Method1(void, multiPBO, IN, osg::BufferObject::Extensions *, ext, - Properties::NON_VIRTUAL, - __void__multiPBO__osg_BufferObject_Extensions_P1, - "", - ""); - I_PublicMemberProperty(osg::GraphicsContext *, _gc); - I_PublicMemberProperty(unsigned int, _index); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::Mode, _mode); - I_PublicMemberProperty(GLenum, _readBuffer); - I_PublicMemberProperty(GLenum, _pixelFormat); - I_PublicMemberProperty(GLenum, _type); - I_PublicMemberProperty(int, _width); - I_PublicMemberProperty(int, _height); - I_PublicMemberProperty(unsigned int, _currentImageIndex); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::ContextData::ImageBuffer, _imageBuffer); - I_PublicMemberProperty(unsigned int, _currentPboIndex); - I_PublicMemberProperty(osgViewer::WindowCaptureCallback::ContextData::PBOBuffer, _pboBuffer); - I_PublicMemberProperty(unsigned int, _reportTimingFrequency); - I_PublicMemberProperty(unsigned int, _numTimeValuesRecorded); - I_PublicMemberProperty(double, _timeForReadPixels); - I_PublicMemberProperty(double, _timeForFullCopy); - I_PublicMemberProperty(double, _timeForMemCpy); - I_PublicMemberProperty(osg::Timer_t, _previousFrameTick); - I_PublicMemberProperty(osg::ref_ptr< osgViewer::CaptureOperation >, _captureOperation); -END_REFLECTOR - BEGIN_OBJECT_REFLECTOR(osgViewer::WindowSizeHandler) I_DeclaringFile("osgViewer/ViewerEventHandlers"); I_BaseType(osgGA::GUIEventHandler); @@ -680,75 +583,3 @@ BEGIN_OBJECT_REFLECTOR(osgViewer::WindowSizeHandler) __void__setToggleFullscreen__bool); END_REFLECTOR -BEGIN_ENUM_REFLECTOR(osgViewer::WriteToFileCaptureOperation::SavePolicy) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_EnumLabel(osgViewer::WriteToFileCaptureOperation::OVERWRITE); - I_EnumLabel(osgViewer::WriteToFileCaptureOperation::SEQUENTIAL_NUMBER); -END_REFLECTOR - -BEGIN_OBJECT_REFLECTOR(osgViewer::WriteToFileCaptureOperation) - I_DeclaringFile("osgViewer/ViewerEventHandlers"); - I_BaseType(osgViewer::CaptureOperation); - I_ConstructorWithDefaults3(IN, const std::string &, filename, , IN, const std::string &, extension, , IN, osgViewer::WriteToFileCaptureOperation::SavePolicy, savePolicy, osgViewer::WriteToFileCaptureOperation::OVERWRITE, - ____WriteToFileCaptureOperation__C5_std_string_R1__C5_std_string_R1__SavePolicy, - "", - ""); - I_Method1(void, setSavePolicy, IN, osgViewer::WriteToFileCaptureOperation::SavePolicy, savePolicy, - Properties::NON_VIRTUAL, - __void__setSavePolicy__SavePolicy, - "", - ""); - I_Method0(osgViewer::WriteToFileCaptureOperation::SavePolicy, getSavePolicy, - Properties::NON_VIRTUAL, - __SavePolicy__getSavePolicy, - "", - ""); - I_SimpleProperty(osgViewer::WriteToFileCaptureOperation::SavePolicy, SavePolicy, - __SavePolicy__getSavePolicy, - __void__setSavePolicy__SavePolicy); -END_REFLECTOR - -BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgViewer::WindowCaptureCallback::ContextData >) - I_DeclaringFile("osg/ref_ptr"); - I_Constructor0(____ref_ptr, - "", - ""); - I_Constructor1(IN, osgViewer::WindowCaptureCallback::ContextData *, ptr, - Properties::NON_EXPLICIT, - ____ref_ptr__T_P1, - "", - ""); - I_Constructor1(IN, const osg::ref_ptr< osgViewer::WindowCaptureCallback::ContextData > &, rp, - Properties::NON_EXPLICIT, - ____ref_ptr__C5_ref_ptr_R1, - "", - ""); - I_Method0(osgViewer::WindowCaptureCallback::ContextData *, get, - Properties::NON_VIRTUAL, - __T_P1__get, - "", - ""); - I_Method0(bool, valid, - Properties::NON_VIRTUAL, - __bool__valid, - "", - ""); - I_Method0(osgViewer::WindowCaptureCallback::ContextData *, release, - Properties::NON_VIRTUAL, - __T_P1__release, - "", - ""); - I_Method1(void, swap, IN, osg::ref_ptr< osgViewer::WindowCaptureCallback::ContextData > &, rp, - Properties::NON_VIRTUAL, - __void__swap__ref_ptr_R1, - "", - ""); - I_SimpleProperty(osgViewer::WindowCaptureCallback::ContextData *, , - __T_P1__get, - 0); -END_REFLECTOR - -STD_MAP_REFLECTOR(std::map< osg::GraphicsContext * COMMA osg::ref_ptr< osgViewer::WindowCaptureCallback::ContextData > >) - -STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osg::Image > >) -