Unigine::Synker::MasterInterface Class
Header: | #include <SynckerInterface.h> |
Inherits: | SynckerInterface |
This class represents the master interface of the Syncker.
Syncker plugin must be loaded.
MasterInterface Class
Members
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.const char * getView(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.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.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.const char * getSlaveView(int num, int display)
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 - Display number.
Return value
Name of the display or projector.void setSyncCAVE(int enabled, Math::vec3 head)
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
- int enabled - 1 to enable synchronization; 0 - to disable it.
- Math::vec3 head - Viewer's head position coordinates.
void setSyncPlayer(int 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
- int enabled - 1 to enable synchronization; 0 - to disable it.
void setSyncRender(int 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
- int enabled - 1 to enable synchronization; 0 - to disable it.
int isSyncCAVE()
Returns a value indicating if synchronization of the viewer's head position is enabled.Return value
1 if synchronization of the viewer's head position is enabled; otherwise, 0.int 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
1 if synchronization of the current player is enabled; otherwise, 0.int 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
1 if synchronization of all render parameters is enabled; otherwise, 0.void addSyncNode(Ptr<Node> node)
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
- Ptr<Node> node - Node to synchronize.
void addSyncNodes(Vector< Ptr<Node> > & nodes)
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< Ptr<Node> > & nodes - Array of nodes to synchronize.
int getNumSyncNodes()
Returns the total number of nodes in the synchronization queue.Return value
Total number of nodes in the synchronization queue.Ptr<Node> 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 node with the given number from the synchronization queue.Arguments
- int num - Node number in the synchronization queue.
void clearSyncNodes()
Removes all nodes from the synchronization queue.void addSyncMaterial(Ptr<Material> 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
- Ptr<Material> material - Material to synchronize.
void addSyncMaterials(Vector< Ptr<Material> > & 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
- Vector< Ptr<Material> > & nodes - Array of materials to synchronize.
int getNumSyncMaterials()
Returns the total number of materials in the synchronization queue.Return value
Total number of materials in the synchronization queue.Ptr<Material> 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.int createNode(Ptr<Node> node, int include_children = 1, int add_to_sync = 1)
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
- Ptr<Node> node - Node to create.
- int include_children - 1 to create the given node with all its children; 0 - to create the given node only. The default value is 1.Create all child nodes.
- int add_to_sync - 1 to add the created node(s) to the synchronization queue; 0 - not to add. The default value is 1.Use 0 if a static node is to be created.
Return value
1 if the node is successfully created on all slaves; otherwise, 0.void deleteNode(Ptr<Node> node, int include_children = 1)
Synchronizes deletion of the given node on all slaves via the TCP protocol.Arguments
- Ptr<Node> node - Node to delete.
- int include_children - 1 to delete the given node with all its children; 0 - to delete the given node only. The default value is 1.
void editorSet(int mask, const String & name, int 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.
- int 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, int 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.
- int 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, int 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.
- int 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)
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.
void setTCPUserReceiveCallback(Unigine::CallbackBase * func)
Sets a callback function to be fired when a TCP user message is received.Arguments
- Unigine::CallbackBase * func - Callback pointer.
void setUDPUserSendCallback(Unigine::CallbackBase * func)
Sets a callback function to be fired when a UDP user message is sent.Arguments
- Unigine::CallbackBase * func - Callback pointer.
void setMasterSetupChangedCallback(Unigine::CallbackBase * func)
Sets a callback function to be fired when master settings (viewport) are changed.Arguments
- Unigine::CallbackBase * func - Callback pointer.
void setSlaveSetupChangedCallback(Unigine::CallbackBase * func)
Sets a callback function to be fired when slave settings (viewport) are changed.Arguments
- Unigine::CallbackBase * func - Callback pointer.
Last update: 04.06.2018
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter