diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset index 54ac30a42f..63ce8e33b0 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset @@ -59,7 +59,7 @@ local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder -- The initialization with "-" is just a placeholder. -- (needed to be initialized) - Segments = 160, + Segments = 4, EccentricityColumn = "-", SemiMajorAxisColumn = "-", SemiMajorAxisUnit = 1, diff --git a/data/tasks/volume/debristasks/generate_single_debris_volume.task b/data/tasks/volume/debristasks/generate_single_debris_volume.task index c376ce5d1b..1a20614a07 100644 --- a/data/tasks/volume/debristasks/generate_single_debris_volume.task +++ b/data/tasks/volume/debristasks/generate_single_debris_volume.task @@ -3,7 +3,7 @@ return {{ Dimensions = {64, 64, 64}, LowerDomainBound = {-0.5, -0.5, -0.5}, UpperDomainBound = {0.5, 0.5, 0.5}, - InputPath = "C:/Users/Jonathan/Documents/exjobb/OpenSpace/sync/url/satellite_tle_data_BreezeMBreakup(18391204735368316775)/files/2012-044.txt", + InputPath = "${SYNC}/url/satellite_tle_data_BreezeMBreakup(18391204735368316775)/files/2012-044.txt", StartTime = "2018-05-04T00:00:00", RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.rawvolume", DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary" diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index 47799cfe70..f9754ba476 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -645,8 +645,8 @@ void RenderableSatellites::render(const RenderData& data, RendererTasks&) { glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)); _programObject->setUniform( - _uniformCache.modelView, - data.camera.combinedViewMatrix() * modelTransform + _uniformCache.modelView, + data.camera.combinedViewMatrix() * modelTransform ); _programObject->setUniform(_uniformCache.projection, data.camera.projectionMatrix()); @@ -655,20 +655,21 @@ void RenderableSatellites::render(const RenderData& data, RendererTasks&) { glLineWidth(_appearance.lineWidth); - const size_t numberOfOrbits = static_cast(_vertexBufferData.size()) / _nSegments; + // const size_t nrOrbits = static_cast(_vertexBufferData.size()) / _nSegments; + const size_t nrOrbits = _TLEData.size(); size_t vertices = 0; //glDepthMask(false); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE) glBindVertexArray(_vertexArray); - for (size_t i = 0; i <= numberOfOrbits; ++i) { + for (size_t i = 0; i < nrOrbits; ++i) { //glDrawArrays(GL_LINE_STRIP, 0, static_cast(_vertexBufferData.size())); // koll p[ vad som ska uppdateras glDrawArrays(GL_LINE_LOOP, vertices, _nSegments); - vertices = vertices + _nSegments + 1; + vertices = vertices + _nSegments; } glBindVertexArray(0); @@ -679,7 +680,7 @@ void RenderableSatellites::render(const RenderData& data, RendererTasks&) { void RenderableSatellites::updateBuffers() { _TLEData = readTLEFile(_path); - const size_t nVerticesPerOrbit = _nSegments + 1; + const size_t nVerticesPerOrbit = _nSegments; _vertexBufferData.resize(_TLEData.size() * nVerticesPerOrbit); size_t orbitindex = 0; @@ -695,7 +696,8 @@ void RenderableSatellites::updateBuffers() { orbit.epoch ); - for (size_t i = 0; i <= _nSegments; ++i) { + + for (size_t i = 0; i < nVerticesPerOrbit; ++i) { size_t index = orbitindex * nVerticesPerOrbit + i; float timeOffset = orbit.period * diff --git a/modules/space/shaders/debrisViz_fs.glsl b/modules/space/shaders/debrisViz_fs.glsl index 35ca1ab8ff..c7265bf112 100644 --- a/modules/space/shaders/debrisViz_fs.glsl +++ b/modules/space/shaders/debrisViz_fs.glsl @@ -25,15 +25,47 @@ #include "fragment.glsl" //#include "floatoperations.glsl" +//layout(location = 0) in vec4 vertex_data; // 1: x, 2: y, 3: z, 4: timeOffset +//layout(location = 1) in vec2 orbit_data; // 1: epoch, 2: period + uniform vec3 color; uniform float opacity = 1.0; +uniform float lineFade; +//uniform double inGameTime; + + in vec4 viewSpacePosition; in vec4 vs_position; -in float fade; +//in float fade; + +//in vec4 vertex_data_out; +//in vec2 orbit_data_out; +in float periodFraction_f; +in float offsetPeriods; Fragment getFragment() { + /* + // calculate nr of periods, get fractional part to know where + // the vertex closest to the debris part is right now + double nrOfPeriods = (inGameTime - orbit_data_out.x) / orbit_data_out.y; + double periodFraction = fract(nrOfPeriods); //mod(nrOfPeriods, 1.0); + float periodFraction_f = float(periodFraction); + + // same procedure for the current vertex + float offsetPeriods = vertex_data_out.w / orbit_data_out.y; + // check difference of these two locations + */ + float vertexDistance = periodFraction_f - offsetPeriods; + + if (vertexDistance < 0.0) { + vertexDistance += 1.0; + } + + float invert = 1.0 - vertexDistance; // * lineFade; + float fade = clamp(invert * lineFade, 0.0, 1.0); + Fragment frag; frag.color = vec4(color, fade * opacity); frag.depth = vs_position.w; diff --git a/modules/space/shaders/debrisViz_vs.glsl b/modules/space/shaders/debrisViz_vs.glsl index ecf6358a7a..acfd87c5b9 100644 --- a/modules/space/shaders/debrisViz_vs.glsl +++ b/modules/space/shaders/debrisViz_vs.glsl @@ -32,33 +32,40 @@ layout (location = 1) in vec2 orbit_data; // 1: epoch, 2: period uniform dmat4 modelViewTransform; uniform mat4 projectionTransform; -uniform float lineFade; +//uniform float lineFade; uniform double inGameTime; out vec4 viewSpacePosition; out vec4 vs_position; -out float fade; +//out float fade; + +//out vec4 vertex_data_out; +//out vec2 orbit_data_out; +out float periodFraction_f; +out float offsetPeriods; + void main() { + // calculate nr of periods, get fractional part to know where // the vertex closest to the debris part is right now double nrOfPeriods = (inGameTime - orbit_data.x) / orbit_data.y; double periodFraction = fract(nrOfPeriods); //mod(nrOfPeriods, 1.0); - float periodFraction_f = float(periodFraction); + periodFraction_f = float(periodFraction); // same procedure for the current vertex - float offsetPeriods = vertex_data.w / orbit_data.y; - - // check difference of these two locations + offsetPeriods = vertex_data.w / orbit_data.y; + /*// check difference of these two locations float vertexDistance = periodFraction_f - offsetPeriods; - + if(vertexDistance < 0.0) { vertexDistance += 1.0; } float invert = 1.0 - vertexDistance; // * lineFade; - fade = clamp(invert * lineFade, 0.0, 1.0) ; - + fade = clamp(invert * lineFade, 0.0, 1.0) ;*/ + //vertex_data_out = vertex_data; + //orbit_data_out = orbit_data; viewSpacePosition = vec4(modelViewTransform * dvec4(vertex_data.xyz, 1)); vs_position = z_normalization( projectionTransform * viewSpacePosition); diff --git a/modules/space/tasks/generatedebrisvolumetask.cpp b/modules/space/tasks/generatedebrisvolumetask.cpp index 56fb92ba67..cad864fc88 100644 --- a/modules/space/tasks/generatedebrisvolumetask.cpp +++ b/modules/space/tasks/generatedebrisvolumetask.cpp @@ -473,13 +473,7 @@ GenerateDebrisVolumeTask::GenerateDebrisVolumeTask(const ghoul::Dictionary& dict // since _inputPath is past from task, // there will have to be either one task per dataset, // or you need to combine the datasets into one file. - _inputPath = dictionary.value(KeyInputPath); - - // _inputPath1 = dictionary.value(KeyInputPath1); - // _inputPath2 = dictionary.value(KeyInputPath2); - // _inputPath3 = dictionary.value(KeyInputPath3); - // _inputPath4 = dictionary.value(KeyInputPath4); - + _inputPath = absPath(dictionary.value(KeyInputPath)); _lowerDomainBound = dictionary.value(KeyLowerDomainBound); _upperDomainBound = dictionary.value(KeyUpperDomainBound);