2024-02-26 20:00:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
2024-03-04 07:57:42 +00:00
|
|
|
#include "gfx.hpp"
|
2024-02-26 20:00:59 +00:00
|
|
|
#include "icosphere.hpp"
|
|
|
|
#include "widget.hpp"
|
|
|
|
|
2024-03-04 07:57:42 +00:00
|
|
|
#include <GLFW/glfw3.h>
|
2024-08-17 21:51:42 +01:00
|
|
|
#include <skein/orbit.h>
|
2024-03-04 07:57:42 +00:00
|
|
|
|
2024-02-26 20:00:59 +00:00
|
|
|
class Orbiter
|
|
|
|
{
|
|
|
|
public:
|
2024-03-04 07:57:42 +00:00
|
|
|
Orbiter(Icosphere& sphere, Orbit& orbit, GLuint shaderProgram);
|
2024-02-26 20:00:59 +00:00
|
|
|
~Orbiter();
|
|
|
|
|
|
|
|
void render(const float time);
|
|
|
|
|
2024-03-04 07:57:42 +00:00
|
|
|
void cycleAnimation();
|
|
|
|
|
2024-02-26 20:00:59 +00:00
|
|
|
private:
|
|
|
|
void updateModelMatrix();
|
|
|
|
float getMeanAnomaly();
|
|
|
|
glm::vec3 getPosition(const float time);
|
|
|
|
void getOrbitalElements(const float time, Vector6& keplerianElements);
|
|
|
|
|
|
|
|
Icosphere& _sphere;
|
|
|
|
Orbit& _orbit;
|
|
|
|
Widget _widget;
|
|
|
|
|
|
|
|
const float ORBITAL_PERIOD = 6.284;
|
|
|
|
|
2024-03-04 07:57:42 +00:00
|
|
|
// TODO: convert these to an enum
|
2024-02-26 20:00:59 +00:00
|
|
|
const int ANIM_ORBITING = 0;
|
|
|
|
const int ANIM_ECCENTRICITY = 1;
|
2024-03-04 07:57:42 +00:00
|
|
|
|
|
|
|
int _animation = ANIM_ORBITING;
|
2024-02-26 20:00:59 +00:00
|
|
|
};
|