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

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. ArnoldPatch handles parsing Json and passing info to ArnoldInterface. More...

#include <ArnoldPatch copy.h>

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

Public Member Functions

 ArnoldPatch ()
 Constructs a DMXPatch object.
 
 ArnoldPatch (const JSONNode data)
 Construct DMXPatch from JSON data. More...
 
virtual ~ArnoldPatch ()
 Destroys the object.
 
virtual void update (set< Device * > devices)
 Updates the values sent to the DMX network given the list of devices in the rig. More...
 
virtual void init ()
 Initializes connections and other network settings for the patch. More...
 
virtual void close ()
 Closes connections to the interfaces.
 
virtual JSONNode toJSON ()
 Exports a JSONNode with the data in this patch. More...
 
virtual string getType ()
 Gets the type of this object. More...
 
 ArnoldPatch ()
 Constructs a ArnoldPatch object.
 
 ArnoldPatch (const JSONNode data)
 Construct ArnoldPatch from JSON data. More...
 
virtual ~ArnoldPatch ()
 Destroys the object.
 
virtual void update (set< Device * > devices)
 Updates the rendering given the list of devices in the rig. More...
 
virtual void init () override
 Initializes Arnold with ArnoldInterface.
 
virtual void close () override
 Closes the Arnold session.
 
virtual JSONNode toJSON () override
 Exports a JSONNode with the data in this patch. More...
 
virtual string getType () override
 Gets the type of this object. 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...
 
virtual void interruptRender () override
 Stops the working rendering procedure if Arnold is running.
 
void forceInterrupt ()
 Forcefully stops the current arnold render function.
 
virtual float getPercentage () const
 Gets the progress of current frame in percentage. More...
 
virtual BucketPositionInfogetBucketPositionInfo () 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 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 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...
 
virtual void loadJSON (const JSONNode data) override
 Loads data from a parsed JSON object. More...
 
- Protected Member Functions inherited from Lumiverse::SimulationPatch
virtual void bindRenderLoop ()
 

Protected Attributes

ArnoldInterfacem_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.
 

Private Member Functions

void setArrayParameter (AtNode *light_ptr, const std::string &paramName, const std::string &value)
 
void setParameter (AtNode *light_ptr, const std::string &paramName, const std::string &value)
 
template<size_t D, typename T >
void setSingleParameter (AtNode *node, const std::string &paramName, const std::string &value, union AiNodeSet< T > aiNodeSet) const
 
template<size_t D, typename T , class C >
void setArrayParameter (AtNode *node, const std::string &paramName, const std::string &value, bool(*AiArraySet)(AtArray *, AtUInt32, C, const char *, int), const int AiType) const
 
bool updateLight (set< Device * > devices)
 Gets the progress of current frame in percentage. More...
 
void loadJSON (const JSONNode data)
 Loads data from a parsed JSON object. More...
 
template<size_t D, typename T >
void parseArnoldParameter (const std::string &value, ArnoldParameterVector< D, T > &vector) const
 
void loadArnoldParam (const JSONNode data, ArnoldParam &param)
 
void loadLight (Device *d_ptr)
 Loads a arnold light node. This function is also used to update a light node. More...
 
void modifyLightColor (Device *d, Eigen::Vector3d white)
 Modifies light color according to Picture Perfect RGB Rendering Using Spectral Prefiltering and Sharp Color Primaries. More...
 
bool useDistributedRendering (JSONNode patch)
 Check if an Arnold patch should use distributed rendering. More...
 
bool cacheRendering (const JSONNode data)
 Check if an Arnold patch should used cached rendering. More...
 

Private Attributes

map< string, AtNode * > m_lights
 
map< string, ArnoldParamm_arnold_params
 
std::string m_ass_file
 
bool m_using_distributed = false
 Are we using a distributed renderer with this patch.
 
bool m_rendering
 Internal flag used to ensure thread safety.
 
bool _caching
 Internal flag used to see if cached rendering is being used.
 

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. ArnoldPatch handles parsing Json and passing info to ArnoldInterface.

See also
ArnoldInterface, ArnoldAnimationPatch

Constructor & Destructor Documentation

Lumiverse::ArnoldPatch::ArnoldPatch ( const JSONNode  data)

Construct DMXPatch from JSON data.

Parameters
dataJSONNode containing the DMXPatch object data.
Lumiverse::ArnoldPatch::ArnoldPatch ( const JSONNode  data)

Construct ArnoldPatch from JSON data.

Parameters
dataJSONNode containing the ArnoldPatch object data.

Member Function Documentation

bool Lumiverse::ArnoldPatch::cacheRendering ( const JSONNode  data)
private

Check if an Arnold patch should used cached rendering.

Parameters
JSONNodecontaining patch
See also
loadPatches(), useDistributedRendering()
virtual size_t Lumiverse::ArnoldPatch::getBucketNumber ( ) const
inlinevirtual

