From 53d34c8dfee4e6a5c87efacd77d8c0a2d07dc9dd Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 11 Feb 2022 11:01:37 +0100 Subject: [PATCH] Add documentation to RenderablePlaneProjection, remove unused parameters --- .../rendering/renderableplaneprojection.cpp | 43 ++++++++----------- .../rendering/renderableplaneprojection.h | 2 - 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index 2a5aab8aeb..45b93d5141 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -45,13 +45,19 @@ namespace { constexpr const char* _loggerCat = "RenderablePlaneProjection"; constexpr const char* GalacticFrame = "GALACTIC"; - // @TODO (emmbr 2022-01-20) Add documentation struct [[codegen::Dictionary(RenderablePlaneProjection)]] Parameters { - std::optional spacecraft; - std::optional instrument; - std::optional moving; - std::optional name; + // The SPICE name of the spacecraft from which the projection is performed + std::string spacecraft; + + // The SPICE name of the instrument that is used to project the image onto this + // RenderablePlaneProjection + std::string instrument; + + // The SPICE name of the default target that is imaged by this planet std::optional defaultTarget; + + // The image that is used on this plane before any image is loaded from the + // ImageSequencerr std::optional texture; }; #include "renderableplaneprojection_codegen.cpp" @@ -60,17 +66,15 @@ namespace { namespace openspace { documentation::Documentation RenderablePlaneProjection::Documentation() { - return codegen::doc("spacecraftinstruments_renderableorbitdisc"); + return codegen::doc("spacecraftinstruments_renderableplaneprojection"); } RenderablePlaneProjection::RenderablePlaneProjection(const ghoul::Dictionary& dict) : Renderable(dict) { const Parameters p = codegen::bake(dict); - _spacecraft = p.spacecraft.value_or(_spacecraft); - _instrument = p.instrument.value_or(_instrument); - _moving = p.moving.value_or(_moving); - _name = p.name.value_or(_name); + _spacecraft = p.spacecraft; + _instrument = p.instrument; _defaultTarget = p.defaultTarget.value_or(_defaultTarget); if (p.texture.has_value()) { @@ -118,7 +122,7 @@ void RenderablePlaneProjection::render(const RenderData& data, RendererTasks&) { _instrument ); - if (!_hasImage || (_moving && !active)) { + if (!_hasImage) { return; } @@ -161,7 +165,7 @@ void RenderablePlaneProjection::update(const UpdateData& data) { const double timePast = std::abs(img.timeRange.start - _previousTime); - if (_moving || _planeIsDirty) { + if (_planeIsDirty) { updatePlane(img, time); } else if (timePast > std::numeric_limits::epsilon()) { @@ -245,9 +249,7 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime ) * bounds[j]; glm::dvec3 cornerPosition = glm::proj(vecToTarget, bounds[j]); - if (!_moving) { - cornerPosition -= vecToTarget; - } + cornerPosition -= vecToTarget; cornerPosition = SpiceManager::ref().frameTransformationMatrix( GalacticFrame, _target.frame, @@ -258,15 +260,6 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime projection[j] = glm::vec3(cornerPosition * 1000.0); } - if (!_moving) { - Scene* scene = global::renderEngine->scene(); - SceneGraphNode* thisNode = scene->sceneGraphNode(_name); - SceneGraphNode* newParent = scene->sceneGraphNode(_target.node); - if (thisNode && newParent) { - thisNode->setParent(*newParent); - } - } - const GLfloat vertex_data[] = { // square of two triangles drawn within fov in target coordinates // x y z w s t @@ -299,7 +292,7 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime reinterpret_cast(sizeof(GLfloat) * 4) ); - if (!_moving && !img.path.empty()) { + if (!img.path.empty()) { _texturePath = img.path; loadTexture(); } diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.h b/modules/spacecraftinstruments/rendering/renderableplaneprojection.h index 5a225883f7..43af1e4258 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.h +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.h @@ -86,8 +86,6 @@ private: std::string frame; std::string node; } _target; - std::string _name = "ImagePlane"; - bool _moving = false; bool _hasImage = false; };