-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplanet.hpp
51 lines (38 loc) · 904 Bytes
/
planet.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef PLANET_HPP
#define PLANET_HPP
#include <glm/glm.hpp>
#include <learnopengl/shader_m.h>
class Planet;
using ExtraShaderOpT = void (*)(Shader *, Planet *);
class Drawable {
public:
virtual void draw(Shader *shader) = 0;
};
class Planet {
public:
Planet(
Drawable *drawable, Shader *shader,
float radius,
float orbit_freq, float orbit_radius,
float rot_freq, glm::vec3 rot_axis,
ExtraShaderOpT extra_shader_op=nullptr
);
void update();
void draw(glm::mat4 projection, glm::mat4 view);
float get_radius();
glm::vec3 get_position();
glm::vec3 get_gravity(glm::vec3 target, float delta_time);
private:
void draw_orbit(glm::mat4 projection, glm::mat4 view);
Drawable *drawable;
Shader *shader;
float radius;
float orbit_freq;
float orbit_radius;
float rot_freq;
glm::vec3 rot_axis;
glm::vec3 position;
glm::mat4 model;
ExtraShaderOpT extra_shader_op;
};
#endif