Lumiverse  2.5
A framework for creating lighting control applications
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Lumiverse::SimulationPatch Class Referenceabstract

The Arnold Patch object is responsible for the communication between the Arnold renderer and the Lumiverse devices. The major part of communication is done with help of an ArnoldInterface object. SimulationPatch handles parsing Json and passing info to ArnoldInterface. More...

#include <SimulationPatch.h>

Inheritance diagram for Lumiverse::SimulationPatch:
Inheritance graph
[legend]
Collaboration diagram for Lumiverse::SimulationPatch:
Collaboration graph
[legend]

Public Member Functions

 SimulationPatch ()
 Constructs a SimulationPatch object.
 
 SimulationPatch (const JSONNode data)
 Construct SimulationPatch from JSON data. More...
 
virtual ~SimulationPatch ()
 Destroys the object.
 
virtual void update (set< Device * > devices)
 Updates the rendering given the list of devices in the rig. More...
 
virtual void init ()
 Initializes Arnold with ArnoldInterface.
 
virtual void close ()
 Closes the Arnold session.
 
virtual JSONNode toJSON ()
 Exports a JSONNode with the data in this patch. More...
 
virtual string getType ()
 Gets the type of this object. More...
 
virtual void deleteDevice (string id)
 Called when a device is deleted from the Rig. More...
 
virtual int getWidth ()=0
 Gets the width of result. More...
 
virtual int getHeight ()=0
 Gets the height of result. More...
 
virtual float * getBufferPointer ()
 Gets the pointer to the frame buffer. More...
 
virtual void interruptRender ()
 Stops the working rendering procedure if Arnold is running.
 
virtual void onDeviceChanged (Device *d)
 Callback function for devices. More...
 
virtual void rerender ()
 Manually schedule a re-rendering. 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 updateLight (set< Device * > devices)=0
 Gets the progress of current frame in percentage. More...
 
virtual void loadLight (Device *d_ptr)=0
 Loads a arnold light node. This function is also used to update a light node. More...
 
virtual void loadJSON (const JSONNode data)
 Loads data from a parsed JSON object. More...
 
virtual bool renderLoop ()=0
 Calls Arnold render function. This function runs in a separate thread.
 
virtual void bindRenderLoop ()
 

Protected Attributes

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.
 

Detailed Description

The Arnold Patch object is responsible for the communication between the Arnold renderer and the Lumiverse devices. The major part of communication is done with help of an ArnoldInterface object. SimulationPatch handles parsing Json and passing info to ArnoldInterface.

See also
ArnoldInterface, DistributedArnoldInterface, ArnoldAnimationPatch

Constructor & Destructor Documentation

Lumiverse::SimulationPatch::SimulationPatch ( const JSONNode  data)

Construct SimulationPatch from JSON data.

Parameters
dataJSONNode containing the SimulationPatch object data.

Member Function Documentation

void Lumiverse::SimulationPatch::deleteDevice ( string  id)
virtual

Called when a device is deleted from the Rig.

Patches should clean up information about the device in question.

Implements Lumiverse::Patch.

virtual float* Lumiverse::SimulationPatch::getBufferPointer ( )
inlinevirtual

Gets the pointer to the frame buffer.

Returns
The pointer to the frame buffer.

Reimplemented in Lumiverse::ArnoldPatch.

virtual int Lumiverse::SimulationPatch::getHeight ( )
pure virtual

Gets the height of result.

Returns
The height of result

Implemented in Lumiverse::ArnoldPatch.

virtual string Lumiverse::SimulationPatch::getType ( )
inlinevirtual

Gets the type of this object.

Returns
String containing "SimulationPatch"

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldPatch, Lumiverse::ArnoldPatch, and Lumiverse::ArnoldAnimationPatch.

virtual int Lumiverse::SimulationPatch::getWidth ( )
pure virtual

Gets the width of result.

Returns
The width of result

Implemented in Lumiverse::ArnoldPatch.

bool Lumiverse::SimulationPatch::isUpdateRequired ( set< Device * >  devices)
virtual

Checks if any device connected with this patch has updated parameters or metadata.

Parameters
devicesThe device list.
Returns
If there is any update.
void Lumiverse::SimulationPatch::loadJSON ( const JSONNode  data)
protectedvirtual

Loads data from a parsed JSON object.

Parameters
dataJSON data to load

Reimplemented in Lumiverse::ArnoldPatch, Lumiverse::ArnoldAnimationPatch, and Lumiverse::ArnoldPatch.

virtual void Lumiverse::SimulationPatch::loadLight ( Device d_ptr)
protectedpure virtual

Loads a arnold light node. This function is also used to update a light node.

Parameters
d_ptrThe device with updated parameters.

Implemented in Lumiverse::ArnoldPatch, and Lumiverse::ArnoldPatch.

void Lumiverse::SimulationPatch::onDeviceChanged ( Device d)
virtual

Callback function for devices.

This function is registered to all devices by the rig. Only devices in the list will change the state of patch.

Parameters
dThe device which calls this function.
void Lumiverse::SimulationPatch::rerender ( )
virtual

Manually schedule a re-rendering.

This new rendering task may not be done immediately. This function just sets on the flag for rendering.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

JSONNode Lumiverse::SimulationPatch::toJSON ( )
virtual

Exports a JSONNode with the data in this patch.

Returns
JSONNode containing the SimulationPatch object

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldPatch, and Lumiverse::ArnoldPatch.

void Lumiverse::SimulationPatch::update ( set< Device * >  devices)
virtual

Updates the rendering given the list of devices in the rig.

The list of devices should be maintained outside of this class. This function would potentially interrupt the rendering and restart with new parameters.

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldPatch, Lumiverse::ArnoldAnimationPatch, and Lumiverse::ArnoldPatch.

virtual void Lumiverse::SimulationPatch::updateLight ( set< Device * >  devices)
protectedpure virtual

Gets the progress of current frame in percentage.

Returns
The percent.

Resets the arnold light node with updated parameters of deices. This function updates light node for renderer.

Parameters
devicesThe device list.

Implemented in Lumiverse::ArnoldPatch, and Lumiverse::ArnoldPatch.


The documentation for this class was generated from the following files: