From 9363aa5a898fb5b34cb9ef2edf0f614e7b96ba9e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 4 Dec 2012 18:21:53 +0000 Subject: [PATCH] Tidied up CaptureSettings and added command line docs --- examples/osgframerenderer/CaptureSettings.cpp | 46 ++++++++++---- examples/osgframerenderer/CaptureSettings.h | 36 ++++++----- .../osgframerenderer/osgframerenderer.cpp | 63 ++++++++++++++----- 3 files changed, 103 insertions(+), 42 deletions(-) diff --git a/examples/osgframerenderer/CaptureSettings.cpp b/examples/osgframerenderer/CaptureSettings.cpp index 0e6d263ed..daa9241db 100644 --- a/examples/osgframerenderer/CaptureSettings.cpp +++ b/examples/osgframerenderer/CaptureSettings.cpp @@ -2,16 +2,36 @@ using namespace gsc; -CaptureSettings::CaptureSettings() +CaptureSettings::CaptureSettings(): + _stereoMode(OFF), + _offscreen(false), + _width(1024), + _height(512), + _samples(0), + _sampleBuffers(0), + _frameRate(60.0), + _numberOfFrames(0.0) +{ +} + +CaptureSettings::CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop): + osg::Object(cs, copyop), + _inputFileName(cs._inputFileName), + _outputFileName(cs._outputFileName), + _outputDirectoryName(cs._outputDirectoryName), + _outputBaseFileName(cs._outputBaseFileName), + _outputExtension(cs._outputExtension), + _stereoMode(cs._stereoMode), + _offscreen(cs._offscreen), + _width(cs._width), + _height(cs._height), + _samples(cs._samples), + _sampleBuffers(cs._sampleBuffers), + _frameRate(cs._frameRate), + _numberOfFrames(cs._numberOfFrames), + _eventHandlers(cs._eventHandlers), + _properties(cs._properties) { - _offscreen = false; - _width = 1024; - _height = 524; - _samples = 0; - _sampleBuffers = 0; - _stereo = false; - _frameRate = 60.0; - _numberOfFrames = 0; } void CaptureSettings::setOutputFileName(const std::string& filename) @@ -125,14 +145,18 @@ REGISTER_OBJECT_WRAPPER( gsc_CaptureSettings, ADD_STRING_SERIALIZER( OutputFileName, "" ); ADD_DOUBLE_SERIALIZER( FrameRate, 60.0 ); + BEGIN_ENUM_SERIALIZER( StereoMode, OFF ); + ADD_ENUM_VALUE( OFF ); + ADD_ENUM_VALUE( HORIZONTAL_SPLIT ); + ADD_ENUM_VALUE( VERTICAL_SPLIT ); + END_ENUM_SERIALIZER(); // _renderTargetImplementation + ADD_BOOL_SERIALIZER( Offscreen, false ); ADD_UINT_SERIALIZER( Width, 1024 ); ADD_UINT_SERIALIZER( Height, 512 ); ADD_UINT_SERIALIZER( Samples, 0 ); ADD_UINT_SERIALIZER( SampleBuffers, 0 ); - - ADD_BOOL_SERIALIZER( Stereo, false ); ADD_UINT_SERIALIZER( NumberOfFrames, 0 ); ADD_USER_SERIALIZER( EventHandlers ); diff --git a/examples/osgframerenderer/CaptureSettings.h b/examples/osgframerenderer/CaptureSettings.h index ffe210cee..1ba3ca8a5 100644 --- a/examples/osgframerenderer/CaptureSettings.h +++ b/examples/osgframerenderer/CaptureSettings.h @@ -16,7 +16,7 @@ class CaptureSettings : public osg::Object { public: CaptureSettings(); - CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {} + CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); META_Object(gsc, CaptureSettings); @@ -29,6 +29,16 @@ public: std::string getOutputFileName(unsigned int frameNumber) const; std::string getOutputFileName(unsigned int cameraNumber, unsigned int frameNumber) const; + enum StereoMode + { + OFF, + HORIZONTAL_SPLIT, + VERTICAL_SPLIT + }; + + void setStereoMode(StereoMode mode) { _stereoMode = mode; } + StereoMode getStereoMode() const { return _stereoMode; } + void setOffscreen(bool o) { _offscreen = o; } bool getOffscreen() const { return _offscreen; } @@ -44,9 +54,6 @@ public: void setSampleBuffers(unsigned int s) { _sampleBuffers = s; } unsigned int getSampleBuffers() const { return _sampleBuffers; } - void setStereo(bool on) { _stereo = on; } - bool getStereo() const { return _stereo; } - void setFrameRate(double fr) { _frameRate = fr; } double getFrameRate() const { return _frameRate; } @@ -91,20 +98,19 @@ protected: std::string _outputBaseFileName; std::string _outputExtension; - bool _offscreen; + StereoMode _stereoMode; + bool _offscreen; - unsigned int _width; - unsigned int _height; - unsigned int _samples; - unsigned int _sampleBuffers; - - bool _stereo; + unsigned int _width; + unsigned int _height; + unsigned int _samples; + unsigned int _sampleBuffers; - double _frameRate; - unsigned int _numberOfFrames; + double _frameRate; + unsigned int _numberOfFrames; - EventHandlers _eventHandlers; - Properties _properties; + EventHandlers _eventHandlers; + Properties _properties; }; diff --git a/examples/osgframerenderer/osgframerenderer.cpp b/examples/osgframerenderer/osgframerenderer.cpp index 025c861ed..137d3bbcf 100644 --- a/examples/osgframerenderer/osgframerenderer.cpp +++ b/examples/osgframerenderer/osgframerenderer.cpp @@ -66,12 +66,28 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of 3D textures."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); - arguments.getApplicationUsage()->addCommandLineOption("--center x y z","View center"); - arguments.getApplicationUsage()->addCommandLineOption("--eye x y z","Camera eye point"); - arguments.getApplicationUsage()->addCommandLineOption("--up x y z","Camera up vector"); - arguments.getApplicationUsage()->addCommandLineOption("--rotation-center x y z","Position to rotatate around"); - arguments.getApplicationUsage()->addCommandLineOption("--rotation-axis x y z","Axis to rotate around"); - arguments.getApplicationUsage()->addCommandLineOption("--rotation-speed v","Degrees per second"); + arguments.getApplicationUsage()->addCommandLineOption("-i ","Input scene (or presentation) filename."); + arguments.getApplicationUsage()->addCommandLineOption("-o ","Base ouput filename of the images, recommended to use something like Images/image.png"); + arguments.getApplicationUsage()->addCommandLineOption("--cs ","Load pre-generated configuration file for run."); + arguments.getApplicationUsage()->addCommandLineOption("--ouput-cs ","Output configuration file with settings provided on commandline."); + arguments.getApplicationUsage()->addCommandLineOption("-p ","Use specificied camera path file to control camera position."); + arguments.getApplicationUsage()->addCommandLineOption("--offscreen","Use an pbuffer to render the images offscreen."); + arguments.getApplicationUsage()->addCommandLineOption("--screen","Use an window to render the images."); + arguments.getApplicationUsage()->addCommandLineOption("-w ","Window/output image width"); + arguments.getApplicationUsage()->addCommandLineOption("-h ","Window/output image height"); + arguments.getApplicationUsage()->addCommandLineOption("--ms ","Number of multi-samples to use when rendering, an enable a single sample buffer."); + arguments.getApplicationUsage()->addCommandLineOption("--samples ","Number of multi-samples to use when rendering."); + arguments.getApplicationUsage()->addCommandLineOption("--sampleBuffers ","Number of sample buffers to use when rendering."); + arguments.getApplicationUsage()->addCommandLineOption("-f ","Number of frames per second in simulation time."); + arguments.getApplicationUsage()->addCommandLineOption("-n ","Number of frames to render/images to create."); + arguments.getApplicationUsage()->addCommandLineOption("-d