diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index 2e1e05465e..861d3bb4f2 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -624,15 +624,31 @@ void RenderableSatellites::updateBuffers() { glm::dvec3 position = _keplerTranslator.debrisPos(timeOffset + orbit.epoch); - _vertexBufferData[index].x = static_cast(_keplerTranslator.debrisPos(timeOffset + orbit.epoch).x); - _vertexBufferData[index].y = static_cast(position.y); - _vertexBufferData[index].z = static_cast(position.z); + double positionX = position.x / 10000000; // 10 miljon + double positionY = position.y / 10000000; // 10 miljon + double positionZ = position.z / 10000000; // 10 miljon + + LINFO(fmt::format(" real/ :{}", positionX)); + LINFO(fmt::format(" float :{}", static_cast(positionX))); + LINFO(fmt::format(" diff :{}", positionX-static_cast(positionX))); + + + + + _vertexBufferData[index].x = static_cast(positionX); + _vertexBufferData[index].y = static_cast(positionY); + _vertexBufferData[index].z = static_cast(positionZ); _vertexBufferData[index].time = static_cast(timeOffset); _vertexBufferData[index].epoch = static_cast(orbit.epoch); _vertexBufferData[index].period = static_cast(orbit.period); - // The difference in the print below resulted in large differences, up to 0.23. + // The difference in the print below resulted in large differences, up to 0.35. //LINFO(fmt::format("diff : {} ", position.x - _vertexBufferData[index].x)); + // auto utskrift = positionX-(static_cast(positionX) / 10000000); + // LINFO(fmt::format(" vafan!? :{}", utskrift)); + // LINFO(fmt::format(" x-positions float :{}", static_cast(position.x))); + // LINFO(fmt::format(" x-positions float * 10000 :{}", static_cast(position.x * 10000))); + // LINFO(fmt::format(" x-positions float * 10000 /10000 :{}", static_cast(position.x * 10000)/10000)); } diff --git a/modules/space/shaders/debrisViz_vs.glsl b/modules/space/shaders/debrisViz_vs.glsl index 59f325f5ed..b13d4c1c83 100644 --- a/modules/space/shaders/debrisViz_vs.glsl +++ b/modules/space/shaders/debrisViz_vs.glsl @@ -70,8 +70,8 @@ void main() { // offsetPeriods can also be calculated by passing the vertexID as a float // to the fragment shader and deviding it by nrOfSegments. // vertexID_f = float(gl_VertexID); - - dvec4 vertexPosition = dvec4(vertex_data.xyz, 1); + dvec3 positions = dvec3(vertex_data.x*10000000, vertex_data.y*10000000, vertex_data.z*10000000); + dvec4 vertexPosition = dvec4(positions, 1); viewSpacePosition = vec4(modelViewTransform * vertexPosition); vs_position = z_normalization( projectionTransform * viewSpacePosition); gl_Position = vs_position;