Merge branch 'master' into thesis/2020/radiation

This commit is contained in:
ElonOlsson
2021-09-17 11:06:15 -04:00
7 changed files with 98 additions and 14 deletions

View File

@@ -29,9 +29,37 @@ asset.onInitialize(function ()
end)
helper.setCurrentSlide(deck, 1)
openspace.bindKey("KP_6", "nextSlide()", "Next slide", "Next slide", "/Slides")
openspace.bindKey("KP_4", "previousSlide()", "Previous slide", "Previous slide", "/Slides")
openspace.bindKey("KP_0", "toggleSlides()", "Toggle slides", "Toggle slides", "/Slides")
openspace.action.registerAction({
Identifier = "slide_deck.prevslide",
Name = "Previous slide",
Command = "previousSlide()",
Documentation = "Previous slide",
GuiPath = "/Slides",
IsLocal = false
})
openspace.bindKey("KP_4", "slide_deck.prevslide");
openspace.action.registerAction({
Identifier = "slide_deck.nextslide",
Name = "Next slide",
Command = "nextSlide()",
Documentation = "Next slide",
GuiPath = "/Slides",
IsLocal = false
})
openspace.bindKey("KP_6", "slide_deck.nextslide")
openspace.action.registerAction({
Identifier = "slide_deck.toggleslides",
Name = "Toggle slides",
Command = "toggleSlides()",
Documentation = "Toggle slides",
GuiPath = "/Slides",
IsLocal = false
})
openspace.bindKey("KP_0", "slide_deck.toggleslides")
end)

View File

@@ -3,7 +3,7 @@ asset.require('./static_server')
local guiCustomization = asset.require('customization/gui')
-- Select which commit hashes to use for the frontend and backend
local frontendHash = "b777c48280801e3b54cf77c1231f949fe6e69ace"
local frontendHash = "913fe364fcd3baa314351dc4e332f9a1bdb340f0"
local dataProvider = "data.openspaceproject.com/files/webgui"
local frontend = asset.syncedResource({

View File

@@ -588,11 +588,11 @@ void RenderableModel::initializeGL() {
std::filesystem::path vs =
_vertexShaderPath.empty() ?
absPath("${MODULE_BASE}/shaders/model_vs.glsl") :
_vertexShaderPath;
std::filesystem::path(_vertexShaderPath);
std::filesystem::path fs =
_fragmentShaderPath.empty() ?
absPath("${MODULE_BASE}/shaders/model_fs.glsl") :
_fragmentShaderPath;
std::filesystem::path(_fragmentShaderPath);
return global::renderEngine->buildRenderProgram(ProgramName, vs, fs);
}

View File

@@ -78,7 +78,7 @@ std::vector<nlohmann::json> ShortcutTopic::shortcutsJson() const {
{ "super" , hasKeyModifier(k.modifier, KeyModifier::Super) }
}
},
{ "action", action.name },
{ "action", action.identifier },
};
json.push_back(shortcutJson);
}

View File

@@ -166,7 +166,12 @@ void WebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) {
const Parameters p = codegen::bake<Parameters>(configuration);
_port = p.port.value_or(_port);
_address = p.address.value_or(_address);
if (p.address.has_value()) {
_address = p.address.value();
}
else {
_address = "192.168.1.8"; //global::windowDelegate
}
_webSocketInterface = p.webSocketInterface.value_or(_webSocketInterface);
auto startOrStop = [this]() {

View File

@@ -434,13 +434,23 @@ scripting::LuaLibrary PathNavigator::luaLibrary() {
"motion. If the optional bool is set to true, the target up vector for "
"camera is set based on the target node. Either of the optional "
"parameters can be left out."
},
{
"goToNavigationState",
&luascriptfunctions::goToNavigationState,
{},
"table, [double]",
"Create a path to the navigation state described by the input table. "
"The optional double specifies the target duration of the motion. Note "
"that roll must be included for the target up direction to be taken "
"into account."
},
{
"generatePath",
&luascriptfunctions::generatePath,
"createPath",
&luascriptfunctions::createPath,
{},
"table",
"Generate the path as described by the lua table input argument"
"Create the path as described by the lua table input argument"
},
}
};

View File

@@ -26,6 +26,7 @@
#include <openspace/engine/globals.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/navigation/navigationhandler.h>
#include <openspace/navigation/navigationstate.h>
#include <openspace/navigation/pathnavigator.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scripting/lualibrary.h>
@@ -124,7 +125,7 @@ int goToHeight(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, { 2, 4 }, "lua::goToHeight");
auto [nodeIdentifier, height, useUpFromTargetOrDuration, duration] =
ghoul::lua::values<
std::string, double, std::optional<std::variant<bool, double>>,
std::string, double, std::optional<std::variant<bool, double>>,
std::optional<double>
>(L);
@@ -170,8 +171,48 @@ int goToHeight(lua_State* L) {
return 0;
}
int generatePath(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::generatePath");
int goToNavigationState(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, { 1, 2 }, "lua::goToNavigationState");
auto [navigationState, duration] =
ghoul::lua::values<ghoul::Dictionary, std::optional<double>>(L);
try {
openspace::documentation::testSpecificationAndThrow(
interaction::NavigationState::Documentation(),
navigationState,
"NavigationState"
);
}
catch (documentation::SpecificationError& e) {
LERRORC("goToNavigationState", ghoul::to_string(e.result));
return ghoul::lua::luaError(
L, fmt::format("Unable to create a path: {}", e.what())
);
}
using namespace std::string_literals;
ghoul::Dictionary instruction;
instruction.setValue("TargetType", "NavigationState"s);
instruction.setValue("NavigationState", navigationState);
if (duration.has_value()) {
double d = *duration;
if (d <= Epsilon) {
return ghoul::lua::luaError(L, "Duration must be larger than zero");
}
instruction.setValue("Duration", d);
}
global::navigationHandler->pathNavigator().createPath(instruction);
if (global::navigationHandler->pathNavigator().hasCurrentPath()) {
global::navigationHandler->pathNavigator().startPath();
}
return 0;
}
int createPath(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::createPath");
ghoul::Dictionary dictionary = ghoul::lua::value<ghoul::Dictionary>(L);
global::navigationHandler->pathNavigator().createPath(dictionary);