Lumiverse
2.5
A framework for creating lighting control applications
|
A subclass of ArnoldPatch. Instead of interrupting the worker thread every time a new rendering task is received, this class keeps all requests in a queue. A worker thread grasps tasks and dumps frame buffer to a ArnoldFrameManager. More...
#include <ArnoldAnimationPatch.h>
Public Types | |
typedef function< void()> | FinishedCallbackFunction |
Public Types inherited from Lumiverse::SimulationAnimationPatch | |
typedef function< void()> | FinishedCallbackFunction |
typedef function< bool(set< Device * >)> | IsUpdateRequiredFunction |
typedef function< void(FrameDeviceInfo &)> | CreateFrameInfoBodyFunction |
typedef function< void()> | InterruptFunction |
typedef function< void()> | ClearUpdateFlagsFunction |
Public Member Functions | |
ArnoldAnimationPatch () | |
Constructs a ArnoldAnimationPatch object. | |
ArnoldAnimationPatch (ArnoldInterface *itf) | |
ArnoldAnimationPatch (const JSONNode data) | |
Constructs ArnoldPatch from JSON data. More... | |
virtual | ~ArnoldAnimationPatch () |
Destroys the object. | |
virtual void | init () override |
Initializes Arnold with function of its parent class and starts a worker thread. | |
virtual string | getType () override |
Gets the type of this object. More... | |
virtual void | update (set< Device * > devices) override |
Updates the rendering queue given the list of devices in the rig. More... | |
virtual void | rerender () |
Manually schedule a re-rendering and make sure the task be inserted into queue. More... | |
virtual void | interruptRender () |
Stops the working rendering procedure if Arnold is running. Potentially interrupt rendering process if the patch is in rendering mode. | |
virtual void | close () override |
Waits for the worker thread and closes the Arnold session. More... | |
void | setPreviewSamples (int preview) |
Sets the camera sampling rate for preview. More... | |
void | setRenderSamples (int render) |
Sets the camera sampling rate for rendering. More... | |
int | getPreviewSamples () |
Returns the camera sampling rate for preview. | |
int | getRenderSamples () |
Returns the camera sampling rate for render. | |
virtual float | getPercentage () const override |
Gets the current rendering progress as percentage. More... | |
virtual void | reset () |
ArnoldInterface * | getArnoldInterface () |
Returns the Arnold interface. | |
void | disableContinuousRenderMode () |
Disables continuous rendering of frames in the ArnoldAnimationPatch. | |
void | enableContinuousRenderMode () |
Enables the continuous rendering of frames in the ArnoldAnimationPatch. More... | |
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. More... | |
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. More... | |
void | getPositionFromAss (const set< Device * > &devices) |
Sets the position of the light in terms of spherical coordinates. More... | |
void | getBeamPropsFromAss (const set< Device * > &devices) |
Gets color and shape params from arnold. | |
Public Member Functions inherited from Lumiverse::SimulationAnimationPatch | |
SimulationAnimationPatch () | |
Constructs a SimulationAnimationPatch object. | |
SimulationAnimationPatch (const JSONNode data) | |
Constructs ArnoldPatch from JSON data. More... | |
virtual | ~SimulationAnimationPatch () |
Destroys the object. | |
void | init () |
Initializes Arnold with function of its parent class and starts a worker thread. | |
virtual void | startRecording () |
Starts recording. Main thread starts to send frame labeled as RECORDING info to worker. | |
virtual void | endRecording () |
Ends recording. Main thread stops to send frame labeled as RECORDING info to worker. It starts to send INTERACTIVE frame instead. | |
virtual void | startInteractive () |
Starts interactive mode. Worker thread can get interrupted. It always takes the most fresh info. | |
virtual SimulationAnimationMode | getMode () |
Returns the mode/state in which the patch is. More... | |
void | update (set< Device * > devices, IsUpdateRequiredFunction isUpdateRequired, InterruptFunction interruptRender, ClearUpdateFlagsFunction clearUpdateFlags) |
Updates the rendering queue given the list of devices in the rig. More... | |
void | close () |
Waits for the worker thread and closes the Arnold session. More... | |
virtual void | reset (InterruptFunction interruptRender) |
Resets the object to its initial state. More... | |
virtual void | stop () |
Stops the patch. More... | |
virtual int | addFinishedCallback (FinishedCallbackFunction func) |
Registers a callback function for parameter changed event. More... | |
virtual void | deleteFinishedCallback (int id) |
Deletes a registered callback for parameter change. More... | |
Public Member Functions inherited from Lumiverse::ArnoldPatch | |
ArnoldPatch () | |
Constructs a DMXPatch object. | |
ArnoldPatch (const JSONNode data) | |
Construct DMXPatch from JSON data. More... | |
virtual | ~ArnoldPatch () |
Destroys the object. | |
virtual JSONNode | toJSON () |
Exports a JSONNode with the data in this patch. More... | |
ArnoldPatch () | |
Constructs a ArnoldPatch object. | |
ArnoldPatch (const JSONNode data) | |
Construct ArnoldPatch from JSON data. More... | |
virtual | ~ArnoldPatch () |
Destroys the object. | |
virtual JSONNode | toJSON () override |
Exports a JSONNode with the data in this patch. More... | |
virtual int | getWidth () |
Gets the width of result. More... | |
virtual int | getHeight () |
Gets the height of result. More... | |
virtual float * | getBufferPointer () |
Gets the pointer to the frame buffer. More... | |
bool | setDims (int w, int h) |
Sets the width and height of the resulting image. | |
size_t | getBufferSize () |
int | getSamples () |
Gets the sample rate (n * n per pixel). More... | |
void | setSamples (int samples) |
Sets the sample rate (n * n per pixel). More... | |
void | forceInterrupt () |
Forcefully stops the current arnold render function. | |
virtual BucketPositionInfo * | getBucketPositionInfo () const |
Gets the current bucket for each worker thread. More... | |
virtual size_t | getBucketNumber () const |
Gets number of buckets rendered simultanously. This is usually the number of threads supported by hardware. More... | |
void | setArnoldInterface (ArnoldInterface *arnold_interface) |
Set the interface we're using Set the ArnoldInterface reference we're using to perform rendering. This is usually either an ArnoldInterface, or a DistributedArnoldInterface. | |
virtual bool | renderLoop (const std::set< Device * > &devices) |
Calls Arnold render function on a set of devices. This function runs in a separate thread. | |
virtual bool | renderLoop () |
Calls Arnold render function. This function runs in a separate thread. | |
void | setAssFile (std::string assFile) |
Set the path to this patch's ass. More... | |
virtual void | setOptionParameter (std::string paramName, int val) |
Set global arnold options on the interface. | |
virtual void | setOptionParameter (std::string paramName, float val) |
void | updateLight (set< Device * > devices) |
Resets the arnold light node with updated parameters of deices. This function updates light node for renderer. More... | |
Public Member Functions inherited from Lumiverse::SimulationPatch | |
SimulationPatch () | |
Constructs a SimulationPatch object. | |
SimulationPatch (const JSONNode data) | |
Construct SimulationPatch from JSON data. More... | |
virtual | ~SimulationPatch () |
Destroys the object. | |
virtual void | deleteDevice (string id) |
Called when a device is deleted from the Rig. More... | |
virtual void | onDeviceChanged (Device *d) |
Callback function for devices. More... | |
virtual bool | isUpdateRequired (set< Device * > devices) |
Checks if any device connected with this patch has updated parameters or metadata. More... | |
virtual void | clearUpdateFlags () |
Resets the update flags for lights. | |
Public Member Functions inherited from Lumiverse::Patch | |
virtual | ~Patch () |
Virtual destructor. | |
Protected Member Functions | |
virtual void | onRecording () override |
virtual void | onRendering () override |
virtual void | loadJSON (const JSONNode data) override |
Loads data from a parsed JSON object. More... | |
virtual void | workerRender (FrameDeviceInfo frame) |
virtual void | createFrameInfoBody (set< Device * > devices, FrameDeviceInfo &frame, bool forceUpdate=false) |
Protected Member Functions inherited from Lumiverse::SimulationAnimationPatch | |
void | loadJSON (const JSONNode data) |
Loads data from a parsed JSON object. More... | |
virtual void | workerLoop () |
Worker loop. More... | |
virtual void | onWorkerFinished () |
Helper to call all the registered callbacks for rendering finished event. | |
virtual void | createFrameInfoHeader (FrameDeviceInfo &frame) |
virtual void | enqueueFrameInfo (const FrameDeviceInfo &frame) |
Protected Member Functions inherited from Lumiverse::ArnoldPatch | |
virtual void | loadLight (Device *d_ptr) override |
Loads a arnold light node. This function is also used to update a light node. More... | |
void | updateLightPredictive (set< Device * > devices) |
Resets the arnold light node and surface with updated parameters of deices. Experiment with methods from Picture Perfect RGB rendering. More... | |
Protected Member Functions inherited from Lumiverse::SimulationPatch | |
virtual void | bindRenderLoop () |
Private Attributes | |
int | m_preview_samples |
The camera sampling rate for preview. | |
int | m_render_samples |
The camera sampling rate for rendering. | |
Additional Inherited Members | |
Protected Attributes inherited from Lumiverse::SimulationAnimationPatch | |
std::thread * | m_worker |
std::mutex | m_queue |
std::vector< FrameDeviceInfo > | m_queuedFrameDeviceInfo |
std::chrono::time_point< std::chrono::system_clock > | m_startPoint |
SimulationAnimationMode | m_mode |
Indicates the mode of SimulationAnimationPatch. | |
map< int, FinishedCallbackFunction > | m_onFinishedFunctions |
The list for callback functions. | |
Protected Attributes inherited from Lumiverse::ArnoldPatch | |
ArnoldInterface * | m_interface |
Arnold Interface If we're distributing our rendering this is a DistributedArnoldInterface. | |
Protected Attributes inherited from Lumiverse::SimulationPatch | |
map< string, SimulationLightRecord * > | m_lights |
A list contains infos about if a light is updated. | |
std::atomic_flag | m_interrupt_flag |
std::thread * | m_renderloop |
The separate thread running the render loop. | |
A subclass of ArnoldPatch. Instead of interrupting the worker thread every time a new rendering task is received, this class keeps all requests in a queue. A worker thread grasps tasks and dumps frame buffer to a ArnoldFrameManager.
Lumiverse::ArnoldAnimationPatch::ArnoldAnimationPatch | ( | const JSONNode | data | ) |
Constructs ArnoldPatch from JSON data.
data | JSONNode containing the ArnoldAnimationPatch object data. |
|
overridevirtual |
Waits for the worker thread and closes the Arnold session.
The main thread sends a special frame info at the beginning of this function. (a info with devices list only containning a NULL) Then the thread would wait to join the worker thread. After all there are done, closes the arnold session as the parent class.
Reimplemented from Lumiverse::ArnoldPatch.
void Lumiverse::ArnoldAnimationPatch::enableContinuousRenderMode | ( | ) |
Enables the continuous rendering of frames in the ArnoldAnimationPatch.
This is the default mode of operation for an ArnoldAnimationPatch.
|
overridevirtual |
Gets the current rendering progress as percentage.
The value returned may not be the accurate number due to concurrency. Also the accuracy is limited to number of frame.
Reimplemented from Lumiverse::ArnoldPatch.
void Lumiverse::ArnoldAnimationPatch::getPositionFromAss | ( | const set< Device * > & | devices | ) |
Sets the position of the light in terms of spherical coordinates.
Note that this function will lock the lights in their positions, and if you want to move them, you must manually unlock them and define the look at points for lights that can move.
|
inlineoverridevirtual |
Gets the type of this object.
Reimplemented from Lumiverse::ArnoldPatch.
|
overrideprotectedvirtual |
Loads data from a parsed JSON object.
data | JSON data to load |
Reimplemented from Lumiverse::ArnoldPatch.
void Lumiverse::ArnoldAnimationPatch::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.
This function will block while the frame is rendering.
void Lumiverse::ArnoldAnimationPatch::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.
Buffer format is RGBA 32-bit, buffer return order is RGBA
|
virtual |
Manually schedule a re-rendering and make sure the task be inserted into queue.
This new rendering task may not be done immediately, but it will get inserted.
Reimplemented from Lumiverse::SimulationPatch.
void Lumiverse::ArnoldAnimationPatch::setPreviewSamples | ( | int | preview | ) |
Sets the camera sampling rate for preview.
Although it's possible to set the rate to a large number. It's not recommended.
preview | The camera sampling rate for preview. |
void Lumiverse::ArnoldAnimationPatch::setRenderSamples | ( | int | render | ) |
Sets the camera sampling rate for rendering.
Although it's possible to set the rate to a small number. It's not recommended.
render | The camera sampling rate for rendering. |
|
overridevirtual |
Updates the rendering queue given the list of devices in the rig.
Before enqueuing the rendering info, main thread checks if there is any parameter or metadata changed during last update interval. It only adds a new request when it's truly necessary.
Reimplemented from Lumiverse::ArnoldPatch.