You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
1.0 KiB

#pragma once
#include <glm/glm.hpp>
using glm::vec3;
#include "tangerine.h"
#include "orbits.h"
#define DEFAULT_ORBIT_VERTICES 256
const vec3 DEFAULT_ELLIPSE_COLOR = vec3(0.5, 0.5, 0.5);
const vec3 SELECTED_ELLIPSE_COLOR = vec3(0.7, 0.2, 0.2);
struct Ellipse3D
{
vec3* vertices;
uint vert_count;
};
struct GameOrbit
{
TwoBodySystem system;
Ellipse3D e3d;
Entity* grav_body;
Entity* ellipse_entity;
Entity* satellite_entity;
bool in_use;
bool selected;
};
struct GameState
{
bool running;
MemoryArena* arena;
u64 game_time_ms;
u64 sim_time_ms;
float sim_speed;
GameOrbit* orbits;
u32 num_orbits;
u32 max_orbits;
GameOrbit* last_selected_orbit;
};
GameOrbit* getFreeOrbit(GameState* gs);
void disableGameOrbit(GameState* gs, GameOrbit* orbit);
// NOTE: create vertices for a 3d ellipse
// all vertices are in the x/y plane with z = 0
Ellipse3D ellipse3DInit(EllipseParameters ep, uint vert_count);
void ellipse3DUpdate(EllipseParameters ep, Ellipse3D& e3d);
void updateOrbitColors(GameOrbit* last_selected_orbit, GameOrbit* orbit);