mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 03:00:58 -06:00
Add Lua functions to print cluster id (closes #704)
This commit is contained in:
@@ -65,6 +65,7 @@ public:
|
||||
bool hasGuiWindow() const override;
|
||||
bool isGuiWindow() const override;
|
||||
bool isMaster() const override;
|
||||
int clusterId() const override;
|
||||
bool isUsingSwapGroups() const override;
|
||||
bool isSwapGroupMaster() const override;
|
||||
|
||||
|
||||
@@ -207,6 +207,13 @@ public:
|
||||
*/
|
||||
virtual bool isMaster() const;
|
||||
|
||||
/**
|
||||
* Returns the unique identifier of this OpenSpace instance within the current cluster
|
||||
* configuration. If this instance is not part of a cluster, this value is always 0.
|
||||
* \return The cluster identifier of this OpenSpace instance
|
||||
*/
|
||||
virtual int clusterId() const;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the current rendering window is using swap groups.
|
||||
*/
|
||||
|
||||
@@ -1564,6 +1564,23 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
|
||||
{},
|
||||
"string, string",
|
||||
"Removes a tag (second argument) from a scene graph node (first argument)"
|
||||
},
|
||||
{
|
||||
"isMaster",
|
||||
&luascriptfunctions::isMaster,
|
||||
{},
|
||||
"",
|
||||
"Returns whether the current OpenSpace instance is the master node of a "
|
||||
"cluster configuration. If this instance is not part of a cluster, this "
|
||||
"function also returns 'true'."
|
||||
},
|
||||
{
|
||||
"clusterId",
|
||||
&luascriptfunctions::clusterId,
|
||||
{},
|
||||
"Returns the zero-based identifier for this OpenSpace instance in a "
|
||||
"cluster configuration. If this instance is not part of a cluster, this "
|
||||
"identifier is always 0."
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -262,4 +262,16 @@ int downloadFile(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int isMaster(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::isMaster");
|
||||
ghoul::lua::push(L, OsEng.windowWrapper().isMaster());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int clusterId(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::clusterId");
|
||||
ghoul::lua::push(L, OsEng.windowWrapper().clusterId());
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace openspace::luascriptfunctions
|
||||
|
||||
@@ -217,6 +217,10 @@ bool SGCTWindowWrapper::isMaster() const {
|
||||
return sgct::Engine::instance()->isMaster();
|
||||
}
|
||||
|
||||
int SGCTWindowWrapper::clusterId() const {
|
||||
return sgct_core::ClusterManager::instance()->getThisNodeId();
|
||||
}
|
||||
|
||||
bool SGCTWindowWrapper::isSwapGroupMaster() const {
|
||||
return sgct::Engine::instance()->getCurrentWindowPtr()->isSwapGroupMaster();
|
||||
}
|
||||
|
||||
@@ -145,6 +145,10 @@ bool WindowWrapper::isMaster() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
int WindowWrapper::clusterId() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WindowWrapper::isSwapGroupMaster() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user