mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
New Additions:
Shadow cylinders extending from planet terminator in opposite dir of sun Plane that displays the global texture map of a planet as projections appear ^latter is an addition to RenderablePlane class, a renderable plane can have boolean keyword "ProjectionListener" - determines whether or not it displays
This commit is contained in:
2
data
2
data
Submodule data updated: 54af421ff5...f3928948f2
@@ -630,6 +630,42 @@ public:
|
||||
*/
|
||||
bool getFieldOfView(int instrument, std::string& fovShape, std::string& frameName,
|
||||
glm::dvec3& boresightVector, std::vector<glm::dvec3>& 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<psc>& terminatorPoints);
|
||||
|
||||
/**
|
||||
* This function adds a frame to a body
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/constants.h>
|
||||
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <modules/newhorizons/rendering/renderableplanetprojection.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
@@ -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<RenderablePlanetProjection*>(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);
|
||||
|
||||
@@ -68,9 +68,11 @@ private:
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::BoolProperty _billboard;
|
||||
properties::BoolProperty _projectionListener;
|
||||
properties::Vec2Property _size;
|
||||
|
||||
Origin _origin;
|
||||
std::string _nodeName;
|
||||
|
||||
bool _planeIsDirty;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <modules/newhorizons/rendering/planetgeometryprojection.h>
|
||||
#include <modules/newhorizons/rendering/renderablecrawlingline.h>
|
||||
#include <modules/newhorizons/rendering/renderableshadowcylinder.h>
|
||||
#include <modules/newhorizons/rendering/renderablefov.h>
|
||||
#include <modules/newhorizons/rendering/renderableplaneprojection.h>
|
||||
#include <modules/newhorizons/rendering/renderableplanetprojection.h>
|
||||
@@ -63,6 +64,7 @@ bool NewHorizonsModule::initialize() {
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "No renderable factory existed");
|
||||
|
||||
fRenderable->registerClass<RenderableShadowCylinder>("RenderableShadowCylinder");
|
||||
fRenderable->registerClass<RenderableCrawlingLine>("RenderableCrawlingLine");
|
||||
fRenderable->registerClass<RenderableFov>("RenderableFov");
|
||||
fRenderable->registerClass<RenderablePlaneProjection>("RenderablePlaneProjection");
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
202
modules/newhorizons/rendering/renderableshadowcylinder.cpp
Normal file
202
modules/newhorizons/rendering/renderableshadowcylinder.cpp
Normal file
@@ -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 <openspace/engine/configurationmanager.h>
|
||||
#include <modules/newhorizons/rendering/renderableshadowcylinder.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/constants.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
|
||||
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<float>(_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<GLsizei>(_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<psc> 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
|
||||
97
modules/newhorizons/rendering/renderableshadowcylinder.h
Normal file
97
modules/newhorizons/rendering/renderableshadowcylinder.h
Normal file
@@ -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 <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
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<CylinderVBOLayout> _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_
|
||||
|
||||
47
modules/newhorizons/shaders/terminatorshadow_fs.glsl
Normal file
47
modules/newhorizons/shaders/terminatorshadow_fs.glsl
Normal file
@@ -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);
|
||||
}
|
||||
60
modules/newhorizons/shaders/terminatorshadow_vs.glsl
Normal file
60
modules/newhorizons/shaders/terminatorshadow_vs.glsl
Normal file
@@ -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);
|
||||
}
|
||||
@@ -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)")
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<psc>& 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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user