10 #ifndef _Arnold_CACHE_INTERFACE_H_
11 #define _Arnold_CACHE_INTERFACE_H_
15 #include "LumiverseCoreConfig.h"
17 #ifdef USE_ARNOLD_CACHING
22 #include "Compositor.h"
23 #include "ToneMapper.h"
27 #include <unordered_map>
34 class CachingRenderContext
37 CachingRenderContext(Compositor* c,
int w,
int h);
38 ~CachingRenderContext();
40 void setSize(
int w,
int h);
41 void render(
const set<Device*>& d);
43 Compositor* _compositor;
57 class CachingArnoldInterface :
public virtual ArnoldInterface
60 CachingArnoldInterface();
72 void close()
override;
80 int render(
const std::set<Device *> &devices,
int w,
int h,
int& cid);
85 bool setDims(
int w,
int h)
override;
90 void setCacheDims(
int w,
int h);
98 void setSamples(
int samples)
override;
103 void setPath(
string path) { _cache_file_path = path; }
104 string getPath() {
return _cache_file_path; }
110 void setOptionParameter(
const std::string ¶mName,
int val)
override;
111 void setOptionParameter(
const std::string ¶mName,
float val)
override;
123 virtual void loadIfUsingCaching(
const set<Device*>& devices);
126 float* getBufferForContext(
int contextId);
129 void closeContext(
int contextId);
131 virtual JSONNode toJSON()
override;
134 void setExposure(
float e);
138 const static int DEFAULT_WIDTH = 1920;
139 const static int DEFAULT_HEIGHT = 980;
142 ToneMapper tone_mapper;
147 Pixel4 *compositor_output;
152 int load_exr(
string& filename);
157 virtual void updateDevicesLayers(
const std::set<Device *> &devices);
162 const std::unordered_map<std::string, Device*> getDevicesToUpdate(
const std::set<Device *> &devices);
169 std::unordered_map<std::string, Device*> cached_devices;
174 bool force_cache_reload =
false;
180 float *m_render_buffer = NULL;
191 int _cache_aa_samples;
194 string _cache_file_path;
207 bool optionRequiresCacheReload(
const std::string ¶mName);
214 bool isValidCacheCopy(Device *cached_device, Device *other_device);
219 virtual void setHDROutputBuffer();
224 void saveLayer(EXRLayer* l);
229 void loadCache(
const set<Device*>& devices);
233 map<string, EXRLayer*> _layers;
236 vector<CachingRenderContext*> _contexts;
246 #endif // USE_ARNOLD_CACHING
248 #endif // _Arnold_CACHE_INTERFACE_H_
void render()
Render a frame and pass it back to node.
Definition: Dumiverse.cpp:43
void close()
Close the connection to node.
Definition: Dumiverse.cpp:37
void init(const char *jsonPatchStr, const char *filename)
Initializes data structures.
Definition: Dumiverse.cpp:29
float getPercentage()
Gets the progress of current frame as a percentage.
Definition: Dumiverse.cpp:25
Stores a vector used by ArnoldPatch.
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
Implementation of a interface between ArnoldPatch and arnold.