Merge pull request #1048 from OpenSpace/feature/distancelabels

Feature/distancelabels
This commit is contained in:
Alexander Bock
2020-01-24 21:09:16 +01:00
committed by GitHub
9 changed files with 415 additions and 95 deletions
+22 -51
View File
@@ -31,19 +31,19 @@
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/glm.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/misc/crc32.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/crc32.h>
#include <ghoul/misc/defer.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
#include <ghoul/glm.h>
#include <glm/gtx/string_cast.hpp>
namespace {
@@ -640,8 +640,8 @@ void RenderableLabels::render(const RenderData& data, RendererTasks&) {
data.camera.positionVec3(),
data.modelTransform.translation
);
float sUnit = getUnit(_fadeStartUnitOption);
float eUnit = getUnit(_fadeEndUnitOption);
float sUnit = unit(_fadeStartUnitOption);
float eUnit = unit(_fadeEndUnitOption);
float startX = _fadeStartDistance * sUnit;
float endX = _fadeEndDistance * eUnit;
//fadeInVariable = changedPerlinSmoothStepFunc(distanceNodeToCamera, startX, endX);
@@ -683,8 +683,6 @@ void RenderableLabels::render(const RenderData& data, RendererTasks&) {
//}
}
void RenderableLabels::update(const UpdateData&) {
}
void RenderableLabels::setLabelText(const std::string & newText) {
_labelText = newText;
@@ -768,49 +766,22 @@ float RenderableLabels::linearSmoothStepFunc(float x, float startX, float endX,
}
}
float RenderableLabels::getUnit(int unit) const {
float scale = 0.f;
float RenderableLabels::unit(int unit) const {
switch (static_cast<Unit>(unit)) {
case Meter:
scale = 1.f;
break;
case Kilometer:
scale = 1e3;
break;
case Megameter:
scale = 1e6;
break;
case Gigameter:
scale = 1e9;
break;
case AU:
scale = 149597870700.f;
break;
case Terameter:
scale = 1e12;
break;
case Petameter:
scale = 1e15;
break;
case Parsec:
scale = static_cast<float>(PARSEC);
break;
case Kiloparsec:
scale = static_cast<float>(1e3 * PARSEC);
break;
case Megaparsec:
scale = static_cast<float>(1e6 * PARSEC);
break;
case Gigaparsec:
scale = static_cast<float>(1e9 * PARSEC);
break;
case GigalightYears:
scale = static_cast<float>(306391534.73091 * PARSEC);
break;
case Meter: return 1.f;
case Kilometer: return 1e3;
case Megameter: return 1e6;
case Gigameter: return 1e9;
case AU: return 149597870700.f;
case Terameter: return 1e12;
case Petameter: return 1e15;
case Parsec: return static_cast<float>(PARSEC);
case Kiloparsec: return static_cast<float>(1e3 * PARSEC);
case Megaparsec: return static_cast<float>(1e6 * PARSEC);
case Gigaparsec: return static_cast<float>(1e9 * PARSEC);
case GigalightYears: return static_cast<float>(306391534.73091 * PARSEC);
default: throw std::logic_error("Missing case label");
}
return scale;
}
} // namespace openspace
+7 -8
View File
@@ -64,7 +64,6 @@ public:
bool isReady() const override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) override;
static documentation::Documentation Documentation();
@@ -73,7 +72,12 @@ public:
protected:
properties::OptionProperty _blendMode;
private:
float unit(int unit) const;
// Data may require some type of transformation prior the spice transformation being
// applied.
glm::dmat4 _transformationMatrix = glm::dmat4(1.0);
enum Unit {
Meter = 0,
Kilometer,
@@ -89,6 +93,7 @@ private:
GigalightYears
};
private:
void renderLabels(const RenderData& data, const glm::dmat4& modelViewProjectionMatrix,
const glm::dvec3& orthoRight, const glm::dvec3& orthoUp, float fadeInVariable);
@@ -97,8 +102,6 @@ private:
float linearSmoothStepFunc(float x, float startX, float endX, float sUnit,
float eUnit) const;
float getUnit(int unit) const;
properties::Vec4Property _labelColor;
properties::FloatProperty _labelSize;
properties::FloatProperty _fontSize;
@@ -123,10 +126,6 @@ private:
std::string _labelFile;
std::string _colorOptionString;
std::string _datavarSizeOptionString;
// Data may require some type of transformation prior the spice transformation being
// applied.
glm::dmat4 _transformationMatrix = glm::dmat4(1.0);
};
} // namespace openspace
+75 -31
View File
@@ -34,9 +34,11 @@
#include <openspace/scene/translation.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* _loggerCat = "RenderableNodeLine";
constexpr const char* ProgramName = "NodeLineProgram";
constexpr const char* Root = "Root";
@@ -44,12 +46,14 @@ namespace {
"StartNode",
"Start Node",
"The identifier of the node the line starts from. "
"Defaults to 'Root' if not specified. "
};
constexpr openspace::properties::Property::PropertyInfo EndNodeInfo = {
"EndNode",
"End Node",
"The identifier of the node the line ends at. "
"Defaults to 'Root' if not specified. "
};
constexpr openspace::properties::Property::PropertyInfo LineColorInfo = {
@@ -63,6 +67,22 @@ namespace {
"Line Width",
"This value specifies the line width."
};
// Returns a position that is relative to the current anchor node. This is a method to
// handle precision problems that occur when approaching a line end point
glm::dvec3 coordinatePosFromAnchorNode(const glm::dvec3& worldPos) {
using namespace openspace;
glm::dvec3 anchorNodePos(0.0);
const interaction::OrbitalNavigator& nav =
global::navigationHandler.orbitalNavigator();
if (nav.anchorNode()) {
anchorNodePos = nav.anchorNode()->worldPosition();
}
glm::dvec3 diffPos = worldPos - anchorNodePos;
return diffPos;
}
} // namespace
namespace openspace {
@@ -76,13 +96,13 @@ documentation::Documentation RenderableNodeLine::Documentation() {
{
StartNodeInfo.identifier,
new StringVerifier,
Optional::No,
Optional::Yes,
StartNodeInfo.description
},
{
EndNodeInfo.identifier,
new StringVerifier,
Optional::No,
Optional::Yes,
EndNodeInfo.description
},
{
@@ -114,8 +134,13 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
"RenderableNodeLine"
);
_start = dictionary.value<std::string>(StartNodeInfo.identifier);
_end = dictionary.value<std::string>(EndNodeInfo.identifier);
if (dictionary.hasKey(StartNodeInfo.identifier)) {
_start = dictionary.value<std::string>(StartNodeInfo.identifier);
}
if (dictionary.hasKey(EndNodeInfo.identifier)) {
_end = dictionary.value<std::string>(EndNodeInfo.identifier);
}
if (dictionary.hasKey(LineColorInfo.identifier)) {
_lineColor = dictionary.value<glm::vec3>(LineColorInfo.identifier);
@@ -124,6 +149,9 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
_lineWidth = static_cast<float>(dictionary.value<double>(LineWidthInfo.identifier));
}
_start.onChange([&]() { validateNodes(); });
_end.onChange([&]() { validateNodes(); });
addProperty(_start);
addProperty(_end);
addProperty(_lineColor);
@@ -131,6 +159,18 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
addProperty(_opacity);
}
double RenderableNodeLine::distance() const {
return glm::distance(_startPos, _endPos);
}
std::string RenderableNodeLine::start() const {
return _start;
}
std::string RenderableNodeLine::end() const {
return _end;
}
void RenderableNodeLine::initializeGL() {
_program = BaseModule::ProgramObjectManager.request(
ProgramName,
@@ -156,7 +196,6 @@ void RenderableNodeLine::initializeGL() {
}
void RenderableNodeLine::deinitializeGL() {
glDeleteVertexArrays(1, &_vaoId);
_vaoId = 0;
@@ -183,19 +222,21 @@ void RenderableNodeLine::unbindGL() {
glBindVertexArray(0);
}
void RenderableNodeLine::bindGL()
{
void RenderableNodeLine::bindGL() {
glBindVertexArray(_vaoId);
glBindBuffer(GL_ARRAY_BUFFER, _vBufferId);
}
void RenderableNodeLine::updateVertexData()
{
void RenderableNodeLine::updateVertexData() {
_vertexArray.clear();
// Update the positions of the nodes
_startPos = getCoordinatePosFromAnchorNode(global::renderEngine.scene()->sceneGraphNode(_start)->worldPosition());
_endPos = getCoordinatePosFromAnchorNode(global::renderEngine.scene()->sceneGraphNode(_end)->worldPosition());
_startPos = coordinatePosFromAnchorNode(
global::renderEngine.scene()->sceneGraphNode(_start)->worldPosition()
);
_endPos = coordinatePosFromAnchorNode(
global::renderEngine.scene()->sceneGraphNode(_end)->worldPosition()
);
_vertexArray.push_back(_startPos.x);
_vertexArray.push_back(_startPos.y);
@@ -215,14 +256,13 @@ void RenderableNodeLine::updateVertexData()
GL_DYNAMIC_DRAW
);
//update vertex attributes
// update vertex attributes
glVertexAttribPointer(_locVertex, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), nullptr);
unbindGL();
}
void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
updateVertexData();
_program->activate();
@@ -230,7 +270,10 @@ void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
glm::dmat4 anchorTranslation(1.0);
// Update anchor node information, used to counter precision problems
if (global::navigationHandler.orbitalNavigator().anchorNode()) {
anchorTranslation = glm::translate(glm::dmat4(1.0), global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition());
anchorTranslation = glm::translate(
glm::dmat4(1.0),
global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition()
);
}
const glm::dmat4 modelTransform =
@@ -251,8 +294,12 @@ void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
GLfloat currentLineWidth;
glGetFloatv(GL_LINE_WIDTH, &currentLineWidth);
GLenum blendEquationRGB, blendEquationAlpha, blendDestAlpha,
blendDestRGB, blendSrcAlpha, blendSrcRGB;
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
GLenum blendDestAlpha;
GLenum blendDestRGB;
GLenum blendSrcAlpha;
GLenum blendSrcRGB;
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
@@ -284,22 +331,19 @@ void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
}
}
/* Returns a position that is relative to the current
anchor node. This is a method to handle precision
problems that occur when approaching a line end point */
glm::dvec3 RenderableNodeLine::getCoordinatePosFromAnchorNode(glm::dvec3 worldPos) {
glm::dvec3 anchorNodePos(0);
if (global::navigationHandler.orbitalNavigator().anchorNode()) {
anchorNodePos = global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition();
void RenderableNodeLine::validateNodes() {
if (!global::renderEngine.scene()->sceneGraphNode(_start)) {
LERROR(fmt::format(
"There is no scenegraph node with id {}, defaults to 'Root'", _start
));
_start = Root;
}
if (!global::renderEngine.scene()->sceneGraphNode(_end)) {
LERROR(fmt::format(
"There is no scenegraph node with id {}, defaults to 'Root'", _end
));
_end = Root;
}
glm::dvec3 diffPos = glm::dvec3(worldPos.x - anchorNodePos.x, worldPos.y - anchorNodePos.y,
worldPos.z - anchorNodePos.z);
return diffPos;
}
} // namespace openspace
+9 -5
View File
@@ -34,11 +34,10 @@
#include <ghoul/glm.h>
namespace ghoul::opengl { class ProgramObject; }
namespace openspace::documentation { struct Documentation; }
namespace openspace {
namespace documentation { struct Documentation; }
class Translation;
/**
@@ -50,7 +49,13 @@ public:
~RenderableNodeLine() = default;
static documentation::Documentation Documentation();
// Get the distance between the start and end node
double distance() const;
std::string start() const;
std::string end() const;
private:
void initializeGL() override;
void deinitializeGL() override;
@@ -58,12 +63,11 @@ private:
bool isReady() const override;
void updateVertexData();
void render(const RenderData& data, RendererTasks& rendererTask) override;
void validateNodes();
void unbindGL();
void bindGL();
glm::dvec3 getCoordinatePosFromAnchorNode(glm::dvec3 worldPos);
ghoul::opengl::ProgramObject* _program;
/// The vertex attribute location for position
/// must correlate to layout location in vertex shader
+41
View File
@@ -0,0 +1,41 @@
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2020 #
# #
# 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(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledistancelabel.h
)
source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledistancelabel.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})
create_new_module(
"VisLab"
vislab_module
${HEADER_FILES} ${SOURCE_FILES}
)
@@ -0,0 +1,126 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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 <modules/vislab/rendering/renderabledistancelabel.h>
#include <modules/base/rendering/renderablenodeline.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scene.h>
#include <ghoul/logging/logmanager.h>
#include <string>
namespace {
constexpr const char* _loggerCat = "RenderableDistanceLabel";
constexpr openspace::properties::Property::PropertyInfo NodeLineInfo = {
"NodeLine",
"Node Line",
"Property to track a nodeline. When tracking the label text will be updating the "
"distance from the nodeline start and end."
};
}
namespace openspace {
documentation::Documentation RenderableDistanceLabel::Documentation() {
using namespace documentation;
return {
"Renderable Distance Label",
"vislab_renderable_distance_label",
{
{
NodeLineInfo.identifier,
new StringVerifier,
Optional::No,
NodeLineInfo.description
},
}
};
}
RenderableDistanceLabel::RenderableDistanceLabel(const ghoul::Dictionary& dictionary)
: RenderableLabels(dictionary)
, _nodelineId(NodeLineInfo)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableDistanceLabel"
);
if (dictionary.hasKey(NodeLineInfo.identifier)) {
_nodelineId = dictionary.value<std::string>(NodeLineInfo.identifier);
addProperty(_nodelineId);
}
}
void RenderableDistanceLabel::update(const UpdateData&) {
if (_errorThrown) {
return;
}
RenderEngine& RE = global::renderEngine;
SceneGraphNode* nodelineNode = RE.scene()->sceneGraphNode(_nodelineId);
if (nodelineNode) {
// Calculate distance
RenderableNodeLine* nodeline = dynamic_cast<RenderableNodeLine*>(
nodelineNode->renderable()
);
if (!nodeline) {
LERROR("Expected renderable to be of type 'RenderableNodeLine'");
_errorThrown = true;
return;
}
double myDistance = nodeline->distance();
// Format string
float scale = unit(Kilometer);
std::string distanceText = std::to_string(std::round(myDistance / scale));
int pos = static_cast<int>(distanceText.find("."));
std::string subStr = distanceText.substr(pos);
distanceText.erase(pos, subStr.size());
std::string finalText = distanceText + " Km";
setLabelText(finalText);
// Update placement of label with transformation matrix
SceneGraphNode* startNode = RE.scene()->sceneGraphNode(nodeline->start());
glm::dvec3 start = startNode->worldPosition();
SceneGraphNode* endNode = RE.scene()->sceneGraphNode(nodeline->end());
glm::dvec3 end = endNode->worldPosition();
glm::dvec3 goalPos = start + (end - start) / 2.0;
_transformationMatrix = glm::translate(glm::dmat4(1.0), goalPos);
}
else {
LERROR(fmt::format("There is no scenegraph node with id {}", _nodelineId));
_errorThrown = true;
}
}
} // namespace openspace
@@ -0,0 +1,48 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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_MODULE_VISLAB___RENDERABLEDISTANCELABEL___H__
#define __OPENSPACE_MODULE_VISLAB___RENDERABLEDISTANCELABEL___H__
#include <modules/base/rendering/renderablelabels.h>
namespace openspace {
namespace documentation { struct Documentation; }
class RenderableDistanceLabel : public RenderableLabels {
public:
RenderableDistanceLabel(const ghoul::Dictionary& dictionary);
void update(const UpdateData& data) override;
static documentation::Documentation Documentation();
private:
properties::StringProperty _nodelineId;
bool _errorThrown = false;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_VISLAB___RENDERABLEDISTANCELABEL___H__
+43
View File
@@ -0,0 +1,43 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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 <modules/vislab/vislabmodule.h>
#include <modules/vislab/rendering/renderabledistancelabel.h>
#include <openspace/util/factorymanager.h>
#include <ghoul/misc/assert.h>
#include <ghoul/misc/templatefactory.h>
namespace openspace {
VisLabModule::VisLabModule() : OpenSpaceModule(Name) {}
void VisLabModule::internalInitialize(const ghoul::Dictionary&) {
auto renderableFactory = FactoryManager::ref().factory<Renderable>();
ghoul_assert(renderableFactory, "No renderable factory existed");
renderableFactory->registerClass<RenderableDistanceLabel>("RenderableDistanceLabel");
}
} // namespace openspace
+44
View File
@@ -0,0 +1,44 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* 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_MODULE_VISLAB___VISLABMODULE___H__
#define __OPENSPACE_MODULE_VISLAB___VISLABMODULE___H__
#include <openspace/util/openspacemodule.h>
namespace openspace {
class VisLabModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "VisLab";
VisLabModule();
private:
void internalInitialize(const ghoul::Dictionary&) override;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_VISLAB___VISLABMODULE___H__