2023-07-29 18:58:56 -04:00
|
|
|
//
|
|
|
|
// Created by brett on 6/14/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef PARKSNREC_PLAYER_H
|
|
|
|
#define PARKSNREC_PLAYER_H
|
|
|
|
|
2023-07-30 19:37:19 -04:00
|
|
|
#include "blt/math/vectors.h"
|
2023-07-29 18:58:56 -04:00
|
|
|
#include "blt/math/matrix.h"
|
|
|
|
|
2023-08-01 20:57:39 -04:00
|
|
|
namespace blt::graphics {
|
2023-07-29 18:58:56 -04:00
|
|
|
|
|
|
|
class Controller;
|
|
|
|
class CameraController;
|
|
|
|
class NetworkedController;
|
|
|
|
|
|
|
|
class Player {
|
|
|
|
friend Controller;
|
|
|
|
friend CameraController;
|
|
|
|
friend NetworkedController;
|
|
|
|
private:
|
|
|
|
blt::vec3d pos;
|
|
|
|
blt::vec3d rot;
|
|
|
|
const float baseMovementSpeed = 10.0f;
|
|
|
|
const float sprintingMovementSpeed = 20.0f;
|
|
|
|
const float flyingMovementSpeed = 50.0f;
|
|
|
|
const float sensitivity = 5.0f;
|
|
|
|
public:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class Controller {
|
|
|
|
protected:
|
|
|
|
Player& player;
|
|
|
|
public:
|
|
|
|
explicit Controller(Player& player): player(player) {}
|
|
|
|
virtual void update() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CameraController : public Controller {
|
|
|
|
private:
|
|
|
|
blt::mat4x4 generateViewMatrix();
|
|
|
|
public:
|
|
|
|
explicit CameraController(Player& player): Controller(player) {
|
|
|
|
player.pos;
|
|
|
|
}
|
|
|
|
void update() final;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkedController : public Controller {
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit NetworkedController(Player& player): Controller(player) {
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //PARKSNREC_PLAYER_H
|