diff --git a/data b/data index 54af421ff5..f3928948f2 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 54af421ff583392c559748983251da6521c73c8a +Subproject commit f3928948f25ac520240a4c7a6ac280b278ddf3b7 diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index c03113dc79..a0d2a1001c 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -630,6 +630,42 @@ public: */ bool getFieldOfView(int instrument, std::string& fovShape, std::string& frameName, glm::dvec3& boresightVector, std::vector& bounds) const; + + /** + This routine computes a set of points on the umbral or penumbral terminator of + a specified target body, where SPICE models the target shape as an ellipsoid. + \param numberOfPoints - number of points along terminator returned by this method + \param terminatorType - is a string indicating the type of terminator to compute: + umbral or penumbral. The umbral terminator is the boundary of the portion of the + ellipsoid surface in total shadow. The penumbral terminator is the boundary of + the portion of the surface that is completely illuminated. Note that in astronomy + references, the unqualified word "terminator" refers to the umbral terminator. + Here, the unqualified word refers to either type of terminator. + \param lightSource - name of body acting as light source + \param observer - name of bodserving body + \param target - name of target body + \param frame - name of the reference frame relative to which the output terminator + points are expressed. + \param aberrationCorrection - correction for light time and/or stellar aberration + \param ephemerisTime - the epoch of participation of the observer + \param targetEpoch - is the "target epoch.", time it takes for + \param observerPosition - is the vector from the target body at targetEpoch + \param terminatorPoints - an array of points on the umbral or penumbral terminator + of the ellipsoid, as specified by the input argument `numberOfPoints' + For further, more specific details please refer to + http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/edterm_c.html + */ + bool getTerminatorEllipse(const int numberOfPoints, + const std::string terminatorType, + const std::string lightSource, + const std::string observer, + const std::string target, + const std::string frame, + const std::string aberrationCorrection, + double ephemerisTime, + double& targetEpoch, + glm::dvec3& observerPosition, + std::vector& terminatorPoints); /** * This function adds a frame to a body diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index 4bb27bf458..ef7108646b 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -28,6 +28,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -51,6 +55,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _texturePath("texture", "Texture") , _billboard("billboard", "Billboard", false) + , _projectionListener("projectionListener", "DisplayProjections", false) , _size("size", "Size", glm::vec2(1,1), glm::vec2(0.f), glm::vec2(1.f, 25.f)) , _origin(Origin::Center) , _shader(nullptr) @@ -63,6 +68,10 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) dictionary.getValue("Size", size); _size = size; + if (dictionary.hasKey("Name")){ + dictionary.getValue("Name", _nodeName); + } + std::string origin; if (dictionary.getValue("Origin", origin)) { if (origin == "LowerLeft") { @@ -87,6 +96,13 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) if (dictionary.getValue("Billboard", billboard)) { _billboard = billboard; } + if (dictionary.hasKey("ProjectionListener")){ + bool projectionListener = false; + if (dictionary.getValue("ProjectionListener", projectionListener)) { + _projectionListener = projectionListener; + } + } + std::string texturePath = ""; bool success = dictionary.getValue("Texture", texturePath); @@ -147,8 +163,12 @@ bool RenderablePlane::deinitialize() { glDeleteBuffers(1, &_vertexPositionBuffer); _vertexPositionBuffer = 0; - delete _texture; - _texture = nullptr; + if (!_projectionListener){ + // its parents job to kill texture + // iff projectionlistener + delete _texture; + _texture = nullptr; + } delete _textureFile; _textureFile = nullptr; @@ -166,6 +186,18 @@ void RenderablePlane::render(const RenderData& data) { // Activate shader _shader->activate(); + if (_projectionListener){ + //get parent node-texture and set with correct dimensions + SceneGraphNode* textureNode = OsEng.renderEngine()->scene()->sceneGraphNode(_nodeName)->parent(); + if (textureNode != nullptr){ + RenderablePlanetProjection *t = static_cast(textureNode->renderable()); + _texture = t->baseTexture(); + float h = _texture->height(); + float w = _texture->width(); + float scale = h / w; + transform = glm::scale(transform, glm::vec3(1.f, scale, 1.f)); + } + } _shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); _shader->setUniform("ModelTransform", transform); diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h index 60effc4c5e..e4301cd7f0 100644 --- a/modules/base/rendering/renderableplane.h +++ b/modules/base/rendering/renderableplane.h @@ -68,9 +68,11 @@ private: properties::StringProperty _texturePath; properties::BoolProperty _billboard; + properties::BoolProperty _projectionListener; properties::Vec2Property _size; Origin _origin; + std::string _nodeName; bool _planeIsDirty; diff --git a/modules/newhorizons/newhorizonsmodule.cpp b/modules/newhorizons/newhorizonsmodule.cpp index 4ec0ff04d6..8a1570fcf2 100644 --- a/modules/newhorizons/newhorizonsmodule.cpp +++ b/modules/newhorizons/newhorizonsmodule.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -63,6 +64,7 @@ bool NewHorizonsModule::initialize() { auto fRenderable = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "No renderable factory existed"); + fRenderable->registerClass("RenderableShadowCylinder"); fRenderable->registerClass("RenderableCrawlingLine"); fRenderable->registerClass("RenderableFov"); fRenderable->registerClass("RenderablePlaneProjection"); diff --git a/modules/newhorizons/rendering/renderablefov.cpp b/modules/newhorizons/rendering/renderablefov.cpp index 43e8a941a4..bc5f378de9 100644 --- a/modules/newhorizons/rendering/renderablefov.cpp +++ b/modules/newhorizons/rendering/renderablefov.cpp @@ -531,12 +531,12 @@ void RenderableFov::render(const RenderData& data) { psc position; double lt; SpiceManager::ref().getTargetPosition(_fovTarget, - _spacecraft, - _frame, - _aberrationCorrection, - _time, - position, - lt); + _spacecraft, + _frame, + _aberrationCorrection, + _time, + position, + lt); //if aimed 80 deg away from target, dont draw white square if (glm::dot(glm::normalize(aim), glm::normalize(position.vec3())) < 0.2){ diff --git a/modules/newhorizons/rendering/renderableplanetprojection.h b/modules/newhorizons/rendering/renderableplanetprojection.h index 01c8971fb3..de9a15d541 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.h +++ b/modules/newhorizons/rendering/renderableplanetprojection.h @@ -67,6 +67,7 @@ public: void render(const RenderData& data) override; void update(const UpdateData& data) override; + ghoul::opengl::Texture* baseTexture() { return _texture; }; protected: @@ -91,7 +92,6 @@ private: properties::BoolProperty _performProjection; properties::BoolProperty _clearAllProjections; - ghoul::opengl::ProgramObject* _programObject; ghoul::opengl::ProgramObject* _fboProgramObject; diff --git a/modules/newhorizons/rendering/renderableshadowcylinder.cpp b/modules/newhorizons/rendering/renderableshadowcylinder.cpp new file mode 100644 index 0000000000..e0cda86132 --- /dev/null +++ b/modules/newhorizons/rendering/renderableshadowcylinder.cpp @@ -0,0 +1,202 @@ +/***************************************************************************************** +* * +* OpenSpace * +* * +* Copyright (c) 2014-2015 * +* * +* 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 +#include +#include +#include + + +namespace { + const std::string _loggerCat = "RenderablePlane"; + const std::string _keyType = "TerminatorType"; + const std::string _keyLightSource = "LightSource"; + const std::string _keyObserver = "Observer"; + const std::string _keyBody = "Body"; + const std::string _keyBodyFrame = "BodyFrame"; + const std::string _keyMainFrame = "MainFrame"; + const std::string _keyAberration = "Aberration"; +} + +namespace openspace { + RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary) + : Renderable(dictionary) + , _numberOfPoints("amountOfPoints", "Points", 190, 1, 300) + , _shadowLength("shadowLength", "Shadow Length", 0.1, 0.0, 0.5) + , _shader(nullptr) + , _vao(0) + , _vbo(0) +{ + addProperty(_numberOfPoints); + addProperty(_shadowLength); + + bool success = dictionary.getValue(_keyType, _terminatorType); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyLightSource, _lightSource); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyObserver, _observer); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyBody, _body); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyBodyFrame, _bodyFrame); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyMainFrame, _mainFrame); + ghoul_assert(success, ""); + success = dictionary.getValue(_keyAberration, _aberration); + ghoul_assert(success, ""); +} + +RenderableShadowCylinder::~RenderableShadowCylinder() { +} + +bool RenderableShadowCylinder::isReady() const { + bool ready = true; + if (!_shader) + ready &= false; + return ready; +} + +bool RenderableShadowCylinder::initialize() { + glGenVertexArrays(1, &_vao); // generate array + glGenBuffers(1, &_vbo); // generate buffer + createCylinder(); + + bool completeSuccess = true; + _shader = ghoul::opengl::ProgramObject::Build("ShadowProgram", + "${MODULE_NEWHORIZONS}/shaders/terminatorshadow_vs.glsl", + "${MODULE_NEWHORIZONS}/shaders/terminatorshadow_fs.glsl"); + if (!_shader) + return false; + return completeSuccess; +} + +bool RenderableShadowCylinder::deinitialize() { + glDeleteVertexArrays(1, &_vao); + _vao = 0; + glDeleteBuffers(1, &_vbo); + _vbo = 0; + delete _shader; + _shader = nullptr; + return true; +} + +void RenderableShadowCylinder::render(const RenderData& data){ + glm::mat4 _transform = glm::mat4(1.0); + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + _transform[i][j] = static_cast(_stateMatrix[i][j]); + } + } + // Activate shader + _shader->activate(); + + _shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); + _shader->setUniform("ModelTransform", _transform); + setPscUniforms(_shader, &data.camera, data.position); + + glBindVertexArray(_vao); + glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast(_vertices.size())); + glBindVertexArray(0); + + _shader->deactivate(); +} + +void RenderableShadowCylinder::update(const UpdateData& data) { + openspace::SpiceManager::ref().getPositionTransformMatrix(_bodyFrame, _mainFrame, data.time, _stateMatrix); + _time = data.time; + if (_shader->isDirty()) + _shader->rebuildFromFile(); + createCylinder(); +} + +glm::vec4 psc_addition(glm::vec4 v1, glm::vec4 v2) { + float k = 10.f; + float ds = v2.w - v1.w; + if (ds >= 0) { + float p = pow(k, -ds); + return glm::vec4(v1.x*p + v2.x, v1.y*p + v2.y, v1.z*p + v2.z, v2.w); + } + else { + float p = pow(k, ds); + return glm::vec4(v1.x + v2.x*p, v1.y + v2.y*p, v1.z + v2.z*p, v1.w); + } +} + +void RenderableShadowCylinder::createCylinder() { + double targetEpoch; + glm::dvec3 observerPosition; + std::vector terminatorPoints; + SpiceManager::ref().getTerminatorEllipse(_numberOfPoints, + _terminatorType, + _lightSource, + _observer, + _body, + _bodyFrame, + _aberration, + _time, + targetEpoch, + observerPosition, + terminatorPoints); + + glm::dvec3 vecLightSource; + double lt; + bool performs = SpiceManager::ref().getTargetPosition(_body, _lightSource, _mainFrame, _aberration, _time, vecLightSource, lt); + + glm::dmat3 _stateMatrix; + openspace::SpiceManager::ref().getPositionTransformMatrix(_bodyFrame, _mainFrame, _time, _stateMatrix); + + _stateMatrix = glm::inverse(_stateMatrix); + vecLightSource = _stateMatrix * vecLightSource; + + vecLightSource *= _shadowLength; + _vertices.clear(); + + psc endpoint = psc::CreatePowerScaledCoordinate(vecLightSource.x, vecLightSource.y, vecLightSource.z); + for (auto v : terminatorPoints){ + _vertices.push_back(CylinderVBOLayout(v[0], v[1], v[2], v[3])); + glm::vec4 f = psc_addition(v.vec4(), endpoint.vec4()); + _vertices.push_back(CylinderVBOLayout(f[0], f[1], f[2], f[3])); + } + _vertices.push_back(_vertices[0]); + _vertices.push_back(_vertices[1]); + + glBindVertexArray(_vao); // bind array + glBindBuffer(GL_ARRAY_BUFFER, _vbo); // bind buffer + glBufferData(GL_ARRAY_BUFFER, _vertices.size() * sizeof(CylinderVBOLayout), NULL, GL_DYNAMIC_DRAW); // orphaning the buffer, sending NULL data. + glBufferSubData(GL_ARRAY_BUFFER, 0, _vertices.size() * sizeof(CylinderVBOLayout), &_vertices[0]); + + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0); + glBindVertexArray(0); +} + +} // namespace openspace diff --git a/modules/newhorizons/rendering/renderableshadowcylinder.h b/modules/newhorizons/rendering/renderableshadowcylinder.h new file mode 100644 index 0000000000..b5caac7f9f --- /dev/null +++ b/modules/newhorizons/rendering/renderableshadowcylinder.h @@ -0,0 +1,97 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2015 * + * * + * 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 RENDERABLESHADOWCYLINDER_H_ +#define RENDERABLESHADOWCYLINDER_H_ + +#include + +#include +#include +#include + +namespace ghoul { + namespace filesystem { + class File; + } + namespace opengl { + class ProgramObject; + class Texture; + } +} + +namespace openspace { + struct LinePoint; + class RenderableShadowCylinder : public Renderable { + + public: + RenderableShadowCylinder(const ghoul::Dictionary& dictionary); + ~RenderableShadowCylinder(); + + bool initialize() override; + bool deinitialize() override; + + bool isReady() const override; + + void render(const RenderData& data) override; + void update(const UpdateData& data) override; + + private: + struct CylinderVBOLayout { + CylinderVBOLayout(double a1, double a2, double a3, double a4){ + x = a1; + y = a2; + z = a3; + e = a4; + } + float x, y, z, e; + }; + + void createCylinder(); + properties::IntProperty _numberOfPoints; + properties::FloatProperty _shadowLength; + + ghoul::opengl::ProgramObject* _shader; + + glm::dmat3 _stateMatrix; + + GLuint _vao; + GLuint _vbo; + + std::vector _vertices; + + std::string _terminatorType; + std::string _lightSource; + std::string _observer; + std::string _body; + std::string _bodyFrame; + std::string _mainFrame; + std::string _aberration; + + double _time; + }; + +} // namespace openspace +#endif // RENDERABLESHADOWCYLINDER_H_ + diff --git a/modules/newhorizons/shaders/terminatorshadow_fs.glsl b/modules/newhorizons/shaders/terminatorshadow_fs.glsl new file mode 100644 index 0000000000..6fcfc4d90c --- /dev/null +++ b/modules/newhorizons/shaders/terminatorshadow_fs.glsl @@ -0,0 +1,47 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014 * + * * + * 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. * + ****************************************************************************************/ + +#version __CONTEXT__ + +in vec4 vs_point_position; +in vec4 vs_point_velocity; +//in float fade; +//uniform float forceFade; + +uniform vec3 color; + +in vec4 vs_color; + +#include "ABuffer/abufferStruct.hglsl" +#include "ABuffer/abufferAddToBuffer.hglsl" +#include "PowerScaling/powerScaling_fs.hglsl" + +void main() { + vec4 position = vs_point_position; + float depth = pscDepth(position); + + vec4 c = vs_color; + ABufferStruct_t frag = createGeometryFragment(c, position, depth); + addToBuffer(frag); +} \ No newline at end of file diff --git a/modules/newhorizons/shaders/terminatorshadow_vs.glsl b/modules/newhorizons/shaders/terminatorshadow_vs.glsl new file mode 100644 index 0000000000..7f5398e74f --- /dev/null +++ b/modules/newhorizons/shaders/terminatorshadow_vs.glsl @@ -0,0 +1,60 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014 * + * * + * 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. * + ****************************************************************************************/ + +#version __CONTEXT__ + +uniform mat4 ViewProjection; +uniform mat4 ModelTransform; +uniform vec4 objectVelocity; + + + +layout(location = 0) in vec4 in_point_position; + +out vec4 vs_point_position; +out vec4 vs_color; +//out float fade; + +uniform uint nVertices; +//uniform float lineFade; + +#include "PowerScaling/powerScaling_vs.hglsl" + +void main() { + //float id = float(gl_VertexID) / float(nVertices * lineFade); + //fade = 1.0 - id; + + if(mod(gl_VertexID,2) == 0.f){ + vs_color = vec4(1,1,1,0.5); + }else{ + vs_color = vec4(0); + } + + vec4 tmp = in_point_position; + //tmp = psc_to_meter(tmp, vec2(1,0.f)); + vec4 position = pscTransform(tmp, ModelTransform); + vs_point_position = tmp; + position = ViewProjection * position; + gl_Position = z_normalization(position); +} \ No newline at end of file diff --git a/scripts/bind_keys.lua b/scripts/bind_keys.lua index 2c7e85b413..63a4b18286 100644 --- a/scripts/bind_keys.lua +++ b/scripts/bind_keys.lua @@ -53,6 +53,8 @@ openspace.bindKey("6", "openspace.time.setTime('2015-07-14T12:04:35.00'); opensp openspace.bindKey("7", "openspace.time.setTime('2015-07-14T15:02:46.00'); openspace.time.setDeltaTime(100)") ]]-- +openspace.bindKey("i", "local b = openspace.getPropertyValue('PlutoTexture.renderable.enabled'); openspace.setPropertyValue('PlutoTexture.renderable.enabled', not b)") + openspace.bindKey("q", "local b = openspace.getPropertyValue('SunMarker.renderable.enabled'); openspace.setPropertyValue('SunMarker.renderable.enabled', not b)") openspace.bindKey("e", "local b = openspace.getPropertyValue('EarthMarker.renderable.enabled'); openspace.setPropertyValue('EarthMarker.renderable.enabled', not b)") diff --git a/scripts/default_settings.lua b/scripts/default_settings.lua index 38a6dcc523..0f3f2ffcb1 100644 --- a/scripts/default_settings.lua +++ b/scripts/default_settings.lua @@ -8,6 +8,7 @@ openspace.setPropertyValue("SunMarker.renderable.enabled", true) openspace.setPropertyValue("EarthMarker.renderable.enabled", true) openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false) openspace.setPropertyValue("PlutoTrail.renderable.enabled", false) +openspace.setPropertyValue("PlutoTexture.renderable.enabled", false) openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.75) openspace.setPropertyValue("MilkyWay.renderable.segments", 50) diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 1e5219021c..912d9f7cf2 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -957,6 +957,45 @@ bool SpiceManager::getFieldOfView(int instrument, return true; } +bool SpiceManager::getTerminatorEllipse(const int numberOfPoints, + const std::string terminatorType, + const std::string lightSource, + const std::string observer, + const std::string target, + const std::string frame, + const std::string aberrationCorrection, + double ephemerisTime, + double& targetEpoch, + glm::dvec3& observerPosition, + std::vector& terminatorPoints){ + + double(*tpoints)[3] = new double[numberOfPoints][3]; + + edterm_c(terminatorType.c_str(), + lightSource.c_str(), + target.c_str(), + ephemerisTime, + frame.c_str(), + aberrationCorrection.c_str(), + observer.c_str(), + numberOfPoints, + &targetEpoch, + glm::value_ptr(observerPosition), + (double(*)[3])tpoints ); + + bool hasError = checkForError("Error getting " + terminatorType + + "terminator for'" + target + "'"); + if (hasError) + return false; + + for (int i = 0; i < numberOfPoints; i++){ + psc point = psc::CreatePowerScaledCoordinate(tpoints[i][0], tpoints[i][1], tpoints[i][2]); + point[3] += 3; + terminatorPoints.push_back(point); + } + + return true; +} std::string SpiceManager::frameFromBody(const std::string body) const {