mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
merge
This commit is contained in:
@@ -780,7 +780,7 @@ int getNearestVertexNeighbour(int whatOrbit) {
|
||||
void RenderableSatellites::render(const RenderData& data, RendererTasks&) {
|
||||
//if (_TLEData.empty())
|
||||
// return;
|
||||
_inGameTime = static_cast<float>(data.time.j2000Seconds());
|
||||
_inGameTime = data.time.j2000Seconds();
|
||||
// -----------------
|
||||
// double nrOfPeriods = (_inGameTime - _vertexBufferData[4].epoch) / _vertexBufferData[4].period;
|
||||
// double periodFraction = std::fmod(nrOfPeriods, 1);
|
||||
|
||||
@@ -25,17 +25,45 @@
|
||||
#include "fragment.glsl"
|
||||
#include "floatoperations.glsl"
|
||||
|
||||
//layout(location = 0) in vec4 vertex; // 1: x, 2: y, 3: z, 4: time
|
||||
// This doesn't work, plz help
|
||||
//layout(location = 1) in vec2 orbit; // 1: epoch, 2: period
|
||||
|
||||
uniform vec3 color;
|
||||
uniform float opacity = 1.0;
|
||||
|
||||
uniform float lineFade;
|
||||
uniform float inGameTime;
|
||||
|
||||
|
||||
in vec4 viewSpacePosition;
|
||||
in vec4 vs_position;
|
||||
//in float nrOfPeriods;
|
||||
//in float offsetPeriods;
|
||||
in float fade;
|
||||
//in vec3 vs_color;
|
||||
//in vec2 vs_texcoord;
|
||||
|
||||
Fragment getFragment() {
|
||||
|
||||
float nrOfPeriods = (inGameTime - orbit.x) / orbit.y;
|
||||
float periodFraction = fract(nrOfPeriods);
|
||||
|
||||
float offsetPeriods = vertex.w / orbit.y;
|
||||
float offsetFraction = offsetPeriods;
|
||||
|
||||
// check difference of these two locations
|
||||
float vertexDistance = periodFraction - offsetFraction;
|
||||
|
||||
if (vertexDistance < 0.0) {
|
||||
vertexDistance += 1.0;
|
||||
}
|
||||
|
||||
float invert = 1.0 - vertexDistance;
|
||||
|
||||
float fade = clamp(invert * lineFade, 0.0, 1.0);
|
||||
|
||||
|
||||
Fragment frag;
|
||||
frag.color = vec4(color, fade * opacity);
|
||||
frag.depth = vs_position.w;
|
||||
|
||||
@@ -34,6 +34,11 @@ layout (location = 0) in vec4 vertex_data; // 1: x, 2: y, 3: z, 4: time
|
||||
layout (location = 1) in vec2 orbit_data; // 1: epoch, 2: period
|
||||
|
||||
|
||||
//layout(location = 0) out vec4 vertex_data; // 1: x, 2: y, 3: z, 4: time
|
||||
// This doesn't work, plz help
|
||||
//layout(location = 1) out vec2 orbit_data; // 1: epoch, 2: period
|
||||
|
||||
|
||||
uniform dmat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
|
||||
@@ -42,16 +47,16 @@ uniform float lineFade;
|
||||
//uniform vec3 debrisPosition;
|
||||
//uniform int* VertexIDs;
|
||||
//uniform int numberOfOrbits;
|
||||
uniform /*double*/float inGameTime;
|
||||
uniform float inGameTime;
|
||||
|
||||
out vec4 viewSpacePosition;
|
||||
out vec4 vs_position;
|
||||
//out float nrOfPeriods;
|
||||
//out float offsetPeriods;
|
||||
out float fade;
|
||||
|
||||
void main() {
|
||||
|
||||
// The error is in line 33 at "location 1"!!
|
||||
|
||||
// calculate nr of periods, get fractional part to know where
|
||||
// the vertex closest to the debris part is right now
|
||||
float nrOfPeriods = (inGameTime - orbit_data.x) / orbit_data.y;
|
||||
@@ -65,7 +70,7 @@ void main() {
|
||||
float vertexDistance = periodFraction - offsetFraction;
|
||||
|
||||
if(vertexDistance < 0.0) {
|
||||
vertexDistance += 1.0;
|
||||
vertexDistance += 1.0;
|
||||
}
|
||||
|
||||
// int vertexID = gl_VertexID;
|
||||
|
||||
Reference in New Issue
Block a user