Gets number of buckets rendered simultanously. This is usually the number of threads supported by hardware.

Returns
The number of buckets rendered simultanously.
virtual BucketPositionInfo* Lumiverse::ArnoldPatch::getBucketPositionInfo ( ) const
inlinevirtual

Gets the current bucket for each worker thread.

Returns
An array of current buckets.
virtual float* Lumiverse::ArnoldPatch::getBufferPointer ( )
inlinevirtual

Gets the pointer to the frame buffer.

Returns
The pointer to the frame buffer.

Reimplemented from Lumiverse::SimulationPatch.

virtual int Lumiverse::ArnoldPatch::getHeight ( )
inlinevirtual

Gets the height of result.

Returns
The height of result

Implements Lumiverse::SimulationPatch.

virtual float Lumiverse::ArnoldPatch::getPercentage ( ) const
inlinevirtual

Gets the progress of current frame in percentage.

Returns
The percent.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

int Lumiverse::ArnoldPatch::getSamples ( )
inline

Gets the sample rate (n * n per pixel).

Returns
The number of AA samples.
virtual string Lumiverse::ArnoldPatch::getType ( )
inlinevirtual

Gets the type of this object.

Returns
String containing "DMXPatch"

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

virtual string Lumiverse::ArnoldPatch::getType ( )
inlineoverridevirtual

Gets the type of this object.

Returns
String containing "ArnoldPatch"

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

virtual int Lumiverse::ArnoldPatch::getWidth ( )
inlinevirtual

Gets the width of result.

Returns
The width of result

Implements Lumiverse::SimulationPatch.

void Lumiverse::ArnoldPatch::init ( )
virtual

Initializes connections and other network settings for the patch.

Call this AFTER all interfaces have been assigned. May need to call again if interfaces change.

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

void Lumiverse::ArnoldPatch::loadJSON ( const JSONNode  data)
privatevirtual

Loads data from a parsed JSON object.

Parameters
dataJSON data to load

Reimplemented from Lumiverse::SimulationPatch.

virtual void Lumiverse::ArnoldPatch::loadJSON ( const JSONNode  data)
overrideprotectedvirtual

Loads data from a parsed JSON object.

Parameters
dataJSON data to load

Reimplemented from Lumiverse::SimulationPatch.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

void Lumiverse::ArnoldPatch::loadLight ( Device d_ptr)
privatevirtual

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

Parameters
d_ptrThe device with updated parameters.

Implements Lumiverse::SimulationPatch.

virtual void Lumiverse::ArnoldPatch::loadLight ( Device d_ptr)
overrideprotectedvirtual

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

Parameters
d_ptrThe device with updated parameters.

Implements Lumiverse::SimulationPatch.

void Lumiverse::ArnoldPatch::modifyLightColor ( Device d,
Eigen::Vector3d  white 
)
private

Modifies light color according to Picture Perfect RGB Rendering Using Spectral Prefiltering and Sharp Color Primaries.

Parameters
dThe device representing the light.
whiteThe white spot in sharp RGB. (currently not used)
void Lumiverse::ArnoldPatch::setAssFile ( std::string  assFile)
inline

Set the path to this patch's ass.

Parameters
Thepath to this patch's ass
void Lumiverse::ArnoldPatch::setSamples ( int  samples)

Sets the sample rate (n * n per pixel).

Parameters
samplesThe number of AA samples.
JSONNode Lumiverse::ArnoldPatch::toJSON ( )
virtual

Exports a JSONNode with the data in this patch.

Returns
JSONNode containing the DMXPatch object

Implements Lumiverse::Patch.

virtual JSONNode Lumiverse::ArnoldPatch::toJSON ( )
overridevirtual

Exports a JSONNode with the data in this patch.

Returns
JSONNode containing the ArnoldPatch object

Implements Lumiverse::Patch.

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

Updates the values sent to the DMX network given the list of devices in the rig.

The list of devices should be maintained outside of this class.

Implements Lumiverse::Patch.

Reimplemented in Lumiverse::ArnoldAnimationPatch.

virtual void Lumiverse::ArnoldPatch::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::ArnoldAnimationPatch.

void Lumiverse::ArnoldPatch::updateLight ( set< Device * >  devices)
privatevirtual

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.

Implements Lumiverse::SimulationPatch.

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

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

Parameters
devicesThe device list.

Implements Lumiverse::SimulationPatch.

void Lumiverse::ArnoldPatch::updateLightPredictive ( set< Device * >  devices)
protected

Resets the arnold light node and surface with updated parameters of deices. Experiment with methods from Picture Perfect RGB rendering.

Parameters
devicesThe device list.
bool Lumiverse::ArnoldPatch::useDistributedRendering ( JSONNode  patch)
private

Check if an Arnold patch should use distributed rendering.

Parameters
JSONNodecontaining a Patch
See also
loadPatches(), cacheRendering()

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