mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Increase precision of renderable trail and use that for showing the path of OSIRIS-REx.
This commit is contained in:
@@ -211,8 +211,7 @@ return {
|
||||
Position = {0, 0, 0, 1}
|
||||
},
|
||||
},
|
||||
]]
|
||||
|
||||
|
||||
{
|
||||
Name = "OsirisRexPathSolar",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
@@ -259,10 +258,11 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/OsirisRexPathLocal"
|
||||
},
|
||||
]]
|
||||
|
||||
-- Comet Dance trail
|
||||
-- Asteroid Dance trail
|
||||
{
|
||||
Name = "OsirisRexAsteroidTrail",
|
||||
Name = "OsirisRexTrailLocal",
|
||||
Parent = "Bennu2",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
@@ -280,6 +280,28 @@ return {
|
||||
StartTime = "2016 SEP 8 12:00:00",
|
||||
EndTime = "2023 SEP 24 12:00:00"
|
||||
},
|
||||
GuiName = "OsirisRexAsteroidTrail"
|
||||
GuiName = "OsirisRexTrailLocal"
|
||||
},
|
||||
-- Trail relative to Solar system
|
||||
{
|
||||
Name = "OsirisRexTrailSolar",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "OSIRIS-REX",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
TropicalOrbitPeriod = 20000.0,
|
||||
EarthOrbitRatio = 2,
|
||||
DayLength = 25,
|
||||
RGB = { 0.2, 0.9, 0.2 },
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/glare_blue.png"
|
||||
},
|
||||
StartTime = "2016 SEP 8 12:00:00",
|
||||
EndTime = "2023 SEP 24 12:00:00"
|
||||
},
|
||||
GuiName = "OsirisRexTrailSolar"
|
||||
},
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void RenderablePath::render(const RenderData& data) {
|
||||
return;
|
||||
|
||||
|
||||
int nPointsToDraw = (time - _start) / (_stop - _start) * (_vertexArray.size()) + 1 + 0.5;
|
||||
int nPointsToDraw = _vertexArray.size();// (time - _start) / (_stop - _start) * (_vertexArray.size()) + 1 + 0.5;
|
||||
|
||||
_programObject->activate();
|
||||
|
||||
|
||||
@@ -150,16 +150,27 @@ bool RenderableTrail::isReady() const {
|
||||
|
||||
void RenderableTrail::render(const RenderData& data) {
|
||||
_programObject->activate();
|
||||
psc currentPosition = data.position;
|
||||
psc campos = data.camera.position();
|
||||
glm::mat4 camrot = glm::mat4(data.camera.viewRotationMatrix());
|
||||
//psc currentPosition = data.position;
|
||||
//psc campos = data.camera.position();
|
||||
//glm::mat4 camrot = glm::mat4(data.camera.viewRotationMatrix());
|
||||
|
||||
glm::mat4 transform = glm::mat4(1);
|
||||
//glm::mat4 transform = glm::mat4(1);
|
||||
|
||||
// setup the data to the shader
|
||||
_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_programObject->setUniform("ModelTransform", transform);
|
||||
setPscUniforms(*_programObject.get(), data.camera, data.position);
|
||||
//_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
//_programObject->setUniform("ModelTransform", transform);
|
||||
//setPscUniforms(*_programObject.get(), data.camera, data.position);
|
||||
|
||||
// Calculate variables to be used as uniform variables in shader
|
||||
glm::dvec3 bodyPosition = data.positionVec3;
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), bodyPosition); // Only care about translation
|
||||
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
|
||||
|
||||
_programObject->setUniform("modelViewTransform", glm::mat4(modelViewTransform));
|
||||
_programObject->setUniform("projectionTransform", data.camera.projectionMatrix());
|
||||
|
||||
_programObject->setUniform("color", _lineColor);
|
||||
_programObject->setUniform("nVertices", static_cast<unsigned int>(_vertexArray.size()));
|
||||
|
||||
@@ -22,24 +22,20 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
in vec4 vs_point_position;
|
||||
in vec4 vs_point_velocity;
|
||||
in float fade;
|
||||
uniform float forceFade;
|
||||
|
||||
uniform vec3 color;
|
||||
|
||||
in vec4 vs_positionScreenSpace;
|
||||
in float fade;
|
||||
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_point_position;
|
||||
float depth = pscDepth(position);
|
||||
|
||||
vec4 c = vec4(color, fade*forceFade);
|
||||
|
||||
Fragment frag;
|
||||
frag.color = c;
|
||||
frag.depth = depth;
|
||||
|
||||
frag.depth = vs_positionScreenSpace.w;
|
||||
return frag;
|
||||
}
|
||||
}
|
||||
@@ -24,28 +24,28 @@
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform mat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
uniform vec4 objectVelocity;
|
||||
|
||||
layout(location = 0) in vec4 in_point_position;
|
||||
|
||||
out vec4 vs_point_position;
|
||||
|
||||
out float fade;
|
||||
|
||||
uniform uint nVertices;
|
||||
uniform float lineFade;
|
||||
|
||||
layout(location = 0) in vec4 in_point_position;
|
||||
|
||||
out vec4 vs_positionScreenSpace;
|
||||
out float fade;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main() {
|
||||
float id = float(gl_VertexID) / float(nVertices * lineFade);
|
||||
fade = 1.0 - id;
|
||||
|
||||
vec4 tmp = in_point_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
vs_point_position = tmp;
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
// Convert from psc to regular homogenous coordinates
|
||||
vec4 position = vec4(in_point_position.xyz * pow(10, in_point_position.w), 1);
|
||||
vec4 positionClipSpace = projectionTransform * modelViewTransform * position;
|
||||
vs_positionScreenSpace = z_normalization(positionClipSpace);
|
||||
|
||||
gl_Position = vs_positionScreenSpace;
|
||||
}
|
||||
Reference in New Issue
Block a user