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.
64 lines
1.2 KiB
64 lines
1.2 KiB
|
|
|
|
#pragma once |
|
|
|
#include <memory> |
|
#include <glm/glm.hpp> |
|
#include <glm/gtc/matrix_transform.hpp> |
|
#include "shaders.h" |
|
#include "entity.h" |
|
|
|
|
|
namespace player { |
|
|
|
class camera; |
|
class player; |
|
|
|
enum class movement { |
|
WALKING, |
|
FLYING |
|
}; |
|
|
|
class player { |
|
movement move_mode; |
|
physics_model physics {}; |
|
std::shared_ptr<camera> cam; |
|
|
|
public: |
|
player(); |
|
void move(float velocity, glm::vec3 direction); |
|
void update(); |
|
}; |
|
|
|
|
|
class camera { |
|
public: |
|
glm::vec3 pos; |
|
glm::vec3 front; |
|
glm::vec3 up; |
|
glm::vec3 direction; |
|
float pitch = 0; |
|
float yaw = -90; |
|
|
|
glm::mat4 projection; |
|
glm::mat4 model = glm::mat3(1.0f); |
|
glm::mat4 view = glm::mat4(1.0f); |
|
|
|
|
|
|
|
camera(glm::vec3 pos, glm::vec3 front, glm::vec3 up, glm::vec3 direction) |
|
: pos(pos), front(front), up(up), direction(direction) { |
|
projection = glm::perspective(glm::radians(45.0f), 800.0f / 600.0f, 0.1f, 100.0f); |
|
}; |
|
|
|
void update(); |
|
void set_camera(Shader *shader); |
|
}; |
|
|
|
|
|
std::shared_ptr<camera> get_camera(); |
|
|
|
std::shared_ptr<player> get_player(); |
|
|
|
|
|
}
|
|
|