Lumiverse  2.5
A framework for creating lighting control applications
ArnoldAnimationPatch.h
Go to the documentation of this file.
1 
4 #ifndef _ArnoldAnimationPATCH_H_
5 #define _ArnoldAnimationPATCH_H_
6 
7 #pragma once
8 
9 #include "LumiverseCoreConfig.h"
10 
11 #include "../lib/libjson/libjson.h"
13 #include "ArnoldPatch.h"
15 #include "ArnoldFileFrameManager.h"
16 #include "imageio.h"
17 #include "../lib/libpng/png.h"
18 
19 #include <thread>
20 #include <chrono>
21 #include <iostream>
22 
23 namespace Lumiverse {
32 
34  struct FrameDeviceInfo;
35 
45  public ArnoldPatch
46  {
47  public:
54 
56 
62  ArnoldAnimationPatch(const JSONNode data);
63 
67  virtual ~ArnoldAnimationPatch();
68 
73  virtual void init() override;
74 
80  virtual string getType() override { return "ArnoldAnimationPatch"; }
81 
90  virtual void update(set<Device *> devices) override;
91 
97  virtual void rerender();
98 
103  virtual void interruptRender();
104 
113  virtual void close() override;
114 
121  void setPreviewSamples(int preview);
122 
129  void setRenderSamples(int render);
130 
135 
140 
141  // Callbacks
142  typedef function<void()> FinishedCallbackFunction;
143 
151  virtual float getPercentage() const override;
152 
153  virtual void reset();
154 
159 
164 
171 
177  void renderSingleFrame(const set<Device *>& devices, string basepath, string filename);
178 
184  void renderSingleFrameToBuffer(const set<Device*>& devices, unsigned char* buff, int w = -1, int h = -1);
185 
192  void getPositionFromAss(const set<Device*>& devices);
193 
197  void getBeamPropsFromAss(const set<Device*>& devices);
198 
199  protected:
200  virtual void onRecording() override { setSamples(m_preview_samples); }
201 
202  virtual void onRendering() override { setSamples(m_render_samples); }
207  virtual void loadJSON(const JSONNode data) override;
208 
209  virtual void workerRender(FrameDeviceInfo frame);
210 
211  virtual void createFrameInfoBody(set<Device *> devices, FrameDeviceInfo &frame, bool forceUpdate = false);
212 
213  private:
217 
221 
222  };
223 
224 }
225 
226 #endif
ArnoldAnimationPatch()
Constructs a ArnoldAnimationPatch object.
Definition: ArnoldAnimationPatch.h:51
void render()
Render a frame and pass it back to node.
Definition: Dumiverse.cpp:43
void setSamples(int samples)
Sets the sample rate (n * n per pixel).
Definition: ArnoldPatch.cpp:515
The Arnold Patch object is responsible for the communication between the Arnold renderer and the Lumi...
Definition: ArnoldPatch copy.h:62
A subclass of ArnoldPatch. Instead of interrupting the worker thread every time a new rendering task ...
Definition: ArnoldAnimationPatch.h:44
virtual void update(set< Device * > devices) override
Updates the rendering queue given the list of devices in the rig.
Definition: ArnoldAnimationPatch.cpp:46
void setRenderSamples(int render)
Sets the camera sampling rate for rendering.
Definition: ArnoldAnimationPatch.cpp:113
ArnoldInterface * m_interface
Arnold Interface If we're distributing our rendering this is a DistributedArnoldInterface.
Definition: ArnoldPatch.h:274
void enableContinuousRenderMode()
Enables the continuous rendering of frames in the ArnoldAnimationPatch.
Definition: ArnoldAnimationPatch.cpp:144
virtual void interruptRender()
Stops the working rendering procedure if Arnold is running. Potentially interrupt rendering process i...
Definition: ArnoldAnimationPatch.cpp:83
An implemnetation for frame manager using in-memory buffer.
int getSamples()
Gets the sample rate (n * n per pixel).
Definition: ArnoldPatch.h:170
void getBeamPropsFromAss(const set< Device * > &devices)
Gets color and shape params from arnold.
Definition: ArnoldAnimationPatch.cpp:372
SimulationAnimationMode
Four working modes of SimulationAnimationPatch. INTERACTIVE: Patch renders the latest sent frame with...
Definition: SimulationAnimationPatch.h:28
void getPositionFromAss(const set< Device * > &devices)
Sets the position of the light in terms of spherical coordinates.
Definition: ArnoldAnimationPatch.cpp:299
virtual ~ArnoldAnimationPatch()
Destroys the object.
Definition: ArnoldAnimationPatch.cpp:28
void disableContinuousRenderMode()
Disables continuous rendering of frames in the ArnoldAnimationPatch.
Definition: ArnoldAnimationPatch.cpp:140
An implemnetation for frame manager using in-memory buffer.
Implementation of a patch for Arnold.
A subclass of ArnoldPatch. Instead of interrupting the worker thread every time a new rendering task ...
Definition: SimulationAnimationPatch.h:75
Subclass of ArnoldPatch to render frames of an animation.
int m_render_samples
The camera sampling rate for rendering.
Definition: ArnoldAnimationPatch.h:220
int getPreviewSamples()
Returns the camera sampling rate for preview.
Definition: ArnoldAnimationPatch.h:134
void setPreviewSamples(int preview)
Sets the camera sampling rate for preview.
Definition: ArnoldAnimationPatch.cpp:107
virtual string getType() override
Gets the type of this object.
Definition: ArnoldAnimationPatch.h:80
virtual void rerender()
Manually schedule a re-rendering and make sure the task be inserted into queue.
Definition: ArnoldAnimationPatch.cpp:56
virtual void loadJSON(const JSONNode data) override
Loads data from a parsed JSON object.
Definition: ArnoldAnimationPatch.cpp:34
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
int getRenderSamples()
Returns the camera sampling rate for render.
Definition: ArnoldAnimationPatch.h:139
virtual float getPercentage() const override
Gets the current rendering progress as percentage.
Definition: ArnoldAnimationPatch.cpp:117
int m_preview_samples
The camera sampling rate for preview.
Definition: ArnoldAnimationPatch.h:216
virtual void close() override
Waits for the worker thread and closes the Arnold session.
Definition: ArnoldAnimationPatch.cpp:100
void renderSingleFrameToBuffer(const set< Device * > &devices, unsigned char *buff, int w=-1, int h=-1)
Renders a single frame from the current state of Devices to a buffer.
Definition: ArnoldAnimationPatch.cpp:224
virtual void init() override
Initializes Arnold with function of its parent class and starts a worker thread.
Definition: ArnoldAnimationPatch.cpp:39
void renderSingleFrame(const set< Device * > &devices, string basepath, string filename)
Renders a single frame from the current state of Devices and saves it to the specified filename...
Definition: ArnoldAnimationPatch.cpp:148
Interface between ArnoldPatch and arnold. Almost all arnold APIs are called from this class...
Definition: ArnoldInterface.h:73
ArnoldInterface * getArnoldInterface()
Returns the Arnold interface.
Definition: ArnoldAnimationPatch.h:158