diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp
index b17adaa7b4..3bc0f706c2 100644
--- a/apps/OpenSpace/main.cpp
+++ b/apps/OpenSpace/main.cpp
@@ -313,7 +313,6 @@ void mainInitFunc() {
void mainPreSyncFunc() {
LTRACE("main::mainPreSyncFunc(begin)");
- OsEng.setRunTime(sgct::Engine::getTime());
OsEng.preSynchronization();
LTRACE("main::mainPreSyncFunc(end)");
}
diff --git a/data/scene/examples/luatransforms/luatransforms.mod b/data/scene/examples/luatransforms/luatransforms.mod
new file mode 100644
index 0000000000..8ba5ea62b8
--- /dev/null
+++ b/data/scene/examples/luatransforms/luatransforms.mod
@@ -0,0 +1,21 @@
+return {
+ -- Earth barycenter module
+ {
+ Name = "Lua Transformation",
+ Parent = "SolarSystemBarycenter",
+ Transform = {
+ Rotation = {
+ Type = "LuaRotation",
+ Script = "rotation.lua"
+ },
+ Scale = {
+ Type = "LuaScale",
+ Script = "scale.lua"
+ },
+ Translation = {
+ Type = "LuaTranslation",
+ Script = "translate.lua"
+ }
+ }
+ }
+}
diff --git a/data/scene/examples/luatransforms/rotation.lua b/data/scene/examples/luatransforms/rotation.lua
new file mode 100644
index 0000000000..0db9bd5949
--- /dev/null
+++ b/data/scene/examples/luatransforms/rotation.lua
@@ -0,0 +1,6 @@
+-- t1: Ingame seconds past the J2000 epoch
+-- t2: Wallclock milliseconds past the J2000 epoch
+
+function rotation(t1, t2)
+ return 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0
+end
diff --git a/data/scene/examples/luatransforms/scale.lua b/data/scene/examples/luatransforms/scale.lua
new file mode 100644
index 0000000000..99ac664c5f
--- /dev/null
+++ b/data/scene/examples/luatransforms/scale.lua
@@ -0,0 +1,6 @@
+-- t1: Ingame seconds past the J2000 epoch
+-- t2: Wallclock milliseconds past the J2000 epoch
+
+function scale(t1, t2)
+ return 1.0;
+end
diff --git a/data/scene/examples/luatransforms/translate.lua b/data/scene/examples/luatransforms/translate.lua
new file mode 100644
index 0000000000..3dfb769e98
--- /dev/null
+++ b/data/scene/examples/luatransforms/translate.lua
@@ -0,0 +1,6 @@
+-- t1: Ingame seconds past the J2000 epoch
+-- t2: Wallclock milliseconds past the J2000 epoch
+
+function translation(t1, t2)
+ return 0.0, 0.0, 0.0
+end
diff --git a/data/web/scenelicense/main.hbs b/data/web/scenelicense/main.hbs
new file mode 100644
index 0000000000..786b51a823
--- /dev/null
+++ b/data/web/scenelicense/main.hbs
@@ -0,0 +1,9 @@
+
+
+
OpenSpace Scene License Information
+
Version: {{version.[0]}}.{{version.[1]}}.{{version.[2]}}
+ {{#each sceneLicenses}}
+ {{> scenelicense}}
+ {{/each}}
+
+
\ No newline at end of file
diff --git a/data/web/scenelicense/scenelicense.hbs b/data/web/scenelicense/scenelicense.hbs
new file mode 100644
index 0000000000..2bd8e98d20
--- /dev/null
+++ b/data/web/scenelicense/scenelicense.hbs
@@ -0,0 +1,16 @@
+
+
+
+
+
+ {{module}}
+
+
{{name}}
+
+
{{attribution}}
+
{{url}}
+
{{licenseText}}
+
+
+
+
diff --git a/data/web/scenelicense/script.js b/data/web/scenelicense/script.js
new file mode 100644
index 0000000000..e0594d2829
--- /dev/null
+++ b/data/web/scenelicense/script.js
@@ -0,0 +1,28 @@
+window.onload = function () {
+ var mainTemplateElement = document.getElementById('mainTemplate');
+ var mainTemplate = Handlebars.compile(mainTemplateElement.innerHTML);
+
+ var sceneLicenseTemplate = document.getElementById('sceneLicenseTemplate');
+ Handlebars.registerPartial('scenelicense', sceneLicenseTemplate.innerHTML);
+
+ Handlebars.registerHelper('urlify', function(options, context) {
+ var data = context.data;
+ var identifier = options.replace(" ", "-").toLowerCase();
+
+ while (data = data._parent) {
+ if (data.key !== undefined) {
+ identifier = data.key + "-" + identifier;
+ }
+ }
+
+ return identifier;
+ });
+
+ var data = {
+ sceneLicenses: sceneLicenses,
+ version: version
+ }
+
+ var contents = mainTemplate(data);
+ document.body.innerHTML = contents;
+}
\ No newline at end of file
diff --git a/include/openspace/engine/configurationmanager.h b/include/openspace/engine/configurationmanager.h
index 75163f2c75..69a83bb6a8 100644
--- a/include/openspace/engine/configurationmanager.h
+++ b/include/openspace/engine/configurationmanager.h
@@ -67,6 +67,8 @@ public:
static const std::string KeyDocumentation;
/// The key that stores the factory documentation values
static const std::string KeyFactoryDocumentation;
+ /// The key that stores the scene license documentation values
+ static const std::string KeySceneLicenseDocumentation;
/// The key that stores the location of the scene file that is initially loaded
static const std::string KeyConfigScene;
/// The key that stores the location of the tasks files
diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h
index ac079ad893..28bb568b37 100644
--- a/include/openspace/engine/openspaceengine.h
+++ b/include/openspace/engine/openspaceengine.h
@@ -79,9 +79,6 @@ public:
static OpenSpaceEngine& ref();
static bool isCreated();
- double runTime();
- void setRunTime(double t);
-
// callbacks
void initialize();
void initializeGL();
@@ -101,9 +98,6 @@ public:
void decode();
void scheduleLoadScene(std::string scenePath);
-
- void enableBarrier();
- void disableBarrier();
void writeDocumentation();
void toggleShutdownMode();
@@ -234,8 +228,6 @@ private:
std::vector> mouseScrollWheel;
} _moduleCallbacks;
- double _runTime;
-
// Structure that is responsible for the delayed shutdown of the application
struct {
// Whether the application is currently in shutdown mode (i.e. counting down the
diff --git a/include/openspace/engine/wrapper/sgctwindowwrapper.h b/include/openspace/engine/wrapper/sgctwindowwrapper.h
index 7dc3db262b..d106ce400d 100644
--- a/include/openspace/engine/wrapper/sgctwindowwrapper.h
+++ b/include/openspace/engine/wrapper/sgctwindowwrapper.h
@@ -49,6 +49,7 @@ public:
double averageDeltaTime() const override;
double deltaTime() const override;
+ double applicationTime() const override;
glm::vec2 mousePosition() const override;
uint32_t mouseButtons(int maxNumber) const override;
glm::ivec2 currentWindowSize() const override;
diff --git a/include/openspace/engine/wrapper/windowwrapper.h b/include/openspace/engine/wrapper/windowwrapper.h
index 252eb4258a..23713c50de 100644
--- a/include/openspace/engine/wrapper/windowwrapper.h
+++ b/include/openspace/engine/wrapper/windowwrapper.h
@@ -106,6 +106,13 @@ public:
*/
virtual double deltaTime() const;
+ /**
+ * Returns the time that has passed (in seconds) since application start
+ * \return The time that has passed (in seconds) since application start
+ * @return [description]
+ */
+ virtual double applicationTime() const;
+
/**
* Returns the location of the mouse cursor in pixel screen coordinates. On default,
* this method returns 0,0.
diff --git a/include/openspace/interaction/luaconsole.h b/include/openspace/interaction/luaconsole.h
index bbc32acc14..ea9b5c87ca 100644
--- a/include/openspace/interaction/luaconsole.h
+++ b/include/openspace/interaction/luaconsole.h
@@ -55,6 +55,7 @@ public:
private:
void parallelConnectionChanged(const ParallelConnection::Status& status);
+
void addToCommand(std::string c);
std::string sanitizeInput(std::string str);
@@ -68,7 +69,6 @@ private:
properties::Vec4Property _historyTextColor;
properties::IntProperty _historyLength;
-
size_t _inputPosition;
std::vector _commandsHistory;
size_t _activeCommand;
diff --git a/include/openspace/performance/performancemanager.h b/include/openspace/performance/performancemanager.h
index 30094f1075..6b12dfa914 100644
--- a/include/openspace/performance/performancemanager.h
+++ b/include/openspace/performance/performancemanager.h
@@ -44,7 +44,9 @@ public:
static void createGlobalSharedMemory();
static void destroyGlobalSharedMemory();
- PerformanceManager();
+ PerformanceManager(std::string loggingDirectory = "${BASE_PATH}",
+ std::string prefix = "PM-");
+
~PerformanceManager();
void resetPerformanceMeasurements();
diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h
index d74fe18199..061a77d8fe 100644
--- a/include/openspace/properties/propertyowner.h
+++ b/include/openspace/properties/propertyowner.h
@@ -224,12 +224,20 @@ public:
std::vector tags() const;
/**
- * Adds a tag to the Property's list of assigned tags. Tags are useful for creating
- * groups of Properties that can be used in batch operations.
+ * Adds a tag to the PropertyOwner's list of assigned tags. Tags are useful for
+ * creating oups of Properties that can be used in batch operations or to mark up
+ * PropertyOwners for other usages (such signalling to GUI applications).
* \param tag The string that is to be assigned to the Property
*/
void addTag(std::string tag);
+ /**
+ * Removes a tag from this PropertyOwner. No error is reported if the tag does not
+ * exist
+ * @param tag The tag is that is to be removed from this PropertyOwner
+ */
+ void removeTag(const std::string& tag);
+
private:
/// The name of this PropertyOwner
std::string _name;
diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h
index 4a2acc076d..695782f06d 100644
--- a/include/openspace/rendering/renderengine.h
+++ b/include/openspace/rendering/renderengine.h
@@ -67,7 +67,8 @@ public:
enum class FrametimeType {
DtTimeAvg = 0,
FPS,
- FPSAvg
+ FPSAvg,
+ None
};
RenderEngine();
@@ -111,8 +112,8 @@ public:
void registerScreenSpaceRenderable(std::shared_ptr s);
void unregisterScreenSpaceRenderable(std::shared_ptr s);
- void unregisterScreenSpaceRenderable(std::string name);
- std::shared_ptr screenSpaceRenderable(std::string name);
+ void unregisterScreenSpaceRenderable(const std::string& name);
+ std::shared_ptr screenSpaceRenderable(const std::string& name);
std::vector screenSpaceRenderables() const;
std::unique_ptr buildRenderProgram(
@@ -171,8 +172,6 @@ public:
// Temporary fade functionality
void startFading(int direction, float fadeDuration);
- void sortScreenspaceRenderables();
-
glm::ivec2 renderingResolution() const;
glm::ivec2 fontResolution() const;
@@ -180,7 +179,7 @@ public:
private:
void setRenderer(std::unique_ptr renderer);
- RendererImplementation rendererFromString(const std::string& method);
+ RendererImplementation rendererFromString(const std::string& method) const;
void renderInformation();
@@ -189,7 +188,7 @@ private:
std::unique_ptr _raycasterManager;
std::unique_ptr _deferredcasterManager;
- properties::BoolProperty _performanceMeasurements;
+ properties::BoolProperty _doPerformanceMeasurements;
std::unique_ptr _performanceManager;
std::unique_ptr _renderer;
diff --git a/include/openspace/scene/scale.h b/include/openspace/scene/scale.h
index 2c1876148e..a9f8cbd856 100644
--- a/include/openspace/scene/scale.h
+++ b/include/openspace/scene/scale.h
@@ -47,10 +47,13 @@ public:
virtual ~Scale() = default;
virtual bool initialize();
- virtual double scaleValue() const = 0;
+ virtual double scaleValue() const;
virtual void update(const UpdateData& data);
static documentation::Documentation Documentation();
+
+protected:
+ double _scale;
};
} // namespace openspace
diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h
index ff24b3633f..0ccd476883 100644
--- a/include/openspace/scene/scene.h
+++ b/include/openspace/scene/scene.h
@@ -32,9 +32,12 @@
#include
#include
+#include
+#include
+#include
#include
#include
-#include
+
#include
namespace ghoul { class Dictionary; }
@@ -122,6 +125,8 @@ public:
*/
void removeNode(SceneGraphNode* node, UpdateDependencies updateDeps = UpdateDependencies::Yes);
+ void addSceneLicense(SceneLicense license);
+
/**
* Update dependencies.
*/
@@ -132,6 +137,14 @@ public:
*/
const std::vector& allSceneGraphNodes() const;
+ /**
+ * Write information about the license information for the scenegraph nodes that are
+ * contained in this scene
+ * \param path The file path that will contain the documentation about the licenses
+ * used in this scene
+ */
+ void writeSceneLicenseDocumentation(const std::string& path) const;
+
/**
* Return a a map from name to scene graph node.
*/
@@ -160,6 +173,8 @@ private:
std::vector _circularNodes;
std::map _nodesByName;
+ std::vector _licenses;
+
std::mutex _programUpdateLock;
std::set _programsToUpdate;
std::vector> _programs;
diff --git a/include/openspace/scene/scenelicense.h b/include/openspace/scene/scenelicense.h
new file mode 100644
index 0000000000..fab818aad4
--- /dev/null
+++ b/include/openspace/scene/scenelicense.h
@@ -0,0 +1,58 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#ifndef __OPENSPACE_CORE___SCENELICENSE___H__
+#define __OPENSPACE_CORE___SCENELICENSE___H__
+
+#include
+
+#include
+#include
+
+namespace ghoul {
+ class Dictionary;
+} // namespace ghoul
+
+namespace openspace {
+
+struct SceneLicense {
+ // module must not be empty
+ SceneLicense(const ghoul::Dictionary& dictionary, std::string module);
+
+ std::string module;
+
+ std::string name;
+ std::string attribution;
+ std::string url;
+ std::string licenseText;
+
+ static documentation::Documentation Documentation();
+};
+
+void writeSceneLicenseDocumentation(const std::vector& licenses,
+ const std::string& file, const std::string& type);
+
+} // namespace openspace
+
+#endif // __OPENSPACE_CORE___SCENELICENSE___H__
diff --git a/modules/base/shaders/path_fs.glsl b/include/openspace/scene/scenelicensewriter.h
similarity index 76%
rename from modules/base/shaders/path_fs.glsl
rename to include/openspace/scene/scenelicensewriter.h
index 5abb243452..0bd591d139 100644
--- a/modules/base/shaders/path_fs.glsl
+++ b/include/openspace/scene/scenelicensewriter.h
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 - 2017 *
+ * Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -21,20 +21,28 @@
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
+
+#ifndef __OPENSPACE_CORE___SCENELICENSEWRITER___H__
+#define __OPENSPACE_CORE___SCENELICENSEWRITER___H__
-#include "PowerScaling/powerScaling_fs.hglsl"
-#include "fragment.glsl"
+#include
-in vec4 vs_positionScreenSpace;
-in vec4 vs_pointColor;
+#include
+#include
-Fragment getFragment() {
- if (vs_pointColor.a < 0.01) {
- discard;
- }
- Fragment frag;
- frag.color = vs_pointColor;
- frag.depth = vs_positionScreenSpace.w;
- return frag;
-}
+namespace openspace {
+
+class SceneLicenseWriter : public DocumentationGenerator {
+public:
+ SceneLicenseWriter(const std::vector& licenses);
+
+private:
+ std::string generateJson() const override;
+
+ const std::vector& _licenses;
+};
+
+} // namespace openspace
+
+#endif // __OPENSPACE_CORE___SCENELICENSEWRITER___H__
diff --git a/include/openspace/scene/sceneloader.h b/include/openspace/scene/sceneloader.h
index ee828985a4..140bbc0f29 100644
--- a/include/openspace/scene/sceneloader.h
+++ b/include/openspace/scene/sceneloader.h
@@ -26,6 +26,7 @@
#define __OPENSPACE_CORE___SCENELOADER___H__
#include
+#include
#include
#include
@@ -33,6 +34,7 @@
#include
#include
+#include
namespace openspace {
@@ -51,7 +53,8 @@ public:
/**
* Import a directory of scene contents into an existing scene.
*/
- std::vector importDirectory(Scene& scene, const std::string& directory);
+ std::pair, std::vector>
+ importDirectory(Scene& scene, const std::string& directory);
/**
* Import a scene graph node from a dictionary into an existing scene.
@@ -98,10 +101,16 @@ private:
*/
std::vector loadModule(const std::string& path, lua_State* luaState);
+ /**
+ * Loads an existing license file
+ */
+ std::vector loadLicense(const std::string& path, std::string module);
+
/**
* Load a directory.
*/
- std::vector loadDirectory(const std::string& path, lua_State* luaState);
+ std::pair, std::vector>
+ loadDirectory(const std::string& path, lua_State* luaState);
/**
* Load a camera from a dictionary
diff --git a/include/openspace/scene/translation.h b/include/openspace/scene/translation.h
index 21ce0515b4..bcd7597c68 100644
--- a/include/openspace/scene/translation.h
+++ b/include/openspace/scene/translation.h
@@ -48,7 +48,7 @@ public:
virtual ~Translation() = default;
virtual bool initialize();
- virtual glm::dvec3 position() const = 0;
+ virtual glm::dvec3 position() const;
virtual void update(const UpdateData& data);
glm::dvec3 position(double time);
@@ -63,6 +63,8 @@ protected:
void notifyObservers();
std::function _onParameterChangeCallback;
+
+ glm::dvec3 _positionValue;
};
} // namespace openspace
diff --git a/include/openspace/util/transformationmanager.h b/include/openspace/util/transformationmanager.h
index 7d90a4dfbc..054933a67d 100644
--- a/include/openspace/util/transformationmanager.h
+++ b/include/openspace/util/transformationmanager.h
@@ -59,10 +59,10 @@ public:
TransformationManager();
~TransformationManager();
- glm::dmat3 frameTransformationMatrix(std::string from, std::string to, double ephemerisTime) const;
+ glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
private:
- glm::dmat3 kameleonTransformationMatrix(std::string from, std::string to, double ephemerisTime) const;
+ glm::dmat3 kameleonTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
std::shared_ptr _kameleon;
diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt
index 6f85ec7df9..5ac1aa21a3 100644
--- a/modules/base/CMakeLists.txt
+++ b/modules/base/CMakeLists.txt
@@ -37,8 +37,11 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.h
)
source_group("Header Files" FILES ${HEADER_FILES})
@@ -56,8 +59,11 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
@@ -67,13 +73,8 @@ set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl
- ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_fs.glsl
- ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_gs.glsl
- ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl
- ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_fs.glsl
- ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl
diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp
index 86e9e000b2..c7165bbd5b 100644
--- a/modules/base/basemodule.cpp
+++ b/modules/base/basemodule.cpp
@@ -43,10 +43,13 @@
#include
#include
+#include
#include
+#include
#include
+#include
#include
#include
@@ -85,16 +88,19 @@ void BaseModule::internalInitialize() {
auto fTranslation = FactoryManager::ref().factory();
ghoul_assert(fTranslation, "Ephemeris factory was not created");
+ fTranslation->registerClass("LuaTranslation");
fTranslation->registerClass("StaticTranslation");
auto fRotation = FactoryManager::ref().factory();
ghoul_assert(fRotation, "Rotation factory was not created");
+ fRotation->registerClass("LuaRotation");
fRotation->registerClass("StaticRotation");
auto fScale = FactoryManager::ref().factory();
ghoul_assert(fScale, "Scale factory was not created");
+ fScale->registerClass("LuaScale");
fScale->registerClass("StaticScale");
auto fModelGeometry = FactoryManager::ref().factory();
@@ -112,8 +118,11 @@ std::vector BaseModule::documentations() const {
ScreenSpaceFramebuffer::Documentation(),
ScreenSpaceImageLocal::Documentation(),
ScreenSpaceImageOnline::Documentation(),
+ LuaRotation::Documentation(),
StaticRotation::Documentation(),
+ LuaScale::Documentation(),
StaticScale::Documentation(),
+ LuaTranslation::Documentation(),
StaticTranslation::Documentation(),
modelgeometry::ModelGeometry::Documentation(),
};
diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp
index bb22e5bb36..7527cbae99 100644
--- a/modules/base/rendering/screenspaceimagelocal.cpp
+++ b/modules/base/rendering/screenspaceimagelocal.cpp
@@ -38,7 +38,6 @@
namespace {
const char* KeyName = "Name";
- const char* KeyUrl = "URL";
static const openspace::properties::Property::PropertyInfo TexturePathInfo = {
"TexturePath",
diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp
new file mode 100644
index 0000000000..5192a85b9e
--- /dev/null
+++ b/modules/base/rotation/luarotation.cpp
@@ -0,0 +1,133 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+namespace {
+ static const openspace::properties::Property::PropertyInfo ScriptInfo = {
+ "Script",
+ "Script",
+ "This value is the path to the Lua script that will be executed to compute the "
+ "rotation for this transformation. The script needs to define a function "
+ "'rotation' that takes the current simulation time in seconds past the J2000 "
+ "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 openspace {
+
+documentation::Documentation LuaRotation::Documentation() {
+ using namespace openspace::documentation;
+ return {
+ "Lua Rotation",
+ "base_transform_rotation_lua",
+ {
+ {
+ "Type",
+ new StringEqualVerifier("LuaRotation"),
+ Optional::No
+ },
+ {
+ ScriptInfo.identifier,
+ new StringVerifier,
+ Optional::No,
+ ScriptInfo.description
+ }
+ }
+ };
+}
+
+LuaRotation::LuaRotation()
+ : _luaScriptFile(ScriptInfo)
+ , _state(false)
+{
+ addProperty(_luaScriptFile);
+}
+
+LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary)
+ : LuaRotation()
+{
+ documentation::testSpecificationAndThrow(
+ Documentation(),
+ dictionary,
+ "LuaRotation"
+ );
+
+ _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier));
+}
+
+void LuaRotation::update(const UpdateData& data) {
+ ghoul::lua::runScriptFile(_state, _luaScriptFile);
+
+ // Get the scaling function
+ lua_getglobal(_state, "rotation");
+ bool isFunction = lua_isfunction(_state, -1);
+ if (!isFunction) {
+ LERRORC(
+ "LuaRotation",
+ "Script '" << _luaScriptFile << "' does not have a function 'rotation'"
+ );
+ return;
+ }
+
+ // First argument is the number of seconds past the J2000 epoch in ingame time
+ lua_pushnumber(_state, data.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,
+ duration_cast(now.time_since_epoch()).count()
+ );
+
+ // Execute the scaling function
+ int success = lua_pcall(_state, 2, 9, 0);
+ if (success != 0) {
+ LERRORC(
+ "LuaScale",
+ "Error executing 'rotation': " << lua_tostring(_state, -1)
+ );
+ }
+
+ double values[9];
+ for (int i = 0; i < 9; ++i) {
+ values[i] = luaL_checknumber(_state, -1 - i);
+ }
+
+ _matrix = glm::make_mat3(values);
+}
+
+} // namespace openspace
diff --git a/modules/base/shaders/pscstandard_vs.glsl b/modules/base/rotation/luarotation.h
similarity index 71%
rename from modules/base/shaders/pscstandard_vs.glsl
rename to modules/base/rotation/luarotation.h
index 2f74b5193f..0c6a2d444f 100644
--- a/modules/base/shaders/pscstandard_vs.glsl
+++ b/modules/base/rotation/luarotation.h
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 - 2017 *
+ * Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -22,32 +22,33 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-#version __CONTEXT__
+#ifndef __OPENSPACE_MODULE_BASE___LUAROTATION___H__
+#define __OPENSPACE_MODULE_BASE___LUAROTATION___H__
-#include "PowerScaling/powerScaling_vs.hglsl"
+#include
-layout(location = 0) in vec4 in_position;
-layout(location = 1) in vec2 in_st;
-layout(location = 2) in vec3 in_normal;
+#include
-out vec2 vs_st;
-out vec4 vs_normal;
-out vec4 vs_position;
+#include
-uniform mat4 ViewProjection;
-uniform mat4 ModelTransform;
-
-
-void main() {
- vs_st = in_st;
- vs_position = in_position;
- vec4 tmp = in_position;
-
- // this is wrong for the normal. The normal transform is the transposed inverse of the model transform
- vs_normal = normalize(ModelTransform * vec4(in_normal,0));
+namespace openspace {
- vec4 position = pscTransform(tmp, ModelTransform);
- vs_position = tmp;
- position = ViewProjection * position;
- gl_Position = z_normalization(position);
-}
+namespace documentation { struct Documentation; }
+
+class LuaRotation : public Rotation {
+public:
+ LuaRotation();
+ LuaRotation(const ghoul::Dictionary& dictionary);
+
+ void update(const UpdateData& data) override;
+
+ static documentation::Documentation Documentation();
+
+private:
+ properties::StringProperty _luaScriptFile;
+ ghoul::lua::LuaState _state;
+};
+
+} // namespace openspace
+
+#endif // __OPENSPACE_MODULE_BASE___LUAROTATION___H__
diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp
new file mode 100644
index 0000000000..30636c4be4
--- /dev/null
+++ b/modules/base/scale/luascale.cpp
@@ -0,0 +1,119 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+namespace {
+ static const openspace::properties::Property::PropertyInfo ScriptInfo = {
+ "Script",
+ "Script",
+ "This value is the path to the Lua script that will be executed to compute the "
+ "scaling factor for this transformation. The script needs to define a function "
+ "'scale' that takes the current simulation time in seconds past the J2000 epoch "
+ "as the first argument, the current wall time as milliseconds past the J2000 "
+ "epoch the second argument and computes the scaling factor."
+ };
+} // namespace
+
+namespace openspace {
+
+documentation::Documentation LuaScale::Documentation() {
+ using namespace openspace::documentation;
+ return {
+ "Lua Scaling",
+ "base_scale_lua",
+ {
+ {
+ ScriptInfo.identifier,
+ new StringVerifier,
+ Optional::No,
+ ScriptInfo.description
+ }
+ }
+ };
+}
+
+LuaScale::LuaScale()
+ : _luaScriptFile(ScriptInfo)
+ , _state(false)
+{
+ addProperty(_luaScriptFile);
+}
+
+LuaScale::LuaScale(const ghoul::Dictionary& dictionary)
+ : LuaScale()
+{
+ documentation::testSpecificationAndThrow(Documentation(), dictionary, "LuaScale");
+
+ _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier));
+}
+
+void LuaScale::update(const UpdateData& data) {
+ ghoul::lua::runScriptFile(_state, _luaScriptFile);
+
+ // Get the scaling function
+ lua_getglobal(_state, "scale");
+ bool isFunction = lua_isfunction(_state, -1);
+ if (!isFunction) {
+ LERRORC(
+ "LuaScale",
+ "Script '" << _luaScriptFile << "' does not have a function 'scale'"
+ );
+ return;
+ }
+
+ // First argument is the number of seconds past the J2000 epoch in ingame time
+ lua_pushnumber(_state, data.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,
+ duration_cast(now.time_since_epoch()).count()
+ );
+
+ // Execute the scaling function
+ int success = lua_pcall(_state, 2, 1, 0);
+ if (success != 0) {
+ LERRORC(
+ "LuaScale",
+ "Error executing 'scale': " << lua_tostring(_state, -1)
+ );
+ }
+
+ _scale = luaL_checknumber(_state, -1);
+}
+
+} // namespace openspace
diff --git a/modules/base/shaders/path_gs.glsl b/modules/base/scale/luascale.h
similarity index 67%
rename from modules/base/shaders/path_gs.glsl
rename to modules/base/scale/luascale.h
index 4c8785014b..2a96aca443 100644
--- a/modules/base/shaders/path_gs.glsl
+++ b/modules/base/scale/luascale.h
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 - 2017 *
+ * Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -22,43 +22,33 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-#version __CONTEXT__
+#ifndef __OPENSPACE_MODULE_BASE___LUASCALE___H__
+#define __OPENSPACE_MODULE_BASE___LUASCALE___H__
-#include "PowerScaling/powerScalingMath.hglsl"
-#include <${SHADERS_GENERATED}/constants.hglsl>:notrack
+#include
-layout(points) in;
-layout(location = 0) in vec4 vs_point_position[];
-layout(location = 1) in flat int isHour[];
-layout(location = 2) in vec4 vs_point_color[];
+#include
-layout(points, max_vertices = 4) out;
-layout(location = 0) out vec4 gs_point_position;
-layout(location = 1) out vec4 gs_point_color;
+#include
-uniform mat4 projection;
-uniform mat4 ViewProjection;
+namespace openspace {
+
+namespace documentation { struct Documentation; }
+
+class LuaScale : public Scale {
+public:
+ LuaScale();
+ LuaScale(const ghoul::Dictionary& dictionary);
-const vec2 corners[4] = vec2[4](
- vec2(0.0, 1.0),
- vec2(0.0, 0.0),
- vec2(1.0, 1.0),
- vec2(1.0, 0.0)
-);
+ void update(const UpdateData& data) override;
+ static documentation::Documentation Documentation();
-void main() {
- gs_point_color = vs_point_color[0];
- gs_point_position = vs_point_position[0];
- if (isHour[0] == 1) {
- gl_Position = gl_in[0].gl_Position;
- EmitVertex();
- EndPrimitive();
- }
- else {
- gl_Position = gl_in[0].gl_Position;
- EmitVertex();
- EndPrimitive();
- return;
- }
-}
+private:
+ properties::StringProperty _luaScriptFile;
+ ghoul::lua::LuaState _state;
+};
+
+} // namespace openspace
+
+#endif // __OPENSPACE_MODULE_BASE___LUASCALE___H__
diff --git a/modules/base/scale/staticscale.cpp b/modules/base/scale/staticscale.cpp
index 8a9f895856..3659e6b7ce 100644
--- a/modules/base/scale/staticscale.cpp
+++ b/modules/base/scale/staticscale.cpp
@@ -58,6 +58,8 @@ StaticScale::StaticScale()
: _scaleValue(ScaleInfo, 1.0, 1.0, 1e6)
{
addProperty(_scaleValue);
+
+ _scaleValue.onChange([&](){ _scale = _scaleValue; });
}
StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
@@ -68,8 +70,4 @@ StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
_scaleValue = static_cast(dictionary.value(ScaleInfo.identifier));
}
-double StaticScale::scaleValue() const {
- return _scaleValue;
-}
-
} // namespace openspace
diff --git a/modules/base/scale/staticscale.h b/modules/base/scale/staticscale.h
index aff8812ee7..11aa0c5ad1 100644
--- a/modules/base/scale/staticscale.h
+++ b/modules/base/scale/staticscale.h
@@ -38,8 +38,6 @@ public:
StaticScale();
StaticScale(const ghoul::Dictionary& dictionary);
- double scaleValue() const override;
-
static documentation::Documentation Documentation();
private:
diff --git a/modules/base/shaders/imageplane_fs.glsl b/modules/base/shaders/imageplane_fs.glsl
index ff334f0a1d..30e028d884 100644
--- a/modules/base/shaders/imageplane_fs.glsl
+++ b/modules/base/shaders/imageplane_fs.glsl
@@ -29,7 +29,6 @@ in float vs_screenSpaceDepth;
uniform sampler2D texture1;
-
Fragment getFragment() {
Fragment frag;
diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp
new file mode 100644
index 0000000000..85b20c52ef
--- /dev/null
+++ b/modules/base/translation/luatranslation.cpp
@@ -0,0 +1,141 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+namespace {
+ static const openspace::properties::Property::PropertyInfo ScriptInfo = {
+ "Script",
+ "Script",
+ "This value is the path to the Lua script that will be executed to compute the "
+ "translation for this transformation. The script needs to define a function "
+ "'translate' that takes the current simulation time in seconds past the J2000 "
+ "epoch as the first argument, the current wall time as milliseconds past the "
+ "J2000 epoch as the second argument and computes the translation."
+ };
+} // namespace
+
+namespace openspace {
+
+documentation::Documentation LuaTranslation::Documentation() {
+ using namespace documentation;
+ return {
+ "Lua Translation",
+ "base_transform_translation_lua",
+ {
+ {
+ "Type",
+ new StringEqualVerifier("LuaTranslation"),
+ Optional::No
+ },
+ {
+ ScriptInfo.identifier,
+ new StringVerifier,
+ Optional::No,
+ ScriptInfo.description
+ }
+ }
+ };
+}
+
+
+LuaTranslation::LuaTranslation()
+ : _luaScriptFile(ScriptInfo)
+ , _state(false)
+{
+ addProperty(_luaScriptFile);
+
+ _luaScriptFile.onChange([&](){
+ _fileHandle = std::make_unique(_luaScriptFile);
+ _fileHandle->setCallback([&](const ghoul::filesystem::File&){
+ notifyObservers();
+ });
+ });
+}
+
+LuaTranslation::LuaTranslation(const ghoul::Dictionary& dictionary)
+ : LuaTranslation()
+{
+ documentation::testSpecificationAndThrow(
+ Documentation(),
+ dictionary,
+ "StaticTranslation"
+ );
+
+ _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier));
+}
+
+void LuaTranslation::update(const UpdateData& data) {
+ ghoul::lua::runScriptFile(_state, _luaScriptFile);
+
+ // Get the scaling function
+ lua_getglobal(_state, "translation");
+ bool isFunction = lua_isfunction(_state, -1);
+ if (!isFunction) {
+ LERRORC(
+ "LuaScale",
+ "Script '" << _luaScriptFile << "' does not have a function 'translation'"
+ );
+ return;
+ }
+
+ // First argument is the number of seconds past the J2000 epoch in ingame time
+ lua_pushnumber(_state, data.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,
+ duration_cast(now.time_since_epoch()).count()
+ );
+
+ // Execute the scaling function
+ int success = lua_pcall(_state, 2, 3, 0);
+ if (success != 0) {
+ LERRORC(
+ "LuaScale",
+ "Error executing 'translation': " << lua_tostring(_state, -1)
+ );
+ }
+
+ double values[3];
+ for (int i = 0; i < 3; ++i) {
+ values[i] = luaL_checknumber(_state, -1 - i);
+ }
+
+ _positionValue = glm::make_vec3(values);
+}
+
+} // namespace openspace
diff --git a/modules/base/shaders/path_vs.glsl b/modules/base/translation/luatranslation.h
similarity index 63%
rename from modules/base/shaders/path_vs.glsl
rename to modules/base/translation/luatranslation.h
index 6b9af3658a..2ee4302d75 100644
--- a/modules/base/shaders/path_vs.glsl
+++ b/modules/base/translation/luatranslation.h
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 - 2017 *
+ * Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -22,42 +22,38 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-#version __CONTEXT__
+#ifndef __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__
+#define __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__
-#include "PowerScaling/powerScaling_vs.hglsl"
+#include
-in vec4 in_point_position;
+#include
-out vec4 vs_positionScreenSpace;
-out vec4 vs_pointColor;
+#include
+#include
-uniform vec3 color;
-uniform mat4 modelViewTransform;
-uniform mat4 projectionTransform;
-uniform int pointSteps;
+#include
+namespace openspace {
-void main() {
- vec4 positionCameraSpace = modelViewTransform * in_point_position;
- vec4 positionClipSpace = projectionTransform * positionCameraSpace;
- vs_positionScreenSpace = z_normalization(positionClipSpace);
+namespace documentation { struct Documentation; }
+
+class LuaTranslation : public Translation {
+public:
+ LuaTranslation();
+ LuaTranslation(const ghoul::Dictionary& dictionary);
- gl_Position = vs_positionScreenSpace;
+ virtual void update(const UpdateData& data) override;
- if (mod(gl_VertexID, pointSteps) == 0) {
- vs_pointColor.rgb = color;
- gl_PointSize = 5.0f;
- }
- else {
- vs_pointColor.rgb = (color + vec3(0.6, 0.6, 0.6)) / 2.0;
- gl_PointSize = 2.f;
- }
+ static documentation::Documentation Documentation();
- // I don't like this random variable k defined in powerScalingMath.hglsl.
- // Will ignore it and use 10 in protest of psc dependencies. /KB
- // float maximumDistance = pow(k, 10);
- float maximumDistance = pow(10, 10);
- float distanceToCamera = length(positionCameraSpace.xyz);
+private:
+ properties::StringProperty _luaScriptFile;
+ ghoul::lua::LuaState _state;
- vs_pointColor.a = maximumDistance / (distanceToCamera / 100.0);
-}
+ std::unique_ptr _fileHandle;
+};
+
+} // namespace openspace
+
+#endif // __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__
diff --git a/modules/base/translation/statictranslation.cpp b/modules/base/translation/statictranslation.cpp
index be2c3c9520..a201294070 100644
--- a/modules/base/translation/statictranslation.cpp
+++ b/modules/base/translation/statictranslation.cpp
@@ -69,6 +69,8 @@ StaticTranslation::StaticTranslation()
)
{
addProperty(_position);
+
+ _position.onChange([&](){ _positionValue = _position; });
}
StaticTranslation::StaticTranslation(const ghoul::Dictionary& dictionary)
@@ -83,8 +85,4 @@ StaticTranslation::StaticTranslation(const ghoul::Dictionary& dictionary)
_position = dictionary.value(PositionInfo.identifier);
}
-glm::dvec3 StaticTranslation::position() const {
- return _position;
-}
-
} // namespace openspace
diff --git a/modules/base/translation/statictranslation.h b/modules/base/translation/statictranslation.h
index df9d4c4e77..50860dbbc7 100644
--- a/modules/base/translation/statictranslation.h
+++ b/modules/base/translation/statictranslation.h
@@ -38,8 +38,6 @@ public:
StaticTranslation();
StaticTranslation(const ghoul::Dictionary& dictionary);
- virtual glm::dvec3 position() const override;
-
static documentation::Documentation Documentation();
private:
diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp
index 2c8e0fe6b0..53b7041b09 100644
--- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp
+++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp
@@ -671,8 +671,8 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm::
scale = 306391534.73091 * PARSEC;
break;
}
-
- for (const auto pair : _labelData) {
+
+ for (const std::pair& pair : _labelData) {
//glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0));
glm::vec3 scaledPos(pair.first);
scaledPos *= scale;
@@ -690,8 +690,7 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm::
_renderOption.value(),
"%s",
pair.second.c_str());
- }
-
+ }
}
void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) {
diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp
index 38de01879d..cae2c552b1 100644
--- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp
+++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp
@@ -235,15 +235,15 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary)
, _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f)
, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 64.f)
//, _pointColor(ColorInfo, glm::vec3(1.f, 0.4f, 0.2f), glm::vec3(0.f, 0.f, 0.f), glm::vec3(1.0f, 1.0f, 1.0f))
- , _drawLabels(DrawLabelInfo, false)
, _textColor(
TextColorInfo,
glm::vec4(1.0f, 1.0, 1.0f, 1.f),
glm::vec4(0.f),
glm::vec4(1.f)
)
- , _textSize(TextSizeInfo, 8.0, 0.5, 24.0)
+ , _textSize(TextSizeInfo, 8.0, 0.5, 24.0)
, _drawElements(DrawElementsInfo, true)
+ , _drawLabels(DrawLabelInfo, false)
, _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
, _program(nullptr)
, _fontRenderer(nullptr)
@@ -251,10 +251,8 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary)
, _speckFile("")
, _labelFile("")
, _unit(Parsec)
- , _nValuesPerAstronomicalObject(0)
+ , _nValuesPerAstronomicalObject(0)
{
- using File = ghoul::filesystem::File;
-
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
@@ -382,7 +380,6 @@ void RenderableDUMeshes::initialize() {
bool success = loadData();
if (!success) {
throw ghoul::RuntimeError("Error loading data");
- return;
}
createMeshes();
@@ -400,7 +397,7 @@ void RenderableDUMeshes::initialize() {
}
void RenderableDUMeshes::deinitialize() {
- for (auto pair : _renderingMeshesMap) {
+ for (const std::pair& pair : _renderingMeshesMap) {
for (int i = 0; i < pair.second.numU; ++i) {
glDeleteVertexArrays(1, &pair.second.vaoArray[i]);
glDeleteBuffers(1, &pair.second.vboArray[i]);
@@ -414,8 +411,10 @@ void RenderableDUMeshes::deinitialize() {
}
}
-void RenderableDUMeshes::renderMeshes(const RenderData& data, const glm::dmat4& modelViewMatrix,
- const glm::dmat4& projectionMatrix) {
+void RenderableDUMeshes::renderMeshes(const RenderData&,
+ const glm::dmat4& modelViewMatrix,
+ const glm::dmat4& projectionMatrix)
+{
// Saving current OpenGL state
GLboolean blendEnabled = glIsEnabled(GL_BLEND);
GLenum blendEquationRGB;
@@ -514,7 +513,7 @@ void RenderableDUMeshes::renderLabels(const RenderData& data, const glm::dmat4&
break;
}
- for (const auto pair : _labelData) {
+ for (const std::pair& pair : _labelData) {
//glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0));
glm::vec3 scaledPos(pair.first);
scaledPos *= scale;
diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.h b/modules/digitaluniverse/rendering/renderabledumeshes.h
index 157e514249..8df9af8f1e 100644
--- a/modules/digitaluniverse/rendering/renderabledumeshes.h
+++ b/modules/digitaluniverse/rendering/renderabledumeshes.h
@@ -154,7 +154,7 @@ private:
glm::dmat4 _transformationMatrix;
std::unordered_map _meshColorMap;
- std::unordered_map _renderingMeshesMap;
+ std::unordered_map _renderingMeshesMap;
};
diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp
index 0dc45352dc..f4af818063 100644
--- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp
+++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp
@@ -278,8 +278,6 @@ RenderablePlanesCloud::RenderablePlanesCloud(const ghoul::Dictionary& dictionary
, _sluminosity(1.f)
, _transformationMatrix(glm::dmat4(1.0))
{
- using File = ghoul::filesystem::File;
-
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
@@ -431,7 +429,6 @@ void RenderablePlanesCloud::initialize() {
bool success = loadData();
if (!success) {
throw ghoul::RuntimeError("Error loading data");
- return;
}
createPlanes();
@@ -468,8 +465,10 @@ void RenderablePlanesCloud::deinitialize() {
}
}
-void RenderablePlanesCloud::renderPlanes(const RenderData& data, const glm::dmat4& modelViewMatrix,
- const glm::dmat4& projectionMatrix) {
+void RenderablePlanesCloud::renderPlanes(const RenderData&,
+ const glm::dmat4& modelViewMatrix,
+ const glm::dmat4& projectionMatrix)
+{
// Saving current OpenGL state
GLboolean blendEnabled = glIsEnabled(GL_BLEND);
GLenum blendEquationRGB;
@@ -580,7 +579,7 @@ void RenderablePlanesCloud::renderLabels(const RenderData& data, const glm::dmat
break;
}
- for (const auto pair : _labelData) {
+ for (const std::pair& pair : _labelData) {
//glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0));
glm::vec3 scaledPos(pair.first);
scaledPos *= scale;
diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt
index e1984f28fc..2c82f7e11e 100644
--- a/modules/globebrowsing/CMakeLists.txt
+++ b/modules/globebrowsing/CMakeLists.txt
@@ -168,6 +168,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layeradjustment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroup.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroupid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layermanager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layerrendersettings.cpp
diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl
index e5674a6983..d984c37ab7 100644
--- a/modules/globebrowsing/globebrowsingmodule_lua.inl
+++ b/modules/globebrowsing/globebrowsingmodule_lua.inl
@@ -221,6 +221,8 @@ int loadWMSCapabilities(lua_State* L) {
std::move(globe),
std::move(url)
);
+
+ return 0;
}
int removeWMSServer(lua_State* L) {
diff --git a/modules/base/shaders/pscstandard_fs.glsl b/modules/globebrowsing/rendering/layer/layergroupid.cpp
similarity index 58%
rename from modules/base/shaders/pscstandard_fs.glsl
rename to modules/globebrowsing/rendering/layer/layergroupid.cpp
index 94f501eb84..7a3d6010a2 100644
--- a/modules/base/shaders/pscstandard_fs.glsl
+++ b/modules/globebrowsing/rendering/layer/layergroupid.cpp
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 - 2017 *
+ * Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -22,54 +22,48 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-#include "PowerScaling/powerScaling_fs.hglsl"
-#include "fragment.glsl"
+#include
-in vec2 vs_st;
-in vec4 vs_normal;
-in vec4 vs_position;
+namespace openspace::globebrowsing::layergroupid {
-uniform vec4 campos;
-uniform vec4 objpos;
-uniform vec3 sun_pos;
-uniform bool _performShading = true;
-uniform float transparency;
-uniform int shadows;
-uniform float time;
-uniform sampler2D texture1;
-
-
-Fragment getFragment() {
- vec4 position = vs_position;
- float depth = pscDepth(position);
- vec4 diffuse = texture(texture1, vs_st);
-
- Fragment frag;
- if (_performShading) {
- vec3 n = normalize(vs_normal.xyz);
- vec3 l_pos = vec3(sun_pos); // sun.
- vec3 l_dir = normalize(l_pos - objpos.xyz);
- float intensity = min(max(5 * dot(n,l_dir), 0.0), 1);
-
- // float shine = 0.0001;
-
- const vec4 specular = vec4(0.5);
- vec4 ambient = vec4(0.0, 0.0, 0.0, transparency);
- /*
- if(intensity > 0.f){
- // halfway vector
- vec3 h = normalize(l_dir + e);
- // specular factor
- float intSpec = max(dot(h,n),0.0);
- spec = specular * pow(intSpec, shine);
+TypeID getTypeIDFromTypeString(const std::string& typeString) {
+ for (int i = 0; i < NUM_LAYER_TYPES; ++i) {
+ if (typeString == LAYER_TYPE_NAMES[i]) {
+ return static_cast(i);
}
- */
- diffuse = max(intensity * diffuse, ambient);
}
-
- frag.color.rgb = diffuse.rgb;
- frag.color.a = transparency;
- frag.depth = depth;
-
- return frag;
+ return TypeID::Unknown;
}
+
+layergroupid::GroupID getGroupIDFromName(const std::string& layerGroupName) {
+ for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) {
+ if (layerGroupName == layergroupid::LAYER_GROUP_NAMES[i]) {
+ return static_cast(i);
+ }
+ }
+ return GroupID::Unknown;
+}
+
+layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName(
+ const std::string& adjustmentTypeName)
+{
+ for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) {
+ if (adjustmentTypeName == layergroupid::ADJUSTMENT_TYPE_NAMES[i]) {
+ return static_cast(i);
+ }
+ }
+ return AdjustmentTypeID::None;
+}
+
+layergroupid::BlendModeID getBlendModeIDFromName(
+ const std::string& blendModeName)
+{
+ for (int i = 0; i < layergroupid::NUM_BLEND_MODES; ++i) {
+ if (blendModeName == layergroupid::BLEND_MODE_NAMES[i]) {
+ return static_cast(i);
+ }
+ }
+ return BlendModeID::Normal;
+}
+
+} // namespace openspace::globebrowsing::layergroupid
diff --git a/modules/globebrowsing/rendering/layer/layergroupid.h b/modules/globebrowsing/rendering/layer/layergroupid.h
index 70eced37a8..b5f4c56eea 100644
--- a/modules/globebrowsing/rendering/layer/layergroupid.h
+++ b/modules/globebrowsing/rendering/layer/layergroupid.h
@@ -110,45 +110,15 @@ enum class BlendModeID {
Color = 4,
};
-static TypeID getTypeIDFromTypeString(std::string typeString) {
- for (int i = 0; i < NUM_LAYER_TYPES; ++i) {
- if (typeString == LAYER_TYPE_NAMES[i]) {
- return static_cast(i);
- }
- }
- return TypeID::Unknown;
-}
+TypeID getTypeIDFromTypeString(const std::string& typeString);
-static layergroupid::GroupID getGroupIDFromName(std::string layerGroupName) {
- for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) {
- if (layerGroupName == layergroupid::LAYER_GROUP_NAMES[i]) {
- return static_cast(i);
- }
- }
- return GroupID::Unknown;
-}
+layergroupid::GroupID getGroupIDFromName(const std::string& layerGroupName);
-static layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName(
- std::string adjustmentTypeName)
-{
- for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) {
- if (adjustmentTypeName == layergroupid::ADJUSTMENT_TYPE_NAMES[i]) {
- return static_cast(i);
- }
- }
- return AdjustmentTypeID::None;
-}
+layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName(
+ const std::string& adjustmentTypeName);
-static layergroupid::BlendModeID getBlendModeIDFromName(
- std::string blendModeName)
-{
- for (int i = 0; i < layergroupid::NUM_BLEND_MODES; ++i) {
- if (blendModeName == layergroupid::BLEND_MODE_NAMES[i]) {
- return static_cast(i);
- }
- }
- return BlendModeID::Normal;
-}
+layergroupid::BlendModeID getBlendModeIDFromName(
+ const std::string& blendModeName);
} // namespace openspace::globebrowsing::layergroupid
diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua
index 51b718051b..7bf39408a7 100644
--- a/modules/globebrowsing/scripts/layer_support.lua
+++ b/modules/globebrowsing/scripts/layer_support.lua
@@ -162,19 +162,25 @@ openspace.globebrowsing.parseInfoFile = function (file)
local dir = openspace.directoryForPath(file)
dofile(file)
- local color = {
- Name = Name,
- Description = Description or "",
- FilePath = dir .. '/' .. ColorFile,
- BlendMode = "Color"
- }
+ local color = nil
+ if ColorFile then
+ color = {
+ Name = Name,
+ Description = Description or "",
+ FilePath = dir .. '/' .. ColorFile,
+ BlendMode = "Color"
+ }
+ end
- local height = {
- Name = Name,
- Description = Description or "",
- FilePath = dir .. '/' .. HeightFile,
- TilePixelSize = 90
- }
+ local height = nil
+ if HeightFile then
+ local height = {
+ Name = Name,
+ Description = Description or "",
+ FilePath = dir .. '/' .. HeightFile,
+ TilePixelSize = 90
+ }
+ end
return color, height
end
@@ -186,8 +192,12 @@ openspace.globebrowsing.addBlendingLayersFromDirectory = function (dir, node_nam
if file:find('.info') then
c, h = openspace.globebrowsing.parseInfoFile(file)
- openspace.globebrowsing.addLayer(node_name, "ColorLayers", c)
- openspace.globebrowsing.addLayer(node_name, "HeightLayers", h)
+ if c then
+ openspace.globebrowsing.addLayer(node_name, "ColorLayers", c)
+ end
+ if h then
+ openspace.globebrowsing.addLayer(node_name, "HeightLayers", h)
+ end
end
end
end
diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h
index 6b18be0a3d..53983cc470 100644
--- a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h
+++ b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h
@@ -41,7 +41,7 @@ namespace openspace::globebrowsing {
/**
* Function for passing GDAL error messages to the GHOUL logging system.
*/
-static void gdalErrorHandler(CPLErr eErrClass, int errNo, const char* msg);
+void gdalErrorHandler(CPLErr eErrClass, int errNo, const char* msg);
/**
* Singleton class interfacing with global GDAL functions.
diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp
index bef1343640..cee66900d8 100644
--- a/modules/imgui/src/guiglobebrowsingcomponent.cpp
+++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp
@@ -64,7 +64,6 @@ void GuiGlobeBrowsingComponent::render() {
using Layer = GlobeBrowsingModule::Layer;
bool e = _isEnabled;
- e = e;
ImGui::Begin("Globe Browsing", &e, WindowSize, 0.5f);
_isEnabled = e;
diff --git a/modules/imgui/src/guimissioncomponent.cpp b/modules/imgui/src/guimissioncomponent.cpp
index 609b2963cc..2991523553 100644
--- a/modules/imgui/src/guimissioncomponent.cpp
+++ b/modules/imgui/src/guimissioncomponent.cpp
@@ -47,7 +47,7 @@ namespace {
openspace::MissionPhase::Trace t = mission.phaseTrace(currentTime, 0);
int treeOption = t.empty() ? 0 : ImGuiTreeNodeFlags_DefaultOpen;
- if (ImGui::TreeNodeEx(("%s" + missionHashname).c_str(), treeOption, mission.name().c_str())) {
+ if (ImGui::TreeNodeEx(("%s" + missionHashname).c_str(), treeOption, "%s", mission.name().c_str())) {
if (!mission.description().empty()) {
ImGui::Text("%s", mission.description().c_str());
}
diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp
index 416830d85b..05e4dd7145 100644
--- a/modules/imgui/src/guipropertycomponent.cpp
+++ b/modules/imgui/src/guipropertycomponent.cpp
@@ -147,8 +147,8 @@ namespace openspace::gui {
GuiPropertyComponent::GuiPropertyComponent(std::string name, UseTreeLayout useTree, IsTopLevelWindow topLevel)
: GuiComponent(std::move(name))
, _useTreeLayout(useTree)
- , _isTopLevel(topLevel)
, _currentUseTreeLayout(useTree)
+ , _isTopLevel(topLevel)
{}
void GuiPropertyComponent::setSource(SourceFunction function) {
diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp
index b15af1f468..e4c0438683 100644
--- a/modules/imgui/src/guispacetimecomponent.cpp
+++ b/modules/imgui/src/guispacetimecomponent.cpp
@@ -139,10 +139,12 @@ void GuiSpaceTimeComponent::render() {
CaptionText("Time Controls");
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f);
+ ImGui::Text("Current Date: %s", OsEng.timeManager().time().UTC().c_str());
+
constexpr int BufferSize = 256;
static char Buffer[BufferSize];
bool dateChanged = ImGui::InputText(
- "Date",
+ "Change Date",
Buffer,
BufferSize,
ImGuiInputTextFlags_EnterReturnsTrue
@@ -207,8 +209,26 @@ void GuiSpaceTimeComponent::render() {
incrementTime(-1);
}
ImGui::SameLine();
-
- ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 55.f);
+
+ ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f);
+
+ bool nowDay = ImGui::Button("Now");
+ if (nowDay) {
+ std::string nowTime = Time::now().UTC();
+ // UTC returns a string of the type YYYY MMM DDTHH:mm:ss.xxx
+ // setTime doesn't like the T in it and wants a space instead
+ nowTime[11] = ' ';
+
+ OsEng.scriptEngine().queueScript(
+ "openspace.time.setTime(\"" + nowTime + "\")",
+ scripting::ScriptEngine::RemoteScripting::Yes
+ );
+
+ }
+ ImGui::SameLine();
+
+ ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f);
+
bool plusDay = ImGui::Button("+Day");
if (plusDay) {
@@ -262,13 +282,6 @@ void GuiSpaceTimeComponent::render() {
);
}
- auto setDeltaTime = [](std::chrono::seconds dt) {
- OsEng.scriptEngine().queueScript(
- "openspace.time.setDeltaTime(" + std::to_string(dt.count()) + ")",
- scripting::ScriptEngine::RemoteScripting::Yes
- );
- };
-
bool minusDs = ImGui::Button("-1d/s");
if (minusDs) {
OsEng.scriptEngine().queueScript(
diff --git a/modules/space/rendering/renderableconstellationbounds.cpp b/modules/space/rendering/renderableconstellationbounds.cpp
index 6cf78bb426..529a50c577 100644
--- a/modules/space/rendering/renderableconstellationbounds.cpp
+++ b/modules/space/rendering/renderableconstellationbounds.cpp
@@ -274,8 +274,10 @@ bool RenderableConstellationBounds::loadVertexFile() {
std::string fileName = absPath(_vertexFilename);
std::ifstream file;
- file.exceptions(std::ifstream::goodbit);
file.open(fileName);
+ if (!file.good()) {
+ return false;
+ }
ConstellationBound currentBound;
currentBound.constellationAbbreviation = "";
diff --git a/modules/space/shaders/rings_vs.glsl b/modules/space/shaders/rings_vs.glsl
index 22060afdef..944bd6d390 100644
--- a/modules/space/shaders/rings_vs.glsl
+++ b/modules/space/shaders/rings_vs.glsl
@@ -36,7 +36,6 @@ out vec4 vs_position;
uniform mat4 modelViewProjectionTransform;
-
void main() {
vs_st = in_st;
diff --git a/openspace.cfg b/openspace.cfg
index c3b78699ba..b3fc5dcf1f 100644
--- a/openspace.cfg
+++ b/openspace.cfg
@@ -78,6 +78,7 @@ return {
KeyboardShortcuts = "${DOCUMENTATION}/KeyboardMapping.html",
Documentation = "${DOCUMENTATION}/Documentation.html",
FactoryDocumentation = "${DOCUMENTATION}/FactoryDocumentation.html",
+ LicenseDocumentation = "${DOCUMENTATION}/License.html",
-- CheckOpenGLState = true,
-- LogEachOpenGLCall = true,
diff --git a/scripts/scene_helper.lua b/scripts/scene_helper.lua
index 9b12b56023..b97a32d37c 100644
--- a/scripts/scene_helper.lua
+++ b/scripts/scene_helper.lua
@@ -1,5 +1,7 @@
mark_interesting_nodes = function(nodes)
for _, n in pairs(nodes) do
- openspace.addTag(n, "GUI.Interesting")
+ if openspace.hasSceneGraphNode(n) then
+ openspace.addTag(n, "GUI.Interesting")
+ end
end
end
diff --git a/shaders/framebuffer/exitframebuffer.frag b/shaders/framebuffer/exitframebuffer.frag
index baae8fbe37..53b08a7a60 100644
--- a/shaders/framebuffer/exitframebuffer.frag
+++ b/shaders/framebuffer/exitframebuffer.frag
@@ -24,7 +24,6 @@
#version __CONTEXT__
-
#include "floatoperations.glsl"
#include <#{fragmentPath}>
diff --git a/shaders/framebuffer/inside.glsl b/shaders/framebuffer/inside.glsl
index 9c5587c325..e97be8ab50 100644
--- a/shaders/framebuffer/inside.glsl
+++ b/shaders/framebuffer/inside.glsl
@@ -22,7 +22,6 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-
void getEntry(inout vec3 entryPos, inout float entryDepth) {
entryPos = cameraPosInRaycaster;
entryDepth = 0;
diff --git a/shaders/luaconsole.vert b/shaders/luaconsole.vert
index b2d9c6de77..8b79da0aa3 100644
--- a/shaders/luaconsole.vert
+++ b/shaders/luaconsole.vert
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
- #version __CONTEXT__
+#version __CONTEXT__
in vec2 in_position;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6acb9c72ae..bfee91aab4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -133,6 +133,8 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/scene/scene.cpp
${OPENSPACE_BASE_DIR}/src/scene/scene_doc.inl
${OPENSPACE_BASE_DIR}/src/scene/scene_lua.inl
+ ${OPENSPACE_BASE_DIR}/src/scene/scenelicense.cpp
+ ${OPENSPACE_BASE_DIR}/src/scene/scenelicensewriter.cpp
${OPENSPACE_BASE_DIR}/src/scene/sceneloader.cpp
${OPENSPACE_BASE_DIR}/src/scene/scenemanager.cpp
${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode.cpp
@@ -290,6 +292,8 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/scene/rotation.h
${OPENSPACE_BASE_DIR}/include/openspace/scene/scale.h
${OPENSPACE_BASE_DIR}/include/openspace/scene/scene.h
+ ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicense.h
+ ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicensewriter.h
${OPENSPACE_BASE_DIR}/include/openspace/scene/sceneloader.h
${OPENSPACE_BASE_DIR}/include/openspace/scene/scenemanager.h
${OPENSPACE_BASE_DIR}/include/openspace/scene/scenegraphnode.h
diff --git a/src/documentation/documentationgenerator.cpp b/src/documentation/documentationgenerator.cpp
index 75026e4f30..f594855e02 100644
--- a/src/documentation/documentationgenerator.cpp
+++ b/src/documentation/documentationgenerator.cpp
@@ -30,6 +30,8 @@
#include
#include
+#include
+
#include
namespace {
@@ -158,6 +160,12 @@ std::string escapedJson(const std::string& text) {
case '\\':
jsonString += "\\\\";
break;
+ case '\n':
+ jsonString += "\\\\n";
+ break;
+ case '\r':
+ jsonString += "\\r";
+ break;
default:
jsonString += c;
}
diff --git a/src/engine/configurationmanager.cpp b/src/engine/configurationmanager.cpp
index 29ac9b7ea2..b8ce887c0a 100644
--- a/src/engine/configurationmanager.cpp
+++ b/src/engine/configurationmanager.cpp
@@ -58,6 +58,7 @@ const string ConfigurationManager::KeyPropertyDocumentation = "PropertyDocumenta
const string ConfigurationManager::KeyKeyboardShortcuts = "KeyboardShortcuts";
const string ConfigurationManager::KeyDocumentation = "Documentation";
const string ConfigurationManager::KeyFactoryDocumentation = "FactoryDocumentation";
+const string ConfigurationManager::KeySceneLicenseDocumentation = "LicenseDocumentation";
const string ConfigurationManager::KeyConfigScene = "Scene";
const string ConfigurationManager::KeyConfigTasksRoot = "TasksRoot";
diff --git a/src/engine/configurationmanager_doc.inl b/src/engine/configurationmanager_doc.inl
index 5731777510..5d13ee7742 100644
--- a/src/engine/configurationmanager_doc.inl
+++ b/src/engine/configurationmanager_doc.inl
@@ -200,6 +200,14 @@ documentation::Documentation ConfigurationManager::Documentation() {
"created in the current application configuration. Any previous file in this "
"location will be silently overritten."
},
+ {
+ ConfigurationManager::KeySceneLicenseDocumentation,
+ new StringVerifier,
+ Optional::Yes,
+ "The file that will be created on startup containing the scene license "
+ "information. Any previous file in this location will be silently "
+ "overwritten."
+ },
{
ConfigurationManager::KeyLauncher,
new TableVerifier({
diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp
index 9b98cb2fc4..f479251a2a 100644
--- a/src/engine/openspaceengine.cpp
+++ b/src/engine/openspaceengine.cpp
@@ -48,6 +48,7 @@
#include
#include
#include
+#include
#include
#include
@@ -164,7 +165,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
}
, _scheduledSceneSwitch(false)
, _scenePath("")
- , _runTime(0.0)
, _shutdown({false, 0.f, 0.f})
, _isFirstRenderingFirstFrame(true)
{
@@ -320,23 +320,17 @@ void OpenSpaceEngine::create(int argc, char** argv,
ConfigurationManager::KeyPerSceneCache
);
std::string cacheFolder = absPath("${CACHE}");
- if (hasCacheCommandline) {
- cacheFolder = commandlineArgumentPlaceholders.cacheFolder;
- // @CLEANUP: Why is this commented out? ---abock
- //FileSys.registerPathToken(
- // "${CACHE}",
- // commandlineArgumentPlaceholders.cacheFolder,
- // ghoul::filesystem::FileSystem::Override::Yes
- //);
- }
- if (hasCacheConfiguration) {
- std::string scene = _engine->configurationManager().value(
- ConfigurationManager::KeyConfigScene
- );
- cacheFolder += "-" + ghoul::filesystem::File(scene).baseName();
- }
-
if (hasCacheCommandline || hasCacheConfiguration) {
+ if (hasCacheCommandline) {
+ cacheFolder = commandlineArgumentPlaceholders.cacheFolder;
+ }
+ if (hasCacheConfiguration) {
+ std::string scene = _engine->configurationManager().value(
+ ConfigurationManager::KeyConfigScene
+ );
+ cacheFolder += "-" + ghoul::filesystem::File(scene).baseName();
+ }
+
LINFO("Old cache: " << absPath("${CACHE}"));
LINFO("New cache: " << cacheFolder);
FileSys.registerPathToken(
@@ -347,8 +341,7 @@ void OpenSpaceEngine::create(int argc, char** argv,
}
// Create directories that doesn't exist
- auto tokens = FileSys.tokens();
- for (const std::string& token : tokens) {
+ for (const std::string& token : FileSys.tokens()) {
if (!FileSys.directoryExists(token)) {
std::string p = absPath(token);
FileSys.createDirectory(p, ghoul::filesystem::FileSystem::Recursive::Yes);
@@ -377,9 +370,7 @@ void OpenSpaceEngine::create(int argc, char** argv,
}
// Create the cachemanager
- FileSys.createCacheManager(
- absPath("${" + ConfigurationManager::KeyCache + "}"), CacheVersion
- );
+ FileSys.createCacheManager(cacheFolder, CacheVersion);
// Register the provided shader directories
ghoul::opengl::ShaderPreprocessor::addIncludePath(absPath("${SHADERS}"));
@@ -445,7 +436,7 @@ void OpenSpaceEngine::initialize() {
glbinding::Binding::useCurrentContext();
glbinding::Binding::initialize();
- // clear the screen so the user don't have to see old buffer contents from the
+ // clear the screen so the user doesn't have to see old buffer contents from the
// graphics card
LDEBUG("Clearing all Windows");
_windowWrapper->clearAllWindows(glm::vec4(0.f, 0.f, 0.f, 1.f));
@@ -645,6 +636,15 @@ void OpenSpaceEngine::loadScene(const std::string& scenePath) {
);
}
+ if (configurationManager().hasKey(ConfigurationManager::KeySceneLicenseDocumentation))
+ {
+ scene->writeSceneLicenseDocumentation(
+ absPath(configurationManager().value(
+ ConfigurationManager::KeySceneLicenseDocumentation
+ ))
+ );
+ }
+
// If a PropertyDocumentationFile was specified, generate it now.
if (configurationManager().hasKey(ConfigurationManager::KeyPropertyDocumentation)) {
scene->writeDocumentation(
@@ -902,10 +902,11 @@ void OpenSpaceEngine::initializeGL() {
}
LTRACE("OpenSpaceEngine::initializeGL::Console::initialize(end)");
- const std::string key = ConfigurationManager::KeyOpenGLDebugContext;
- if (_configurationManager->hasKey(key)) {
+ if (_configurationManager->hasKey(ConfigurationManager::KeyOpenGLDebugContext)) {
LTRACE("OpenSpaceEngine::initializeGL::DebugContext(begin)");
- ghoul::Dictionary dict = _configurationManager->value(key);
+ ghoul::Dictionary dict = _configurationManager->value(
+ ConfigurationManager::KeyOpenGLDebugContext
+ );
bool debug = dict.value(ConfigurationManager::PartActivate);
// Debug output is not available before 4.3
@@ -925,7 +926,6 @@ void OpenSpaceEngine::initializeGL() {
setDebugOutput(DebugOutput(debug), SynchronousOutput(synchronous));
-
if (dict.hasKey(ConfigurationManager::PartFilterIdentifier)) {
ghoul::Dictionary filterDict = dict.value(
ConfigurationManager::PartFilterIdentifier
@@ -1102,20 +1102,9 @@ void OpenSpaceEngine::initializeGL() {
LINFO("Finished initializing OpenGL");
- LINFO("IsUsingSwapGroups: " << _windowWrapper->isUsingSwapGroups());
- LINFO("IsSwapGroupMaster: " << _windowWrapper->isSwapGroupMaster());
-
LTRACE("OpenSpaceEngine::initializeGL(end)");
}
-double OpenSpaceEngine::runTime() {
- return _runTime;
-}
-
-void OpenSpaceEngine::setRunTime(double d) {
- _runTime = d;
-}
-
void OpenSpaceEngine::preSynchronization() {
LTRACE("OpenSpaceEngine::preSynchronization(begin)");
FileSys.triggerFilesystemEvents();
@@ -1226,7 +1215,7 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
func();
}
- if (_shutdown.inShutdown) {
+ if (isGuiWindow && _shutdown.inShutdown) {
_renderEngine->renderShutdownInformation(_shutdown.timer, _shutdown.waitTime);
}
@@ -1399,19 +1388,17 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
&luascriptfunctions::addTag,
"string, string",
"Adds a tag (second argument) to a scene graph node (first argument)"
+ },
+ {
+ "removeTag",
+ &luascriptfunctions::removeTag,
+ "string, string",
+ "Removes a tag (second argument) from a scene graph node (first argument)"
}
}
};
}
-void OpenSpaceEngine::enableBarrier() {
- _windowWrapper->setBarrier(true);
-}
-
-void OpenSpaceEngine::disableBarrier() {
- _windowWrapper->setBarrier(false);
-}
-
// Registers a callback for a specific CallbackOption
void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption option,
std::function function)
@@ -1445,7 +1432,7 @@ void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption opt
throw ghoul::MissingCaseException();
}
}
-
+
void OpenSpaceEngine::registerModuleKeyboardCallback(
std::function function)
{
diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl
index 7fd89319e6..20a3185037 100644
--- a/src/engine/openspaceengine_lua.inl
+++ b/src/engine/openspaceengine_lua.inl
@@ -176,7 +176,31 @@ int addTag(lua_State* L) {
return luaL_error(L, "Unknown scene graph node type '%s'", uri.c_str());
}
- node->addTag(tag);
+ node->addTag(std::move(tag));
+
+ return 0;
+}
+
+/**
+ * \ingroup LuaScripts
+ * removeTag():
+ * Removes a tag from a SceneGraphNode
+ */
+int removeTag(lua_State* L) {
+ const int nArguments = lua_gettop(L);
+ if (nArguments != 2) {
+ return luaL_error(L, "Expected %i arguments, got %i", 2, nArguments);
+ }
+
+ const std::string uri = lua_tostring(L, -2);
+ const std::string tag = lua_tostring(L, -1);
+
+ SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(uri);
+ if (!node) {
+ return luaL_error(L, "Unknown scene graph node type '%s'", uri.c_str());
+ }
+
+ node->removeTag(tag);
return 0;
}
diff --git a/src/engine/wrapper/sgctwindowwrapper.cpp b/src/engine/wrapper/sgctwindowwrapper.cpp
index dc19d46551..2d543cd25e 100644
--- a/src/engine/wrapper/sgctwindowwrapper.cpp
+++ b/src/engine/wrapper/sgctwindowwrapper.cpp
@@ -64,7 +64,7 @@ SGCTWindowWrapper::SGCTWindowWrapper()
setEyeSeparationDistance(_eyeSeparation);
});
}
-
+
void SGCTWindowWrapper::terminate() {
sgct::Engine::instance()->terminate();
}
@@ -72,7 +72,7 @@ void SGCTWindowWrapper::terminate() {
void SGCTWindowWrapper::setBarrier(bool enabled) {
sgct::SGCTWindow::setBarrier(enabled);
}
-
+
void SGCTWindowWrapper::setSynchronization(bool enabled) {
sgct_core::ClusterManager::instance()->setUseIgnoreSync(enabled);
}
@@ -90,7 +90,7 @@ void SGCTWindowWrapper::clearAllWindows(const glm::vec4& clearColor) {
bool SGCTWindowWrapper::windowHasResized() const {
return sgct::Engine::instance()->getCurrentWindowPtr()->isWindowResized();
}
-
+
double SGCTWindowWrapper::averageDeltaTime() const {
return sgct::Engine::instance()->getAvgDt();
}
@@ -98,7 +98,11 @@ double SGCTWindowWrapper::averageDeltaTime() const {
double SGCTWindowWrapper::deltaTime() const {
return sgct::Engine::instance()->getDt();
}
-
+
+double SGCTWindowWrapper::applicationTime() const {
+ return sgct::Engine::getTime();
+}
+
glm::vec2 SGCTWindowWrapper::mousePosition() const {
int id = sgct::Engine::instance()->getCurrentWindowPtr()->getId();
double posX, posY;
@@ -157,7 +161,7 @@ glm::ivec2 SGCTWindowWrapper::currentDrawBufferResolution() const {
}
throw WindowWrapperException("No viewport available");
}
-
+
glm::vec2 SGCTWindowWrapper::dpiScaling() const {
return glm::vec2(
sgct::Engine::instance()->getCurrentWindowPtr()->getXScale(),
@@ -168,7 +172,7 @@ glm::vec2 SGCTWindowWrapper::dpiScaling() const {
int SGCTWindowWrapper::currentNumberOfAaSamples() const {
return sgct::Engine::instance()->getCurrentWindowPtr()->getNumberOfAASamples();
}
-
+
bool SGCTWindowWrapper::isRegularRendering() const {
sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr();
std::size_t nViewports = w->getNumberOfViewports();
@@ -194,7 +198,7 @@ bool SGCTWindowWrapper::isGuiWindow() const {
GuiWindowTag
);
}
-
+
bool SGCTWindowWrapper::isMaster() const {
return sgct::Engine::instance()->isMaster();
}
@@ -206,7 +210,7 @@ bool SGCTWindowWrapper::isSwapGroupMaster() const {
bool SGCTWindowWrapper::isUsingSwapGroups() const {
return sgct::Engine::instance()->getCurrentWindowPtr()->isUsingSwapGroups();
}
-
+
glm::mat4 SGCTWindowWrapper::viewProjectionMatrix() const {
return sgct::Engine::instance()->getCurrentModelViewProjectionMatrix();
}
@@ -214,7 +218,7 @@ glm::mat4 SGCTWindowWrapper::viewProjectionMatrix() const {
glm::mat4 SGCTWindowWrapper::modelMatrix() const {
return sgct::Engine::instance()->getModelMatrix();
}
-
+
void SGCTWindowWrapper::setNearFarClippingPlane(float nearPlane, float farPlane) {
sgct::Engine::instance()->setNearAndFarClippingPlanes(nearPlane, farPlane);
}
@@ -225,39 +229,33 @@ void SGCTWindowWrapper::setEyeSeparationDistance(float distance) {
glm::ivec4 SGCTWindowWrapper::viewportPixelCoordinates() const {
int x1, xSize, y1, ySize;
- sgct::Engine::instance()->getCurrentWindowPtr()->getCurrentViewportPixelCoords(x1,
- y1,
- xSize,
- ySize);
+ sgct::Engine::instance()->getCurrentWindowPtr()->getCurrentViewportPixelCoords(
+ x1,
+ y1,
+ xSize,
+ ySize
+ );
return glm::ivec4(x1, xSize, y1, ySize);
}
-
+
bool SGCTWindowWrapper::isExternalControlConnected() const {
return sgct::Engine::instance()->isExternalControlConnected();
}
-
+
void SGCTWindowWrapper::sendMessageToExternalControl(const std::vector& message) const {
sgct::Engine::instance()->sendMessageToExternalControl(
message.data(),
static_cast(message.size())
);
}
-
+
bool SGCTWindowWrapper::isSimpleRendering() const {
return (sgct::Engine::instance()->getCurrentRenderTarget() != sgct::Engine::NonLinearBuffer);
-
}
-
+
void SGCTWindowWrapper::takeScreenshot(bool applyWarping) const {
sgct::SGCTSettings::instance()->setCaptureFromBackBuffer(applyWarping);
sgct::Engine::instance()->takeScreenshot();
}
-
-//void forEachWindow(std::function function) {
-// size_t n = sgct::Engine::instance()->getNumberOfWindows();
-// for (size_t i = 0; i < n; ++i)
-// function();
-//}
-
-} // namespace openspace
+} // namespace openspace
diff --git a/src/engine/wrapper/windowwrapper.cpp b/src/engine/wrapper/windowwrapper.cpp
index 3cb2784651..2021676076 100644
--- a/src/engine/wrapper/windowwrapper.cpp
+++ b/src/engine/wrapper/windowwrapper.cpp
@@ -92,19 +92,23 @@ double WindowWrapper::averageDeltaTime() const {
double WindowWrapper::deltaTime() const {
return 0.0;
}
-
+
+double WindowWrapper::applicationTime() const {
+ return 0.0;
+}
+
glm::vec2 WindowWrapper::mousePosition() const {
return glm::vec2(0.f);
}
-
+
uint32_t WindowWrapper::mouseButtons(int) const {
return uint32_t(0);
}
-
+
glm::ivec2 WindowWrapper::currentWindowSize() const {
return glm::ivec2(0);
}
-
+
glm::ivec2 WindowWrapper::currentWindowResolution() const {
return currentWindowSize();
}
@@ -153,11 +157,11 @@ glm::mat4 WindowWrapper::viewProjectionMatrix() const {
glm::mat4 WindowWrapper::modelMatrix() const {
return glm::mat4(1.f);
}
-
+
void WindowWrapper::setNearFarClippingPlane(float, float) {}
void WindowWrapper::setEyeSeparationDistance(float) {}
-
+
glm::ivec4 WindowWrapper::viewportPixelCoordinates() const {
return glm::ivec4(
0,
@@ -166,19 +170,19 @@ glm::ivec4 WindowWrapper::viewportPixelCoordinates() const {
currentWindowResolution().y
);
}
-
-
+
+
bool WindowWrapper::isExternalControlConnected() const {
return false;
}
-
+
void WindowWrapper::sendMessageToExternalControl(const std::vector&) const {
}
-
+
bool WindowWrapper::isSimpleRendering() const {
return true;
}
-
+
void WindowWrapper::takeScreenshot(bool) const {}
-
+
} // namespace openspace
diff --git a/src/interaction/keybindingmanager.cpp b/src/interaction/keybindingmanager.cpp
index 6cee3a8788..b702751136 100644
--- a/src/interaction/keybindingmanager.cpp
+++ b/src/interaction/keybindingmanager.cpp
@@ -138,7 +138,7 @@ std::string KeyBindingManager::generateJson() const {
}
return jsonString;
-}
+}
scripting::LuaLibrary KeyBindingManager::luaLibrary() {
return {
diff --git a/src/interaction/keyframenavigator.cpp b/src/interaction/keyframenavigator.cpp
index 9d9070e609..e830925241 100644
--- a/src/interaction/keyframenavigator.cpp
+++ b/src/interaction/keyframenavigator.cpp
@@ -25,6 +25,7 @@
#include
#include
+#include
#include
#include
#include
@@ -37,7 +38,7 @@
namespace openspace::interaction {
void KeyframeNavigator::updateCamera(Camera& camera) {
- double now = OsEng.runTime();
+ double now = OsEng.windowWrapper().applicationTime();
if (_cameraPoseTimeline.nKeyframes() == 0) {
return;
diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp
index a5dc973343..7f0236e53c 100644
--- a/src/network/parallelconnection.cpp
+++ b/src/network/parallelconnection.cpp
@@ -587,7 +587,7 @@ void ParallelConnection::initializationMessageReceived(){
double ParallelConnection::calculateBufferedKeyframeTime(double originalTime) {
std::lock_guard latencyLock(_latencyMutex);
- double timeDiff = OsEng.runTime() - originalTime;
+ double timeDiff = OsEng.windowWrapper().applicationTime() - originalTime;
if (_latencyDiffs.size() == 0) {
_initialTimeDiff = timeDiff;
}
@@ -1084,7 +1084,7 @@ void ParallelConnection::preSynchronization() {
if (OsEng.timeManager().time().timeJumped()) {
_timeJumped = true;
}
- double now = OsEng.runTime();
+ double now = OsEng.windowWrapper().applicationTime();
if (_lastCameraKeyframeTimestamp + _cameraKeyframeInterval < now) {
sendCameraKeyframe();
@@ -1156,7 +1156,7 @@ void ParallelConnection::sendCameraKeyframe() {
kf._focusNode = focusNode->name();
// Timestamp as current runtime of OpenSpace instance
- kf._timestamp = OsEng.runTime();
+ kf._timestamp = OsEng.windowWrapper().applicationTime();
// Create a buffer for the keyframe
std::vector buffer;
@@ -1180,7 +1180,7 @@ void ParallelConnection::sendTimeKeyframe() {
kf._time = time.j2000Seconds();
// Timestamp as current runtime of OpenSpace instance
- kf._timestamp = OsEng.runTime();
+ kf._timestamp = OsEng.windowWrapper().applicationTime();
// Create a buffer for the keyframe
std::vector buffer;
diff --git a/src/performance/performancemanager.cpp b/src/performance/performancemanager.cpp
index 0e511237aa..7eee5569b0 100644
--- a/src/performance/performancemanager.cpp
+++ b/src/performance/performancemanager.cpp
@@ -130,10 +130,10 @@ void PerformanceManager::destroyGlobalSharedMemory() {
sharedMemory.releaseLock();
}
-PerformanceManager::PerformanceManager()
+PerformanceManager::PerformanceManager(std::string loggingDirectory, std::string prefix)
: _loggingEnabled(false)
- , _logDir(absPath("${BASE_PATH}"))
- , _prefix("PM-")
+ , _logDir(absPath(std::move(loggingDirectory)))
+ , _prefix(std::move(prefix))
, _ext("log")
, _performanceMemory(nullptr)
, _tick(0)
diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp
index 671dde7fe6..6568b7146c 100644
--- a/src/properties/propertyowner.cpp
+++ b/src/properties/propertyowner.cpp
@@ -34,14 +34,6 @@ namespace openspace::properties {
namespace {
const char* _loggerCat = "PropertyOwner";
-
- bool propertyLess(Property* lhs, Property* rhs) {
- return lhs->identifier() < rhs->identifier();
- }
-
- bool subOwnerLess(PropertyOwner* lhs, PropertyOwner* rhs) {
- return lhs->name() < rhs->name();
- }
} // namespace
@@ -290,4 +282,11 @@ void PropertyOwner::addTag(std::string tag) {
_tags.push_back(std::move(tag));
}
+void PropertyOwner::removeTag(const std::string& tag) {
+ _tags.erase(
+ std::remove(_tags.begin(), _tags.end(), tag),
+ _tags.end()
+ );
+}
+
} // namespace openspace::properties
diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp
index bc8a04d7ca..2536cd8c17 100644
--- a/src/rendering/renderengine.cpp
+++ b/src/rendering/renderengine.cpp
@@ -218,7 +218,7 @@ RenderEngine::RenderEngine()
, _scene(nullptr)
, _raycasterManager(nullptr)
, _deferredcasterManager(nullptr)
- , _performanceMeasurements(PerformanceInfo)
+ , _doPerformanceMeasurements(PerformanceInfo)
, _performanceManager(nullptr)
, _renderer(nullptr)
, _rendererImplementation(RendererImplementation::Invalid)
@@ -244,35 +244,41 @@ RenderEngine::RenderEngine()
, _nAaSamples(AaSamplesInfo, 8, 1, 16)
, _frameNumber(0)
{
- _performanceMeasurements.onChange([this]() {
- if (_performanceMeasurements) {
+ _doPerformanceMeasurements.onChange([this](){
+ if (_doPerformanceMeasurements) {
if (!_performanceManager) {
- _performanceManager = std::make_unique();
- const std::string KeyLogDir = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogDir;
+ std::string loggingDir = "${BASE_PATH}";
+
+ const std::string KeyDir = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogDir;
+ if (OsEng.configurationManager().hasKey(KeyDir)) {
+ loggingDir = OsEng.configurationManager().value(KeyDir);
+ }
+
+ std::string prefix = "PM-";
const std::string KeyPrefix = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogPerformancePrefix;
- if (OsEng.configurationManager().hasKeyAndValue(KeyLogDir)) {
- _performanceManager->logDir(OsEng.configurationManager().value(KeyLogDir));
- }
- if (OsEng.configurationManager().hasKeyAndValue(KeyPrefix)) {
- _performanceManager->prefix(OsEng.configurationManager().value(KeyPrefix));
+ if (OsEng.configurationManager().hasKey(KeyPrefix)) {
+ prefix = OsEng.configurationManager().value(KeyPrefix);
}
+
+ _performanceManager = std::make_unique(
+ loggingDir,
+ prefix
+ );
}
}
- });
- addProperty(_performanceMeasurements);
+ else {
+ _performanceManager = nullptr;
+ }
- _frametimeType.addOption(
- static_cast(FrametimeType::DtTimeAvg),
- "Average Deltatime"
- );
- _frametimeType.addOption(
- static_cast(FrametimeType::FPS),
- "Frames per second"
- );
- _frametimeType.addOption(
- static_cast(FrametimeType::FPSAvg),
- "Average frames per second"
- );
+ });
+ addProperty(_doPerformanceMeasurements);
+
+ _frametimeType.addOptions({
+ { static_cast(FrametimeType::DtTimeAvg), "Average Deltatime" },
+ { static_cast(FrametimeType::FPS), "Frames per second" },
+ { static_cast(FrametimeType::FPSAvg), "Average frames per second" },
+ { static_cast(FrametimeType::None), "None" }
+ });
addProperty(_frametimeType);
addProperty(_showDate);
@@ -318,9 +324,6 @@ RenderEngine::RenderEngine()
addProperty(_disableMasterRendering);
}
-/**
- * Destructor
- */
RenderEngine::~RenderEngine() {}
void RenderEngine::setRendererFromString(const std::string& renderingMethod) {
@@ -347,7 +350,7 @@ void RenderEngine::initialize() {
std::string renderingMethod = DefaultRenderingMethod;
// If the user specified a rendering method that he would like to use, use that
- auto& confManager = OsEng.configurationManager();
+ ConfigurationManager& confManager = OsEng.configurationManager();
if (confManager.hasKeyAndValue(KeyRenderingMethod)) {
renderingMethod = confManager.value(KeyRenderingMethod);
}
@@ -414,7 +417,7 @@ void RenderEngine::initializeGL() {
// set the close clip plane and the far clip plane to extreme values while in
// development
- OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 10000.f);
+ OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 1000.f);
try {
const float fontSizeBig = 50.f;
@@ -440,7 +443,7 @@ void RenderEngine::initializeGL() {
}
void RenderEngine::deinitialize() {
- for (std::shared_ptr ssr : _screenSpaceRenderables) {
+ for (std::shared_ptr& ssr : _screenSpaceRenderables) {
ssr->deinitialize();
}
@@ -566,9 +569,9 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
_camera->sgctInternal.setViewMatrix(viewMatrix * sceneMatrix);
}
_camera->sgctInternal.setProjectionMatrix(projectionMatrix);
-
-
- if (!(wrapper.isMaster() && _disableMasterRendering) && !wrapper.isGuiWindow()) {
+
+ bool masterEnabled = wrapper.isMaster() ? !_disableMasterRendering : true;
+ if (masterEnabled && !wrapper.isGuiWindow() && _globalBlackOutFactor > 0.f) {
_renderer->render(_globalBlackOutFactor, _performanceManager != nullptr);
}
@@ -585,9 +588,9 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
RenderFont(*_fontBig, penPosition, "%i", _frameNumber);
}
-
- _frameNumber++;
-
+
+ ++_frameNumber;
+
for (std::shared_ptr& ssr : _screenSpaceRenderables) {
if (ssr->isEnabled() && ssr->isReady()) {
ssr->render();
@@ -610,7 +613,6 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
fontResolution().x - size.boundingBox.x - 10,
fontResolution().y - size.boundingBox.y
);
- // penPosition.y -= _fontDate->height();
RenderFontCr(
*_fontDate,
@@ -785,7 +787,6 @@ void RenderEngine::setRendererData(const ghoul::Dictionary& data) {
}
}
-
/**
* Set resolve data
* Called from the renderer, whenever it needs to update
@@ -853,7 +854,6 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
"number",
""
},
- //also temporary @JK
{
"fadeOut",
&luascriptfunctions::fadeOut,
@@ -887,7 +887,7 @@ performance::PerformanceManager* RenderEngine::performanceManager() {
void RenderEngine::registerScreenSpaceRenderable(std::shared_ptr s)
{
s->initialize();
- _screenSpaceRenderables.push_back(s);
+ _screenSpaceRenderables.push_back(std::move(s));
}
void RenderEngine::unregisterScreenSpaceRenderable(
@@ -905,7 +905,7 @@ void RenderEngine::unregisterScreenSpaceRenderable(
}
}
-void RenderEngine::unregisterScreenSpaceRenderable(std::string name) {
+void RenderEngine::unregisterScreenSpaceRenderable(const std::string& name){
std::shared_ptr s = screenSpaceRenderable(name);
if (s) {
unregisterScreenSpaceRenderable(s);
@@ -913,14 +913,22 @@ void RenderEngine::unregisterScreenSpaceRenderable(std::string name) {
}
std::shared_ptr RenderEngine::screenSpaceRenderable(
- std::string name)
+ const std::string& name)
{
- for (auto s : _screenSpaceRenderables) {
- if (s->name() == name) {
- return s;
+ auto it = std::find_if(
+ _screenSpaceRenderables.begin(),
+ _screenSpaceRenderables.end(),
+ [name](const std::shared_ptr& s) {
+ return s->name() == name;
}
+ );
+
+ if (it != _screenSpaceRenderables.end()) {
+ return *it;
+ }
+ else {
+ return nullptr;
}
- return nullptr;
}
std::vector RenderEngine::screenSpaceRenderables() const {
@@ -935,7 +943,7 @@ std::vector RenderEngine::screenSpaceRenderables() const
}
RenderEngine::RendererImplementation RenderEngine::rendererFromString(
- const std::string& impl)
+ const std::string& impl) const
{
const std::map RenderingMethods = {
{ "ABuffer", RendererImplementation::ABuffer },
@@ -966,40 +974,39 @@ std::string RenderEngine::progressToStr(int size, double t) {
}
void RenderEngine::renderInformation() {
- // TODO: Adjust font_size properly when using retina screen
using ghoul::fontrendering::RenderFont;
- if (_fontDate) {
- glm::vec2 penPosition = glm::vec2(
- 10.f,
- fontResolution().y
- //OsEng.windowWrapper().viewportPixelCoordinates().w
+ glm::vec2 penPosition = glm::vec2(
+ 10.f,
+ fontResolution().y
+ );
+
+ // If the console is opened, move all text downwards
+ penPosition.y -= OsEng.console().currentHeight();
+
+ if (_showDate && _fontDate) {
+ penPosition.y -= _fontDate->height();
+ RenderFontCr(
+ *_fontDate,
+ penPosition,
+ "Date: %s",
+ OsEng.timeManager().time().UTC().c_str()
+ );
+ }
+ else {
+ penPosition.y -= _fontInfo->height();
+ }
+
+ if (_showInfo && _fontInfo) {
+ RenderFontCr(
+ *_fontInfo,
+ penPosition,
+ "Simulation increment (s): %.3f",
+ OsEng.timeManager().time().deltaTime()
);
- penPosition.y -= OsEng.console().currentHeight();
-
- if (_showDate && _fontDate) {
- penPosition.y -= _fontDate->height();
- RenderFontCr(
- *_fontDate,
- penPosition,
- "Date: %s",
- OsEng.timeManager().time().UTC().c_str()
- );
- }
- else {
- penPosition.y -= _fontInfo->height();
- }
- if (_showInfo && _fontInfo) {
- RenderFontCr(
- *_fontInfo,
- penPosition,
- "Simulation increment (s): %.3f",
- OsEng.timeManager().time().deltaTime()
- );
-
- FrametimeType frametimeType = FrametimeType(_frametimeType.value());
- switch (frametimeType) {
+ FrametimeType frametimeType = FrametimeType(_frametimeType.value());
+ switch (frametimeType) {
case FrametimeType::DtTimeAvg:
RenderFontCr(
*_fontInfo,
@@ -1024,15 +1031,7 @@ void RenderEngine::renderInformation() {
1.0 / OsEng.windowWrapper().averageDeltaTime()
);
break;
- default:
- RenderFontCr(
- *_fontInfo,
- penPosition,
- "Avg. Frametime: %.5f",
- OsEng.windowWrapper().averageDeltaTime()
- );
- break;
- }
+ }
ParallelConnection::Status status = OsEng.parallelConnection().status();
size_t nConnections = OsEng.parallelConnection().nConnections();
@@ -1074,275 +1073,278 @@ void RenderEngine::renderInformation() {
}
}
- if (connectionInfo != "") {
- RenderFontCr(
- *_fontInfo,
- penPosition,
- connectionInfo.c_str()
- );
- }
+
+ if (!connectionInfo.empty()) {
+ RenderFontCr(
+ *_fontInfo,
+ penPosition,
+ connectionInfo.c_str()
+ );
+ }
#ifdef OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS_ENABLED
- bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons");
- double currentTime = OsEng.timeManager().time().j2000Seconds();
+ bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons");
+ double currentTime = OsEng.timeManager().time().j2000Seconds();
- //if (MissionManager::ref().hasCurrentMission()) {
+ //if (MissionManager::ref().hasCurrentMission()) {
- // const Mission& mission = MissionManager::ref().currentMission();
+ // const Mission& mission = MissionManager::ref().currentMission();
- // if (mission.phases().size() > 0) {
- // static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1);
- // //static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1);
- // static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1);
- // static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1);
- // // static const glm::vec4 currentLeafMissionColor = missionProgressColor;
- // static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1);
+ // if (mission.phases().size() > 0) {
+ // static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1);
+ // //static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1);
+ // static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1);
+ // static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1);
+ // // static const glm::vec4 currentLeafMissionColor = missionProgressColor;
+ // static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1);
- // // Add spacing
- // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " ");
+ // // Add spacing
+ // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " ");
- // auto phaseTrace = mission.phaseTrace(currentTime);
+ // auto phaseTrace = mission.phaseTrace(currentTime);
- // if (phaseTrace.size()) {
- // const MissionPhase& phase = phaseTrace.back().get();
- // std::string title = "Current Mission Phase: " + phase.name();
- // RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str());
- // double remaining = phase.timeRange().end - currentTime;
- // float t = static_cast(1.0 - remaining / phase.timeRange().duration());
- // std::string progress = progressToStr(25, t);
- // //RenderFontCr(*_fontInfo, penPosition, missionProgressColor,
- // // "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100);
- // }
- // else {
- // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:");
- // double remaining = mission.timeRange().start - currentTime;
- // RenderFontCr(*_fontInfo, penPosition, nextMissionColor,
- // "%.0f s", remaining);
- // }
+ // if (phaseTrace.size()) {
+ // const MissionPhase& phase = phaseTrace.back().get();
+ // std::string title = "Current Mission Phase: " + phase.name();
+ // RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str());
+ // double remaining = phase.timeRange().end - currentTime;
+ // float t = static_cast(1.0 - remaining / phase.timeRange().duration());
+ // std::string progress = progressToStr(25, t);
+ // //RenderFontCr(*_fontInfo, penPosition, missionProgressColor,
+ // // "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100);
+ // }
+ // else {
+ // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:");
+ // double remaining = mission.timeRange().start - currentTime;
+ // RenderFontCr(*_fontInfo, penPosition, nextMissionColor,
+ // "%.0f s", remaining);
+ // }
- // bool showAllPhases = false;
+ // bool showAllPhases = false;
- // typedef std::pair PhaseWithDepth;
- // std::stack S;
- // int pixelIndentation = 20;
- // S.push({ &mission, 0 });
- // while (!S.empty()) {
- // const MissionPhase* phase = S.top().first;
- // int depth = S.top().second;
- // S.pop();
+ // typedef std::pair PhaseWithDepth;
+ // std::stack S;
+ // int pixelIndentation = 20;
+ // S.push({ &mission, 0 });
+ // while (!S.empty()) {
+ // const MissionPhase* phase = S.top().first;
+ // int depth = S.top().second;
+ // S.pop();
- // bool isCurrentPhase = phase->timeRange().includes(currentTime);
+ // bool isCurrentPhase = phase->timeRange().includes(currentTime);
- // penPosition.x += depth * pixelIndentation;
- // if (isCurrentPhase) {
- // double remaining = phase->timeRange().end - currentTime;
- // float t = static_cast(1.0 - remaining / phase->timeRange().duration());
- // std::string progress = progressToStr(25, t);
- // RenderFontCr(*_fontInfo, penPosition, currentMissionColor,
- // "%s %s %.1f %%",
- // phase->name().c_str(),
- // progress.c_str(),
- // t * 100
- // );
- // }
- // else {
- // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str());
- // }
- // penPosition.x -= depth * pixelIndentation;
+ // penPosition.x += depth * pixelIndentation;
+ // if (isCurrentPhase) {
+ // double remaining = phase->timeRange().end - currentTime;
+ // float t = static_cast(1.0 - remaining / phase->timeRange().duration());
+ // std::string progress = progressToStr(25, t);
+ // RenderFontCr(*_fontInfo, penPosition, currentMissionColor,
+ // "%s %s %.1f %%",
+ // phase->name().c_str(),
+ // progress.c_str(),
+ // t * 100
+ // );
+ // }
+ // else {
+ // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str());
+ // }
+ // penPosition.x -= depth * pixelIndentation;
- // if (isCurrentPhase || showAllPhases) {
- // // phases are sorted increasingly by start time, and will be popped
- // // last-in-first-out from the stack, so add them in reversed order.
- // int indexLastPhase = static_cast(phase->phases().size()) - 1;
- // for (int i = indexLastPhase; 0 <= i; --i) {
- // S.push({ &phase->phases()[i], depth + 1 });
- // }
- // }
- // }
- // }
- // }
+ // if (isCurrentPhase || showAllPhases) {
+ // // phases are sorted increasingly by start time, and will be popped
+ // // last-in-first-out from the stack, so add them in reversed order.
+ // int indexLastPhase = static_cast(phase->phases().size()) - 1;
+ // for (int i = indexLastPhase; 0 <= i; --i) {
+ // S.push({ &phase->phases()[i], depth + 1 });
+ // }
+ // }
+ // }
+ // }
+ // }
- if (openspace::ImageSequencer::ref().isReady()) {
- penPosition.y -= 25.f;
+ if (openspace::ImageSequencer::ref().isReady()) {
+ penPosition.y -= 25.f;
- glm::vec4 targetColor(0.00, 0.75, 1.00, 1);
+ glm::vec4 targetColor(0.00, 0.75, 1.00, 1);
- if (hasNewHorizons) {
- try {
- double lt;
- glm::dvec3 p =
- SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt);
- psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
- float a, b;
- glm::dvec3 radii;
- SpiceManager::ref().getValue("PLUTO", "RADII", radii);
- a = static_cast(radii.x);
- b = static_cast(radii.y);
- float radius = (a + b) / 2.f;
- float distToSurf = glm::length(nhPos.vec3()) - radius;
+ if (hasNewHorizons) {
+ try {
+ double lt;
+ glm::dvec3 p =
+ SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt);
+ psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
+ float a, b;
+ glm::dvec3 radii;
+ SpiceManager::ref().getValue("PLUTO", "RADII", radii);
+ a = static_cast(radii.x);
+ b = static_cast(radii.y);
+ float radius = (a + b) / 2.f;
+ float distToSurf = glm::length(nhPos.vec3()) - radius;
- RenderFont(*_fontInfo,
- penPosition,
- "Distance to Pluto: % .1f (KM)",
- distToSurf
- );
- penPosition.y -= _fontInfo->height();
- }
- catch (...) {
- // @CLEANUP: This is bad as it will discard all exceptions
- // without telling us about it! ---abock
- }
+ RenderFont(*_fontInfo,
+ penPosition,
+ "Distance to Pluto: % .1f (KM)",
+ distToSurf
+ );
+ penPosition.y -= _fontInfo->height();
}
+ catch (...) {
+ // @CLEANUP: This is bad as it will discard all exceptions
+ // without telling us about it! ---abock
+ }
+ }
- double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime;
- float t = static_cast(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength());
+ double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime;
+ float t = static_cast(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength());
- std::string str = SpiceManager::ref().dateFromEphemerisTime(
- ImageSequencer::ref().getNextCaptureTime(),
- "YYYY MON DD HR:MN:SC"
+ std::string str = SpiceManager::ref().dateFromEphemerisTime(
+ ImageSequencer::ref().getNextCaptureTime(),
+ "YYYY MON DD HR:MN:SC"
);
- glm::vec4 active(0.6, 1, 0.00, 1);
- glm::vec4 brigther_active(0.9, 1, 0.75, 1);
+ glm::vec4 active(0.6, 1, 0.00, 1);
+ glm::vec4 brigther_active(0.9, 1, 0.75, 1);
- if (remaining > 0) {
+ if (remaining > 0) {
+
+ std::string progress = progressToStr(25, t);
+ brigther_active *= (1 - t);
- std::string progress = progressToStr(25, t);
- brigther_active *= (1 - t);
-
- RenderFontCr(*_fontInfo,
- penPosition,
- active * t + brigther_active,
- "Next instrument activity:"
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ active * t + brigther_active,
+ "Next instrument activity:"
);
- RenderFontCr(*_fontInfo,
- penPosition,
- active * t + brigther_active,
- "%.0f s %s %.1f %%",
- remaining, progress.c_str(), t * 100
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ active * t + brigther_active,
+ "%.0f s %s %.1f %%",
+ remaining, progress.c_str(), t * 100
);
- RenderFontCr(*_fontInfo,
- penPosition,
- active,
- "Data acquisition time: %s",
- str.c_str()
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ active,
+ "Data acquisition time: %s",
+ str.c_str()
);
- }
- std::pair nextTarget = ImageSequencer::ref().getNextTarget();
- std::pair currentTarget = ImageSequencer::ref().getCurrentTarget();
+ }
+ std::pair nextTarget = ImageSequencer::ref().getNextTarget();
+ std::pair currentTarget = ImageSequencer::ref().getCurrentTarget();
- if (currentTarget.first > 0.0) {
- int timeleft = static_cast(nextTarget.first - currentTime);
+ if (currentTarget.first > 0.0) {
+ int timeleft = static_cast(nextTarget.first - currentTime);
- int hour = timeleft / 3600;
- int second = timeleft % 3600;
- int minute = second / 60;
- second = second % 60;
+ int hour = timeleft / 3600;
+ int second = timeleft % 3600;
+ int minute = second / 60;
+ second = second % 60;
- std::string hh, mm, ss;
+ std::string hh, mm, ss;
- if (hour < 10)
- hh.append("0");
- if (minute < 10)
- mm.append("0");
- if (second < 10)
- ss.append("0");
+ if (hour < 10)
+ hh.append("0");
+ if (minute < 10)
+ mm.append("0");
+ if (second < 10)
+ ss.append("0");
- hh.append(std::to_string(hour));
- mm.append(std::to_string(minute));
- ss.append(std::to_string(second));
+ hh.append(std::to_string(hour));
+ mm.append(std::to_string(minute));
+ ss.append(std::to_string(second));
- RenderFontCr(*_fontInfo,
- penPosition,
- targetColor,
- "Data acquisition adjacency: [%s:%s:%s]",
- hh.c_str(), mm.c_str(), ss.c_str()
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ targetColor,
+ "Data acquisition adjacency: [%s:%s:%s]",
+ hh.c_str(), mm.c_str(), ss.c_str()
);
#if 0
- // Why is it (2) in the original? ---abock
- //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0);
- //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2);
- std::string space;
- glm::vec4 color;
- size_t isize = incidentTargets.second.size();
- for (size_t p = 0; p < isize; p++) {
- double t = static_cast(p + 1) / static_cast(isize + 1);
- t = (p > isize / 2) ? 1 - t : t;
- t += 0.3;
- color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1);
- RenderFont(*_fontInfo,
- penPosition,
- color,
- "%s%s",
- space.c_str(), incidentTargets.second[p].c_str()
- );
- for (int k = 0; k < incidentTargets.second[p].size() + 2; k++)
- space += " ";
- }
-#endif
- penPosition.y -= _fontInfo->height();
+// Why is it (2) in the original? ---abock
+ //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0);
+ //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2);
+ std::string space;
+ glm::vec4 color;
+ size_t isize = incidentTargets.second.size();
+ for (size_t p = 0; p < isize; p++) {
+ double t = static_cast(p + 1) / static_cast(isize + 1);
+ t = (p > isize / 2) ? 1 - t : t;
+ t += 0.3;
+ color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1);
- std::map activeMap = ImageSequencer::ref().getActiveInstruments();
- glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1);
- glm::vec4 notFiring(0.5, 0.5, 0.5, 1);
-
- RenderFontCr(*_fontInfo,
+ RenderFont(*_fontInfo,
penPosition,
- active,
- "Active Instruments:"
+ color,
+ "%s%s",
+ space.c_str(), incidentTargets.second[p].c_str()
+ );
+
+
+ for (int k = 0; k < incidentTargets.second[p].size() + 2; k++)
+ space += " ";
+ }
+#endif
+ penPosition.y -= _fontInfo->height();
+
+ std::map activeMap = ImageSequencer::ref().getActiveInstruments();
+ glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1);
+ glm::vec4 notFiring(0.5, 0.5, 0.5, 1);
+
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ active,
+ "Active Instruments:"
);
- for (auto m : activeMap) {
- if (m.second == false) {
- RenderFont(*_fontInfo,
- penPosition,
- glm::vec4(0.3, 0.3, 0.3, 1),
- "| |"
- );
- RenderFontCr(*_fontInfo,
- penPosition,
- glm::vec4(0.3, 0.3, 0.3, 1),
- " %5s",
- m.first.c_str()
- );
+ for (auto m : activeMap) {
+ if (m.second == false) {
+ RenderFont(*_fontInfo,
+ penPosition,
+ glm::vec4(0.3, 0.3, 0.3, 1),
+ "| |"
+ );
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ glm::vec4(0.3, 0.3, 0.3, 1),
+ " %5s",
+ m.first.c_str()
+ );
- }
- else {
+ }
+ else {
+ RenderFont(*_fontInfo,
+ penPosition,
+ glm::vec4(0.3, 0.3, 0.3, 1),
+ "|"
+ );
+ if (m.first == "NH_LORRI") {
RenderFont(*_fontInfo,
penPosition,
- glm::vec4(0.3, 0.3, 0.3, 1),
- "|"
- );
- if (m.first == "NH_LORRI") {
- RenderFont(*_fontInfo,
- penPosition,
- firing,
- " + "
- );
- }
- RenderFont(*_fontInfo,
- penPosition,
- glm::vec4(0.3, 0.3, 0.3, 1),
- " |"
- );
- RenderFontCr(*_fontInfo,
- penPosition,
- active,
- " %5s",
- m.first.c_str()
+ firing,
+ " + "
);
}
+ RenderFont(*_fontInfo,
+ penPosition,
+ glm::vec4(0.3, 0.3, 0.3, 1),
+ " |"
+ );
+ RenderFontCr(*_fontInfo,
+ penPosition,
+ active,
+ " %5s",
+ m.first.c_str()
+ );
}
}
}
-#endif
}
+#endif
}
}
@@ -1366,9 +1368,6 @@ void RenderEngine::renderVersionInformation() {
OPENSPACE_GIT_COMMIT
);
-
-
-
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(
@@ -1407,11 +1406,11 @@ void RenderEngine::renderScreenLog() {
_log->removeExpiredEntries();
const int max = 10;
- const int category_length = 20;
- const int msg_length = 140;
+ const int categoryLength = 20;
+ const int messageLength = 140;
std::chrono::seconds fade(5);
- auto entries = _log->entries();
+ const std::vector& entries = _log->entries();
auto lastEntries =
entries.size() > max ?
std::make_pair(entries.rbegin(), entries.rbegin() + max) :
@@ -1431,65 +1430,62 @@ void RenderEngine::renderScreenLog() {
auto d = (diff - ttf).count();
auto t = static_cast(d) / static_cast(fade.count());
float p = 0.8f - t;
- alpha = (p <= 0.f) ? 0.f : pow(p, 0.3f);
+ alpha = (p <= 0.f) ? 0.f : pow(p, 0.4f);
}
// Since all log entries are ordered, once one exceeds alpha, all have
- if (alpha <= 0.0)
+ if (alpha <= 0.0) {
break;
+ }
const std::string lvl = "(" + ghoul::logging::stringFromLevel(e->level) + ")";
- const std::string& message = e->message.substr(0, msg_length);
+ const std::string& message = e->message.substr(0, messageLength);
nr += std::count(message.begin(), message.end(), '\n');
- const glm::vec4 White(0.9f, 0.9f, 0.9f, 1.0f);
+ const glm::vec4 white(0.9f, 0.9f, 0.9f, alpha);
RenderFont(
*_fontLog,
glm::vec2(10.f, _fontLog->pointSize() * nr * 2),
- White * alpha,
- "%-14s %s%s", // Format
- e->timeString.c_str(), // Time string
- e->category.substr(0, category_length).c_str(), // Category string
- e->category.length() > 20 ? "..." : ""); // Pad category with "..."
-
- const glm::vec4 Red(1.f, 0.f, 0.f, 1.f);
- const glm::vec4 Yellow(1.f, 1.f, 0.f, 1.f);
- const glm::vec4 Green(0.f, 1.f, 0.f, 1.f);
- const glm::vec4 Blue(0.f, 0.f, 1.f, 1.f);
+ white,
+ "%-14s %s%s",
+ e->timeString.c_str(),
+ e->category.substr(0, categoryLength).c_str(),
+ e->category.length() > 20 ? "..." : "");
glm::vec4 color(glm::uninitialize);
switch (e->level) {
- case ghoul::logging::LogLevel::Debug:
- color = Green;
- break;
- case ghoul::logging::LogLevel::Warning:
- color = Yellow;
- break;
- case ghoul::logging::LogLevel::Error:
- color = Red;
- break;
- case ghoul::logging::LogLevel::Fatal:
- color = Blue;
- break;
- default:
- color = White;
- break;
+ case ghoul::logging::LogLevel::Debug:
+ color = glm::vec4(0.f, 1.f, 0.f, alpha);
+ break;
+ case ghoul::logging::LogLevel::Warning:
+ color = glm::vec4(1.f, 1.f, 0.f, alpha);
+ break;
+ case ghoul::logging::LogLevel::Error:
+ color = glm::vec4(1.f, 0.f, 0.f, alpha);
+ break;
+ case ghoul::logging::LogLevel::Fatal:
+ color = glm::vec4(0.3f, 0.3f, 0.85f, alpha);
+ break;
+ default:
+ color = white;
+ break;
}
- // const float font_with_light = 5;
RenderFont(
*_fontLog,
glm::vec2(10 + 39 * _fontLog->pointSize(), _fontLog->pointSize() * nr * 2),
- color * alpha,
- "%s", // Format
- lvl.c_str()); // Pad category with "..." if exceeds category_length
+ color,
+ "%s",
+ lvl.c_str()
+ );
RenderFont(*_fontLog,
glm::vec2(10 + 53 * _fontLog->pointSize(), _fontLog->pointSize() * nr * 2),
- White * alpha,
- "%s", // Format
- message.c_str()); // Pad category with "..." if exceeds category_length
+ white,
+ "%s",
+ message.c_str()
+ );
++nr;
}
}
@@ -1497,22 +1493,9 @@ void RenderEngine::renderScreenLog() {
std::vector RenderEngine::getSyncables() {
if (_camera) {
return _camera->getSyncables();
+ } else {
+ return {};
}
- else {
- return std::vector();
- }
-}
-
-void RenderEngine::sortScreenspaceRenderables() {
- std::sort(
- _screenSpaceRenderables.begin(),
- _screenSpaceRenderables.end(),
- [](const std::shared_ptr& j,
- const std::shared_ptr& i)
- {
- return i->depth() > j->depth();
- }
- );
}
}// namespace openspace
diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp
index 0a6041c06a..8cb07181e9 100644
--- a/src/rendering/screenspacerenderable.cpp
+++ b/src/rendering/screenspacerenderable.cpp
@@ -34,8 +34,6 @@
#include
namespace {
- const char* _loggerCat = "ScreenSpaceRenderable";
-
const char* KeyType = "Type";
const char* KeyTag = "Tag";
const float PlaneDepth = -2.f;
diff --git a/src/scene/scale.cpp b/src/scene/scale.cpp
index dae3cf2ae1..da0b9efc35 100644
--- a/src/scene/scale.cpp
+++ b/src/scene/scale.cpp
@@ -72,12 +72,17 @@ std::unique_ptr Scale::createFromDictionary(const ghoul::Dictionary& dict
Scale::Scale()
: properties::PropertyOwner({ "Scale" })
+ , _scale(1.0)
{}
bool Scale::initialize() {
return true;
}
-
+
+double Scale::scaleValue() const {
+ return _scale;
+}
+
void Scale::update(const UpdateData&) {}
} // namespace openspace
diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp
index b9c77b4614..436bc12a9b 100644
--- a/src/scene/scene.cpp
+++ b/src/scene/scene.cpp
@@ -139,6 +139,10 @@ void Scene::removeNode(SceneGraphNode* node, UpdateDependencies updateDeps) {
}
}
+void Scene::addSceneLicense(SceneLicense license) {
+ _licenses.push_back(std::move(license));
+}
+
void Scene::updateDependencies() {
sortTopologically();
}
@@ -272,6 +276,11 @@ const std::vector& Scene::allSceneGraphNodes() const {
return _topologicallySortedNodes;
}
+void Scene::writeSceneLicenseDocumentation(const std::string& path) const {
+ SceneLicenseWriter writer(_licenses);
+ writer.writeDocumentation(path);
+}
+
std::string Scene::generateJson() const {
std::function createJson =
[&createJson](properties::PropertyOwner* owner) -> std::string
@@ -407,6 +416,13 @@ scripting::LuaLibrary Scene::luaLibrary() {
&luascriptfunctions::removeSceneGraphNode,
"string",
"Removes the SceneGraphNode identified by name"
+ },
+ {
+ "hasSceneGraphNode",
+ &luascriptfunctions::hasSceneGraphNode,
+ "string",
+ "Checks whether the specifies SceneGraphNode is present in the current "
+ "scene"
}
}
};
diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl
index 4dc36497bc..e8d05672eb 100644
--- a/src/scene/scene_lua.inl
+++ b/src/scene/scene_lua.inl
@@ -390,4 +390,16 @@ int removeSceneGraphNode(lua_State* L) {
return 1;
}
+
+int hasSceneGraphNode(lua_State* L) {
+ int nArguments = lua_gettop(L);
+ SCRIPT_CHECK_ARGUMENTS("removeSceneGraphNode", L, 1, nArguments);
+
+ std::string nodeName = luaL_checkstring(L, -1);
+ SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(nodeName);
+
+ lua_pushboolean(L, node != nullptr);
+ return 1;
+}
+
} // namespace openspace::luascriptfunctions
diff --git a/src/scene/scenelicense.cpp b/src/scene/scenelicense.cpp
new file mode 100644
index 0000000000..9718e11925
--- /dev/null
+++ b/src/scene/scenelicense.cpp
@@ -0,0 +1,94 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+namespace {
+ const char* LicenseKeyName = "Name";
+ const char* LicenseKeyAttribution = "Attribution";
+ const char* LicenseKeyUrl = "URL";
+ const char* LicenseKeyLicenseText = "License";
+} // namespace
+
+namespace openspace {
+
+documentation::Documentation SceneLicense::Documentation() {
+ using namespace documentation;
+
+ return {
+ "License Information",
+ "core_license",
+ {
+ {
+ LicenseKeyName,
+ new StringVerifier,
+ Optional::No,
+ "A short, descriptive name for the license employed for this node."
+ },
+ {
+ LicenseKeyAttribution,
+ new StringVerifier,
+ Optional::No,
+ "The organization that shall be attributed to the licensed content."
+ },
+ {
+ LicenseKeyUrl,
+ new StringVerifier,
+ Optional::Yes,
+ "The URL pointing to the original license."
+ },
+ {
+ LicenseKeyLicenseText,
+ new StringVerifier,
+ Optional::No,
+ "The full text of the license agreements."
+ }
+ }
+ };
+}
+
+SceneLicense::SceneLicense(const ghoul::Dictionary& dictionary, std::string m)
+ : module(std::move(m))
+{
+ ghoul_assert(!module.empty(), "Module name must not be empty");
+
+ documentation::testSpecificationAndThrow(Documentation(), dictionary, "SceneLicense");
+
+ name = dictionary.value(LicenseKeyName);
+ attribution = dictionary.value(LicenseKeyAttribution);
+ dictionary.getValue(LicenseKeyUrl, url);
+ licenseText = dictionary.value(LicenseKeyLicenseText);
+}
+
+} // namespace openspace
diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp
new file mode 100644
index 0000000000..454ae4afbd
--- /dev/null
+++ b/src/scene/scenelicensewriter.cpp
@@ -0,0 +1,82 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#include
+
+#include
+
+namespace {
+ const char* MainTemplateFilename = "${OPENSPACE_DATA}/web/scenelicense/main.hbs";
+ const char* SceneLicenseTemplateFilename = "${OPENSPACE_DATA}/web/scenelicense/scenelicense.hbs";
+ const char* JsFilename = "${OPENSPACE_DATA}/web/scenelicense/script.js";
+} // namespace
+
+namespace openspace {
+
+SceneLicenseWriter::SceneLicenseWriter(const std::vector& licenses)
+ : DocumentationGenerator(
+ "Documentation",
+ "sceneLicenses",
+ {
+ { "sceneLicenseTemplate", SceneLicenseTemplateFilename },
+ { "mainTemplate", MainTemplateFilename }
+ },
+ JsFilename
+ )
+ , _licenses(licenses)
+{}
+
+std::string SceneLicenseWriter::generateJson() const {
+ std::stringstream json;
+ json << "[";
+ for (const SceneLicense& license : _licenses) {
+ json << "{";
+ json << "\"module\": \"" << escapedJson(license.module) << "\", ";
+ json << "\"name\": \"" << escapedJson(license.name) << "\", ";
+ json << "\"attribution\": \"" << escapedJson(license.attribution) << "\", ";
+ json << "\"url\": \"" << escapedJson(license.url) << "\", ";
+ json << "\"licenseText\": \"" << escapedJson(license.licenseText) << "\"";
+ json << "}";
+
+ if (&license != &(_licenses.back())) {
+ json << ",";
+ }
+ }
+
+ json << "]";
+
+
+ std::string jsonString = "";
+ for (const char& c : json.str()) {
+ if (c == '\'') {
+ jsonString += "\\'";
+ } else {
+ jsonString += c;
+ }
+ }
+
+ return jsonString;
+}
+
+} // namespace openspace
diff --git a/src/scene/sceneloader.cpp b/src/scene/sceneloader.cpp
index 8f44613c5d..26568bda9f 100644
--- a/src/scene/sceneloader.cpp
+++ b/src/scene/sceneloader.cpp
@@ -40,6 +40,7 @@ namespace {
const char* KeyPathScene = "ScenePath";
const char* KeyModules = "Modules";
const char* ModuleExtension = ".mod";
+ const char* LicenseExtension = ".license";
//const char* KeyPathModule = "ModulePath";
//const char* RootNodeName = "Root";
@@ -97,6 +98,7 @@ std::unique_ptr