Unigine::Plugins::Syncker::Master Class
Header: | #include <UnigineSyncker.h> |
Inherits: | Syncker |
This class represents the master interface of the Syncker.
Syncker plugin must be loaded.
Master Class
Members
bool setBroadcast ( const char * address, int port ) #
Sets a new broadcast address and port to be used for sending packets from the Master to Slaves.Arguments
- const char * address - IP address to be used: x.x.x.x. The default value is: 127.255.255.255.
- int port - Port to be used.
void setUdpSendSize ( int size ) #
Sets the maximum size of a UDP packet to be sent.Arguments
- int size - UDP packet size, in bytes. The default value is 1432.
int getUdpSendSize ( ) #
Sets the maximum size of a UDP packet to be sent.Return value
UDP packet size, in bytes. The default value is 1432.int getNumSlaves ( ) #
Returns the total number of the slaves connected to the master.Return value
Total number of slaves connected to the master.String getSlaveName ( int num ) #
Returns the name of the given slave computer. The default name is unknown (if not set).Arguments
- int num - Slave number.
Return value
Slave name.String getSlaveAddress ( int num ) #
Returns the network address of the given slave computer.Arguments
- int num - Slave number.
Return value
Network address of the slave computer.int getSlavePort ( int num ) #
Returns the TCP port of the given slave computer.Arguments
- int num - Slave number.
Return value
TCP port of the slave computer.String getSlaveWorldName ( int num ) #
Returns the name of the world file currently loaded on the specified slave.Arguments
- int num - Slave number.
Return value
Name of the world file currently loaded on the specified slave.const char * getSlaveView ( int num, int display_num ) #
Returns the name of the display or projector stored in the configuration file and assigned to the given display of the given slave computer.Arguments
- int num - Slave number.
- int display_num - Display number.
Return value
Name of the display or projector.void setSyncPlayer ( bool enabled ) #
Enables synchronization of the current player's parameters via the UDP protocol:- Its transformation
- Projection matrix
- Viewport mask
- Mask for reflections
- Applied post-materials (if any)
Current player synchronization is used only when all slaves use the same camera.
Arguments
- bool enabled - true to enable synchronization; false - to disable it.
void setSyncCAVE ( bool enabled, Math::vec3 position ) #
Enables synchronization of the viewer's head position via the UDP protocol.If viewer's head position is tracked, this method must me called every update().
Arguments
- bool enabled - true to enable synchronization; false - to disable it.
- Math::vec3 position - Viewer's head position coordinates.
void setSyncRender ( bool enabled ) #
Enables synchronization of all render parameters via the UDP protocol: light scattering, occlusion, etc.When all slaves use the same rendering settings, synchronization of render parameters can be disabled.
Arguments
- bool enabled - true to enable synchronization; false - to disable it.
bool isSyncPlayer ( ) #
Returns a value indicating if synchronization of the current player is enabled.Current player synchronization is used only when all slaves use the same camera.
Return value
true if synchronization of the current player is enabled; otherwise, false.bool isSyncCAVE ( ) #
Returns a value indicating if synchronization of the viewer's head position is enabled.Return value
true if synchronization of the viewer's head position is enabled; otherwise, false.bool isSyncRender ( ) #
Returns a value indicating if synchronization of all render parameters is enabled.When all slaves use the same rendering settings, synchronization of render parameters can be disabled.
Return value
true if synchronization of all render parameters is enabled; otherwise, false.void addSyncNode ( const NodePtr & node, unsigned char sync_mask = ~0 ) #
Enables synchronization of parameters of the given node via the UDP protocol.Scene nodes are not synchronized by default, this method is used to add a particular node to the synchronization queue.
Arguments
- const NodePtr & node - Node to synchronize.
- unsigned char sync_mask - Synchronization mask.
void addSyncNodes ( Vector< NodePtr > & nodes, unsigned char sync_mask = ~0 ) #
Enables synchronization of parameters of given nodes via the UDP protocol.Scene nodes are not synchronized by default, this method is used to add particular nodes to the synchronization queue.
Arguments
- Vector< NodePtr > & nodes - Array of nodes to synchronize.
- unsigned char sync_mask - Synchronization mask.
unsigned char getSyncNodeMask ( const NodePtr & node ) #
Returns the synchronization mask for the specified node.Arguments
- const NodePtr & node - Node, for which a syncronization mask is to be found.
Return value
Synchronization mask of the specified node.bool isSyncNode ( const NodePtr & node ) #
Returns a value indicating if synchronization of the given node is enabled. Using this method you can quickly check if a node is monitored by the Syncker (node's states are dispatched to Slaves over the network).Arguments
- const NodePtr & node - Node to be checked.
Return value
true if synchronization of the given node is enabled; otherwise, false.int getNumSyncNodes ( ) #
Returns the total number of nodes in the synchronization queue.Return value
Total number of nodes in the synchronization queue.NodePtr getSyncNode ( int num ) #
Returns the synchronized node with the given number.Arguments
- int num - Node number in the synchronization queue.
Return value
Synchronized node.void removeSyncNode ( int num ) #
Removes the specified node from the synchronization queue.Arguments
- int num - Node number in the synchronization queue.
void clearSyncNodes ( ) #
Removes all nodes from the synchronization queue.void addSyncMaterial ( const MaterialPtr & material ) #
Enables synchronization of the given material via the UDP protocol.Scene materials are not synchronized by default, this method is used to add a particular material to the synchronization queue.
Arguments
- const MaterialPtr & material - Material to synchronize.
void addSyncMaterials ( const Vector< MaterialPtr > & nodes ) #
Enables synchronization of given materials via the UDP protocol.Scene materials are not synchronized by default, this method is used to add particular materials to the synchronization queue.
Arguments
- const Vector< MaterialPtr > & nodes - Array of materials to synchronize.
bool isSyncMaterial ( const MaterialPtr & mat ) #
Returns a value indicating if synchronization of the given material is enabled. Using this method you can quickly check if a material is monitored by the Syncker (material's states are dispatched to Slaves over the network).Arguments
- const MaterialPtr & mat - Material to be checked.
Return value
true if synchronization of the given material is enabled; otherwise, false.int getNumSyncMaterials ( ) #
Returns the total number of materials in the synchronization queue.Return value
Total number of materials in the synchronization queue.MaterialPtr getSyncMaterial ( int num ) #
Returns the synchronized material with the given number.Arguments
- int num - Material number in the synchronization queue.
Return value
Synchronized material.void removeSyncMaterial ( int num ) #
Removes the material with the given number from the synchronization queue.Arguments
- int num - Material number in the synchronization queue.
void clearSyncMaterials ( ) #
Removes all materials from the synchronization queue.bool createNode ( const NodePtr & node, bool include_children = true, bool add_to_sync = true, unsigned char sync_mask = ~0 ) #
Synchronizes creation of the given node on all slaves via the TCP protocol.This method is to be called after node creation on the master.
Arguments
- const NodePtr & node - Node to create.
- bool include_children - true to create the given node with all its children; false - to create the given node only. The default value is 1.Create all child nodes.
- bool add_to_sync - true to add the created node(s) to the synchronization queue; false - not to add. The default value is 1.
Use false if a static node is to be created.
- unsigned char sync_mask - Synchronization mask.
Return value
true if the node is successfully created on all slaves; otherwise, true.bool isNodeCreated ( const NodePtr & node ) #
Returns a value indicating if the given node was created via the createNode() method. Using this method you can quickly check if a node is in the run-time objects creation buffer.Arguments
- const NodePtr & node - Node to be checked.
Return value
true if if the given node was created via the createNode() method; otherwise, false.void deleteNode ( const NodePtr & node, bool include_children = 1 ) #
Synchronizes deletion of the given node on all slaves via the TCP protocol.Arguments
- const NodePtr & node - Node to delete.
- bool include_children - true to delete the given node with all its children; 0 - to delete the given node only. The default value is false.
void editorSet ( int mask, const String & name, Variable value ) #
Sets an editor script variable value for slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, for which variables should be set. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the variable in the editor script.
- Variable value - Value to be set.
void editorCall ( int mask, const String & name, Vector< Variable > & args ) #
Calls an editor script function on slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function in the editor script.
- Vector< Variable > & args - Array of arguments to be passed (passing up to 6 arguments is supported).
void editorStream ( int mask, const String & name, const BlobPtr & buffer ) #
Calls a function that receives a buffer as an argument on the slaves specified by the mask. The buffer contains the states of the slave displays.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function.
- const BlobPtr & buffer - Buffer with states of the displays that need to be passed to the function.
void systemSet ( int mask, const String & name, Variable value ) #
Sets a system script variable value for slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, for which a variable should be set. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the variable in the system script.
- Variable value - Value to be set.
void systemCall ( int mask, const String & name, Vector< Variable > & args ) #
Calls a system script function on slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function in the system script.
- Vector< Variable > & args - Array of arguments to be passed (passing up to 6 arguments is supported).
void systemStream ( int mask, const String & name, const BlobPtr & buffer ) #
Calls a function that receives a buffer as an argument on the slaves specified by the mask. The buffer contains the states of the slave displays.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function.
- const BlobPtr & buffer - Buffer with states of the displays that need to be passed to the function.
void worldSet ( int mask, const String & name, Variable value ) #
Sets a world script variable value for slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, for which a variable should be set. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the variable in the world script.
- Variable value - Value to be set.
void worldCall ( int mask, const String & name, Vector< Variable > & args ) #
Calls a world script function on slaves defined in a mask.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function in the world script.
- Vector< Variable > & args - Array of arguments to be passed (passing up to 6 arguments is supported).
void worldStream ( int mask, const String & name, const BlobPtr & buffer ) #
Calls a function that receives a buffer as an argument on the slaves specified by the mask. The buffer contains the states of the slave displays.Arguments
- int mask - Bit mask, that defines slaves, on which a function should be called. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const String & name - Name of the function.
- const BlobPtr & buffer - Buffer with states of the displays that need to be passed to the function.
void waitSlaves ( int slaves_count, float timeout = 10.0f ) #
Sets Syncker to standby mode, for the specified minimum number of slaves to connect.Synchronization is suspended until the specified number of slaves are connected. If some of the connected slaves have a world, that differs from the one loaded by the master, they are forced to load the same. Synchronization resumes as the last slave reports that the world was loaded.
Arguments
- int slaves_count - Minimum number of slaves to be connected.
- float timeout - Timeout value for loading the world on all slaves, in seconds. The default value is 10.0.
void setSlavePlayer ( int mask, const PlayerPtr & player ) #
Sets the specified player for all slave computers specified by the mask.Syncronization of the main master camera is disabled.
Arguments
- int mask - Bit mask, that defines slaves, on which the specified player is to be set. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const PlayerPtr & player - Player to be set.
void sendTCPUser ( int mask, const BlobPtr & message ) #
Sends a user message contained in the specified buffer to the specified slave(s) via the TCP protocol.Arguments
- int mask - Bit mask, that defines slaves, to which a message is to be sent. Use ~0 for all slaves.
Each bit of the mask corresponds to a slave. To specify certain slave use: 1 << slave_number
- const BlobPtr & message - Buffer, containing a user message.
Last update:
2019-12-25
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)