|
Katana Plug-in APIs 0.1
|
00001 // Copyright (c) 2013 The Foundry Visionmongers Ltd. All Rights Reserved. 00002 00003 #ifndef FNRENDER_RENDERSETTINGS_H 00004 #define FNRENDER_RENDERSETTINGS_H 00005 00006 #include "FnAttribute/FnAttribute.h" 00007 #include "FnAttribute/FnConstVector.h" 00008 00009 #include "FnRender/FnRenderAPI.h" 00010 #include "FnRender/plugin/CameraSettings.h" 00011 00012 #include "FnScenegraphIterator/FnScenegraphIterator.h" 00013 00014 namespace Foundry 00015 { 00016 namespace Katana 00017 { 00018 namespace Render 00019 { 00033 class FNRENDER_API RenderSettings 00034 { 00035 public: 00039 RenderSettings( 00040 FNSCENEGRAPHITERATOR_NAMESPACE::FnScenegraphIterator rootIterator); 00041 00042 virtual ~RenderSettings() {} 00043 00049 virtual int initialise(); 00050 00060 struct ChannelBuffer 00061 { 00062 std::string channelName; 00063 std::string bufferId; 00064 }; 00065 00070 typedef std::map<std::string, ChannelBuffer> ChannelBuffers; 00071 00072 typedef std::map<std::string, std::string> Settings; 00073 typedef std::map<std::string, FnAttribute::Attribute> AttributeSettings; 00074 00078 typedef std::map<std::string, CameraSettings*> CameraMap; 00079 00089 struct RenderOutput 00090 { 00091 std::string type; 00092 std::string locationType; 00093 std::string renderLocation; 00095 AttributeSettings rendererSettings; 00096 std::string colorSpace; 00097 std::string channel; 00098 std::string fileExtension; 00099 std::string cameraName; 00101 AttributeSettings convertSettings; 00102 bool clampOutput; 00103 bool colorConvert; 00104 std::string computeStats; 00106 std::string tempRenderLocation; 00107 std::string tempRenderId; 00108 bool enabled; 00109 }; 00110 00115 typedef std::map<std::string, RenderOutput> RenderOutputs; 00116 00122 bool isValid() const { return _valid; } 00123 00127 virtual std::string getCameraName() const { return _cameraName; } 00128 00139 virtual CameraSettings* getCameraSettings() const { return _camera.get(); } 00140 00154 virtual CameraMap getAdditionalCameras() const { 00155 // Translate the internal shared pointer map into a map of raw 00156 // pointers. 00157 CameraMap result; 00158 for (CameraMapPtrs::const_iterator it = _additionalCameras.begin(); 00159 it != _additionalCameras.end(); ++it) 00160 { 00161 result[it->first] = it->second.get(); 00162 } 00163 00164 return result; 00165 } 00166 00175 virtual void getCropWindow(float cropWindow[4]) const; 00176 00186 virtual void getSampleRate(float sampleRate[2]) const; 00187 00191 virtual std::string getResolutionName() const { return _resolution; } 00192 00196 virtual int getResolutionX() const { return _xRes; } 00197 00201 virtual int getResolutionY() const { return _yRes; } 00202 00209 virtual void getDisplayWindow(int displayWindow[4]) const; 00210 00214 virtual void getOverscan(int overscan[4]) const; 00215 00222 virtual void getDataWindow(int dataWindow[4]) const; 00223 00234 virtual void getRegionOfInterest(int regionOfInterest[4]) const; 00235 00246 virtual void getRegionOfInterest(float regionOfInterest[4]) const; 00247 00251 virtual std::string getRenderer() const { return _renderer; } 00252 00268 virtual bool applyRenderThreads(int& renderThreads) const; 00269 00277 virtual void getInteractiveOutputs(std::vector<std::string>& outputs) const; 00278 00286 virtual void getChannelBuffers(ChannelBuffers& channelBuffers); 00287 00292 virtual RenderOutputs getRenderOutputs() const { return _renderOutputs; } 00293 00297 virtual std::vector<std::string> getRenderOutputNames(const bool onlyEnabledOutputs = true) const; 00298 00302 virtual int getNumberOfRenderOutputs() const { return int(_renderOutputs.size()); } 00303 00307 virtual RenderOutput getRenderOutputByName(const std::string& outputName) const; 00308 00312 virtual int getMaxTimeSamples() const { return _maxTimeSamples; } 00313 00317 virtual float getShutterOpen() const { return _shutterOpen; } 00318 00322 virtual float getShutterClose() const { return _shutterClose; } 00323 00330 virtual bool isTileRender() const { return _useTileRender; } 00331 00336 virtual void getWindowOrigin(int windowOrigin[2]) const; 00337 00341 virtual void getDisplayWindowSize(int displayWindowSize[2]) const; 00342 00346 virtual void getDataWindowSize(int dataWindowSize[2]) const; 00347 00353 virtual std::string getRenderFinishedFilename() const 00354 { 00355 return _renderFinishedFilename; 00356 } 00357 00358 protected: 00359 // Internal shared-pointer equivallent of a CameraMap 00360 typedef std::map<std::string, CameraSettings::Ptr> CameraMapPtrs; 00361 00362 void calculateCropWindow(float calculatedCropWindow[4]) const; 00363 void processColorOutput(RenderOutput& output, FnAttribute::GroupAttribute rendererSettingsAttr) const; 00364 00365 FNSCENEGRAPHITERATOR_NAMESPACE::FnScenegraphIterator _rootIterator; 00366 bool _valid; 00367 00368 CameraSettings::Ptr _camera; 00369 CameraMapPtrs _additionalCameras; 00370 00371 std::string _renderer; 00372 std::string _cameraName; 00373 std::string _resolution; 00374 int _overscan[4]; 00375 int _displayWindow[4]; 00376 int _finalDisplayWindow[4]; 00377 int _dataWindow[4]; 00378 int _finalDataWindow[4]; 00379 float _cropWindow[4]; 00380 float _regionOfInterest[4]; 00381 int _finalRegionOfInterest[4]; 00382 int _xRes, _yRes; 00383 float _sampleRate[2]; 00384 bool _useTileRender; 00385 int _tileRender[4]; 00386 FnAttribute::IntAttribute _renderThreadsAttr; 00387 00388 int _maxTimeSamples; 00389 float _shutterOpen; 00390 float _shutterClose; 00391 00392 std::string _interactiveOutputs; 00393 ChannelBuffers _buffers; 00394 00395 RenderOutputs _renderOutputs; 00396 std::vector<std::string> _renderOutputNames; 00397 std::vector<std::string> _enabledRenderOutputNames; 00398 00399 std::string _tempDir; 00400 00401 std::string _renderFinishedFilename; 00402 }; 00406 } 00407 } 00408 } 00409 00410 namespace FnKat = Foundry::Katana; 00411 00412 #endif
1.7.3