This commit is contained in:
Elon
2019-05-23 11:52:58 -06:00
6 changed files with 62 additions and 27 deletions

View File

@@ -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,

View File

@@ -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"

View File

@@ -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<GLsizei>(_vertexBufferData.size()) / _nSegments;
// const size_t nrOrbits = static_cast<GLsizei>(_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<GLsizei>(_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 *

View File

@@ -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;

View File

@@ -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);

View File

@@ -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<std::string>(KeyInputPath);
// _inputPath1 = dictionary.value<std::string>(KeyInputPath1);
// _inputPath2 = dictionary.value<std::string>(KeyInputPath2);
// _inputPath3 = dictionary.value<std::string>(KeyInputPath3);
// _inputPath4 = dictionary.value<std::string>(KeyInputPath4);
_inputPath = absPath(dictionary.value<std::string>(KeyInputPath));
_lowerDomainBound = dictionary.value<glm::vec3>(KeyLowerDomainBound);
_upperDomainBound = dictionary.value<glm::vec3>(KeyUpperDomainBound);