mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Performance Optimizations (#450)
* Make derived transform classes less involved in simulation state * Add performance measurements in openspaceengine * Avoid redundant transformation lookups * Fix bug causing redundant calls to GPULayerManager::bind * Move water reflectance to alpha component of normal buffer. Remove otherData buffer.
This commit is contained in:
@@ -74,6 +74,14 @@ LuaRotation::LuaRotation()
|
||||
, _state(false)
|
||||
{
|
||||
addProperty(_luaScriptFile);
|
||||
|
||||
_luaScriptFile.onChange([&]() {
|
||||
requireUpdate();
|
||||
_fileHandle = std::make_unique<ghoul::filesystem::File>(_luaScriptFile);
|
||||
_fileHandle->setCallback([&](const ghoul::filesystem::File&) {
|
||||
requireUpdate();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary)
|
||||
@@ -88,7 +96,7 @@ LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary)
|
||||
_luaScriptFile = absPath(dictionary.value<std::string>(ScriptInfo.identifier));
|
||||
}
|
||||
|
||||
void LuaRotation::update(const UpdateData& data) {
|
||||
glm::dmat3 LuaRotation::matrix(const Time& time) const {
|
||||
ghoul::lua::runScriptFile(_state, _luaScriptFile);
|
||||
|
||||
// Get the scaling function
|
||||
@@ -99,11 +107,11 @@ void LuaRotation::update(const UpdateData& data) {
|
||||
"LuaRotation",
|
||||
"Script '" << _luaScriptFile << "' does not have a function 'rotation'"
|
||||
);
|
||||
return;
|
||||
return glm::dmat3(1.0);
|
||||
}
|
||||
|
||||
// First argument is the number of seconds past the J2000 epoch in ingame time
|
||||
lua_pushnumber(_state, data.time.j2000Seconds());
|
||||
lua_pushnumber(_state, time.j2000Seconds());
|
||||
|
||||
// Second argument is the number of milliseconds past the J2000 epoch in wallclock
|
||||
using namespace std::chrono;
|
||||
@@ -129,7 +137,7 @@ void LuaRotation::update(const UpdateData& data) {
|
||||
values[i] = luaL_checknumber(_state, -1 - i);
|
||||
}
|
||||
|
||||
_matrix = glm::make_mat3(values);
|
||||
return glm::make_mat3(values);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user