mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-05 19:09:23 -05:00
Code cleanup branch (#618)
* Make height map fallback layer work again * Add documentation to joystick button bindings * Removed grouped property headers * Add new version number constant generated by CMake * Make Joystick deadzone work properly * Change the startup date on Earth to today * Fix key modifier handling * Add debugging indices for TreeNodeDebugging * Fix script schedule for OsirisRex * Do not open Mission schedule automatically * Upload default projection texture automatically * General code cleanup * Fix check_style_guide warnings * Remove .clang-format * MacOS compile fixes * Clang analyzer fixes
This commit is contained in:
@@ -27,15 +27,15 @@
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <ghoul/filesystem/file.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace {
|
||||
static const openspace::properties::Property::PropertyInfo ScriptInfo = {
|
||||
const openspace::properties::Property::PropertyInfo ScriptInfo = {
|
||||
"Script",
|
||||
"Script",
|
||||
"This value is the path to the Lua script that will be executed to compute the "
|
||||
@@ -44,7 +44,8 @@ namespace {
|
||||
"epoch as the first argument, the current wall time as milliseconds past the "
|
||||
"J2000 epoch as the second argument and computes the rotation returned as 9 "
|
||||
"values."
|
||||
};} // namespace
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -71,7 +72,7 @@ documentation::Documentation LuaRotation::Documentation() {
|
||||
|
||||
LuaRotation::LuaRotation()
|
||||
: _luaScriptFile(ScriptInfo)
|
||||
, _state(false)
|
||||
, _state(ghoul::lua::LuaState::IncludeStandardLibrary::No)
|
||||
{
|
||||
addProperty(_luaScriptFile);
|
||||
|
||||
@@ -84,9 +85,7 @@ LuaRotation::LuaRotation()
|
||||
});
|
||||
}
|
||||
|
||||
LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary)
|
||||
: LuaRotation()
|
||||
{
|
||||
LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary) : LuaRotation() {
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
@@ -101,7 +100,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
|
||||
|
||||
// Get the scaling function
|
||||
lua_getglobal(_state, "rotation");
|
||||
bool isFunction = lua_isfunction(_state, -1);
|
||||
const bool isFunction = lua_isfunction(_state, -1);
|
||||
if (!isFunction) {
|
||||
LERRORC(
|
||||
"LuaRotation",
|
||||
@@ -111,17 +110,12 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
|
||||
}
|
||||
|
||||
// First argument is the number of seconds past the J2000 epoch in ingame time
|
||||
lua_pushnumber(_state, time.j2000Seconds());
|
||||
ghoul::lua::push(_state, time.j2000Seconds());
|
||||
|
||||
// Second argument is the number of milliseconds past the J2000 epoch in wallclock
|
||||
using namespace std::chrono;
|
||||
auto now = high_resolution_clock::now();
|
||||
lua_pushnumber(
|
||||
_state,
|
||||
static_cast<lua_Number>(
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
)
|
||||
);
|
||||
ghoul::lua::push(_state, duration_cast<milliseconds>(now.time_since_epoch()).count());
|
||||
|
||||
// Execute the scaling function
|
||||
int success = lua_pcall(_state, 2, 9, 0);
|
||||
|
||||
Reference in New Issue
Block a user