mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Adding Lua function to toggle the SGCT render information overlay
This commit is contained in:
@@ -76,6 +76,8 @@ public:
|
||||
|
||||
float globalOpacity();
|
||||
void setGlobalOpacity(float opacity);
|
||||
|
||||
void setSGCTRenderStatistics(bool visible);
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
@@ -114,6 +116,7 @@ private:
|
||||
float _fadeDuration;
|
||||
float _currentFadeTime;
|
||||
int _fadeDirection;
|
||||
bool _sgctRenderStatisticsVisible;
|
||||
|
||||
bool _visualizeABuffer;
|
||||
ABufferVisualizer* _visualizer;
|
||||
|
||||
@@ -149,6 +149,23 @@ namespace openspace {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* showSGCTRenderStatistics(bool):
|
||||
* Set the rendering of the SGCTRenderStatistics
|
||||
*/
|
||||
int showSGCTRenderStatistics(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1)
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
|
||||
const int type = lua_type(L, -1);
|
||||
if (type != LUA_TBOOLEAN)
|
||||
return luaL_error(L, "Expected argument of type 'bool'");
|
||||
bool b = lua_toboolean(L, -1) != 0;
|
||||
OsEng.renderEngine()->setSGCTRenderStatistics(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* visualizeABuffer(bool):
|
||||
@@ -214,7 +231,7 @@ namespace openspace {
|
||||
, _fadeDuration(2.f)
|
||||
, _currentFadeTime(0.f)
|
||||
, _fadeDirection(0)
|
||||
|
||||
, _sgctRenderStatisticsVisible(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -367,6 +384,7 @@ namespace openspace {
|
||||
|
||||
void RenderEngine::postSynchronizationPreDraw()
|
||||
{
|
||||
sgct::Engine::instance()->setStatsGraphVisibility(_sgctRenderStatisticsVisible);
|
||||
//temporary fade funtionality
|
||||
if (_fadeDirection != 0){
|
||||
if (_currentFadeTime > _fadeDuration){
|
||||
@@ -733,6 +751,12 @@ namespace openspace {
|
||||
"bool",
|
||||
"Toggles the showing of render information on-screen text"
|
||||
},
|
||||
{
|
||||
"showSGCTRenderStatistics",
|
||||
&luascriptfunctions::showSGCTRenderStatistics,
|
||||
"bool",
|
||||
"Toggles the visibility of the SGCT rendering information"
|
||||
},
|
||||
{
|
||||
"setPerformanceMeasurement",
|
||||
&luascriptfunctions::setPerformanceMeasurement,
|
||||
@@ -894,4 +918,8 @@ void RenderEngine::changeViewPoint(std::string origin) {
|
||||
|
||||
}
|
||||
|
||||
void RenderEngine::setSGCTRenderStatistics(bool visible) {
|
||||
_sgctRenderStatisticsVisible = visible;
|
||||
}
|
||||
|
||||
}// namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user