fix: remap coordinates to make Y up
This commit is contained in:
parent
11d5330c73
commit
c4edf127e9
|
@ -99,7 +99,7 @@ int main()
|
||||||
// TODO: implement zoom
|
// TODO: implement zoom
|
||||||
//orbit.setSemiMajorAxis(384748); // in km
|
//orbit.setSemiMajorAxis(384748); // in km
|
||||||
orbit.setEccentricity(0.055);
|
orbit.setEccentricity(0.055);
|
||||||
orbit.setInclination(5.15); // degreees
|
orbit.setInclination(glm::radians(5.15)); // radians?
|
||||||
orbit.setArgumentOfPeriapsis(318.15); // in the case of the moon these last two values are
|
orbit.setArgumentOfPeriapsis(318.15); // in the case of the moon these last two values are
|
||||||
orbit.setLongitudeOfAscendingNode(60.0); // pretty much constantly changing so use whatever
|
orbit.setLongitudeOfAscendingNode(60.0); // pretty much constantly changing so use whatever
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,12 @@ void OrbitVisualizer::regenerateVertices()
|
||||||
{
|
{
|
||||||
float t = (float)i / (float)_vertexCount * 2.0 * _pi;
|
float t = (float)i / (float)_vertexCount * 2.0 * _pi;
|
||||||
glm::vec3 pos = _orbit.getPosition(t);
|
glm::vec3 pos = _orbit.getPosition(t);
|
||||||
|
// Vertices come out of the library with X and Y being in the 'flat' plane. Re-order them
|
||||||
|
// here such that Z is up.
|
||||||
|
float y = pos.z;
|
||||||
|
pos.z = pos.y;
|
||||||
|
pos.y = y;
|
||||||
|
pos.z *= -1;
|
||||||
|
|
||||||
_vertices.push_back(pos.x);
|
_vertices.push_back(pos.x);
|
||||||
_vertices.push_back(pos.y);
|
_vertices.push_back(pos.y);
|
||||||
|
|
|
@ -11,6 +11,10 @@ void ParticleVisualizer::render(float time)
|
||||||
// TODO: get mean anomly from particle which has the mass!!
|
// TODO: get mean anomly from particle which has the mass!!
|
||||||
const float meanAnomaly = time;
|
const float meanAnomaly = time;
|
||||||
glm::vec3 pos = _map.getParticlePosition(_particleId, meanAnomaly);
|
glm::vec3 pos = _map.getParticlePosition(_particleId, meanAnomaly);
|
||||||
|
float y = pos.z;
|
||||||
|
pos.z = pos.y;
|
||||||
|
pos.y = y;
|
||||||
|
pos.z *= -1;
|
||||||
|
|
||||||
// TODO: extract widget to its own visualizer since we know it wants an orbit but we
|
// TODO: extract widget to its own visualizer since we know it wants an orbit but we
|
||||||
// might not have one here
|
// might not have one here
|
||||||
|
|
Loading…
Reference in New Issue