From 8e107beeec8ac36d78cb5e2dc8bed4c8c9977a9f Mon Sep 17 00:00:00 2001 From: Jonathan Fransson Date: Thu, 23 May 2019 11:39:40 -0600 Subject: [PATCH] orbit render modifications, unfinished --- .../volume/generated/singleDebris.dictionary | 1 - .../volume/generated/singleDebris.rawvolume | Bin 16384 -> 0 bytes .../volume/generated1/singleDebris.dictionary | 1 - .../volume/generated1/singleDebris.rawvolume | Bin 16384 -> 0 bytes .../volume/generated2/singleDebris.dictionary | 1 - .../volume/generated2/singleDebris.rawvolume | Bin 16384 -> 0 bytes .../volume/generated3/singleDebris.dictionary | 1 - .../volume/generated3/singleDebris.rawvolume | Bin 16384 -> 0 bytes .../volume/generated4/singleDebris.dictionary | 1 - .../volume/generated4/singleDebris.rawvolume | Bin 16384 -> 0 bytes .../earth/satellites/debris_shared.asset | 2 +- .../generate_single_debris_volume.task | 2 +- .../space/rendering/renderablesatellites.cpp | 20 ++++++----- modules/space/shaders/debrisViz_fs.glsl | 34 +++++++++++++++++- modules/space/shaders/debrisViz_vs.glsl | 25 ++++++++----- .../space/tasks/generatedebrisvolumetask.cpp | 2 +- 16 files changed, 63 insertions(+), 27 deletions(-) delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.rawvolume delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated1/singleDebris.dictionary delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated1/singleDebris.rawvolume delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated2/singleDebris.dictionary delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated2/singleDebris.rawvolume delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.dictionary delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.rawvolume delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated4/singleDebris.dictionary delete mode 100644 data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated4/singleDebris.rawvolume diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary b/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary deleted file mode 100644 index 2d4e260eb3..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.dictionary +++ /dev/null @@ -1 +0,0 @@ -return {Dimensions={1.600000E1,1.600000E1,1.600000E1},GridType="Cartesian",LowerDomainBound={-0.500000E0,-0.500000E0,-0.500000E0},MaxValue=1.000000E0,MinValue=0,Time="2018-05-04T00:00:00.000",UpperDomainBound={0.500000E0,0.500000E0,0.500000E0}} \ No newline at end of file diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.rawvolume b/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/singleDebris.rawvolume deleted file mode 100644 index 75046d1c90ead0f09643f89d46780f30d190c412..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI!(G7qg3XRMQ4*gf~~j2x55WJa8RahZDdYysI8I`e7|FCcx@7a6Z!4 zfd~S!F896>I3?Rpsp}7Y7 zT40_g;7>3M%+b>)@8aA~@*f;unQxc!?faPg*0&=^>KYx5*0+QF?i!&hj<)jQOAUX3 zPx(g7hPi0W2LoAy^>R$(_#WKLyC>KGjg$M&=V%`pr~53o-AH_|=58bU--)fE!Myr= zLM>XozvUgJP6gGj=B!t*hEcw1ilL0UMtiJls3iF95KFg;V-73s+_x(J$!jCWPG7^n zb^KtT_r0!>dm9_ti>s{}DYOYR_2z?71 z=DoaSJY%dp3H(u5vHJwys?*YR>oL9+kC+?9CQlR3NN zqod3C8k^KJb3dER9!=ceWaPh0@PonU-5TwmSbVf3I`eRy@VFWvxTY`{E#E=Xb98*; z6XLhh_#K#q%o2XB_|ZKrt1f#Ou>R(r6hy|g^7V9jeof_^(_ZeP%qM@tv*zCKCMAEz zI%{mkTpg3&lM&1MM`7jKC-_!=@>_dX)@J3WKSHAiX~fV+4X=*W;D!R4~;(&Yq3-hdgR*G@chc7k*v`bkF2_|7Z3s zf=8=yYC89yegUtU3;tG2lbZ{2?g({hJv=n{X@IZ)19Otdz#ZZL3A}akj_r*aHu$=0 zM2w|RZlDc9@4FzF#+vgOuRU1#dz|I}?>oSK$Tp)ca(n}hXT)=KPkBzVg#y&%d<)DG z8!-zY&hcC$?^{58*4Z%5a~L&2j`9Ry ztOd_YrPmZFoHts<{2IQF4sic_=iTc>l`yI2v{rC!}NPOT?43oUyt_^7)1c@bup^4`Qu`?^CQr~KmxSCsGeBM%uVXP zS}UikiJMOXTLO3v#x~wxcSQSFB0rvu0Pf4#3@6pwIaAh1A4$edTb2OnN1`nYbfmEu z8Qjw{dfyfxS1k&fo0Q=Na*MDQgfZ_}(focST|4W=U Y-#)dpetJki0@D$od-rsPE%-+QZwE*s+5i9m diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.dictionary b/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.dictionary deleted file mode 100644 index 259c91c78f..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.dictionary +++ /dev/null @@ -1 +0,0 @@ -return {Dimensions={1.600000E1,1.600000E1,1.600000E1},GridType="Cartesian",LowerDomainBound={-0.500000E0,-0.500000E0,-0.500000E0},MaxValue=8.000000E0,MinValue=0,Time="2018-05-04T00:00:00.000",UpperDomainBound={0.500000E0,0.500000E0,0.500000E0}} \ No newline at end of file diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.rawvolume b/data/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated3/singleDebris.rawvolume deleted file mode 100644 index 096b4f235f06f0881da0912935934c14fb1de894..0000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xOdMjM>UI#oSQCyiv_EPvk4$eMxe&Wl)G6oI(ZcMp^qh2kI=$tLwsBak% z4pq@qfIhbi{M5|h&&=;(k!#(pJ)p-2rj-|dNT0F}@7hA#Ou!sz7UBff1sk2|g7o*L z(&K2jyY$`==iH;xc>;%}Oy1|{U5t9|#G+U&qsMpC>yvsk_&pvdQkUJz^t20>4xN${ zr&j}p>)rEn8MArwrCgBDGH0CtS9r3^9I_)HwG~cO`;GgW8^G@Y@A1Za)a1SI%n?3v z@FRv^Sc2cP|G_)_p)n?Lc^5-}@Kaur&MtETxAW45*yeP-@)?W&zqIiVj`)ZphBsetUniform( - _uniformCache.modelView, - data.camera.combinedViewMatrix() * modelTransform + _uniformCache.modelView, + data.camera.combinedViewMatrix() * modelTransform ); _programObject->setUniform(_uniformCache.projection, data.camera.projectionMatrix()); _programObject->setUniform(_uniformCache.color, _appearance.lineColor); - _programObject->setUniform(_uniformCache.lineFade, _appearance.lineFade); //!!! WHY DOES _lineFade NOT WORK? + _programObject->setUniform(_uniformCache.lineFade, _appearance.lineFade); glLineWidth(_appearance.lineWidth); - const size_t orbits = 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 <= orbits; ++i) { + for (size_t i = 0; i < nrOrbits; ++i) { //glDrawArrays(GL_LINE_STRIP, 0, static_cast(_vertexBufferData.size())); glDrawArrays(GL_LINE_LOOP, vertices, _nSegments); - vertices = vertices + _nSegments + 1; + vertices = vertices + _nSegments; } glBindVertexArray(0); @@ -677,7 +678,7 @@ void RenderableSatellites::updateBuffers() { _TLEData = readTLEFile(_path); LINFO(fmt::format("Pathpath: {} ", _path)); - const size_t nVerticesPerOrbit = _nSegments + 1; + const size_t nVerticesPerOrbit = _nSegments; _vertexBufferData.resize(_TLEData.size() * nVerticesPerOrbit); size_t orbitindex = 0; @@ -693,7 +694,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 725246f901..6ed30bcbb7 100644 --- a/modules/space/tasks/generatedebrisvolumetask.cpp +++ b/modules/space/tasks/generatedebrisvolumetask.cpp @@ -466,7 +466,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); + _inputPath = absPath(dictionary.value(KeyInputPath)); _lowerDomainBound = dictionary.value(KeyLowerDomainBound); _upperDomainBound = dictionary.value(KeyUpperDomainBound);