GameObjects

Began to add GameObjects, starting with the player.
This commit is contained in:
onTheZero
2025-08-13 00:59:03 -04:00
parent 237272c17b
commit 4bf6b02255
37 changed files with 2640 additions and 222 deletions

View File

@@ -8,16 +8,16 @@
enum Camera_Movement
{
FORWARD,
BACKWARD,
LEFT,
RIGHT
_FORWARD,
_BACKWARD,
_LEFT,
_RIGHT
};
const float YAW = -90.0f;
const float PITCH = 0.0f;
const float SPEED = 2.5f;
const float SENSITIVITY = 0.1f;
const float SPEED = 5.0f;
const float MOUSE_SENSITIVITY = 0.1f;
const float ZOOM = 45.0f;
class Camera
@@ -28,6 +28,7 @@ public:
glm::vec3 Up;
glm::vec3 Right;
glm::vec3 WorldUp;
glm::vec3 CameraOffset;
float Yaw;
float Pitch;
@@ -39,15 +40,17 @@ public:
Camera(
glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f),
glm::vec3 offset = glm::vec3(0.0f, 1.0f, 0.0f),
float yaw = YAW,
float pitch = PITCH)
:
Front(glm::vec3(0.0f, 0.0f, -1.0f)),
MovementSpeed(SPEED),
MouseSensitivity(SENSITIVITY),
MouseSensitivity(MOUSE_SENSITIVITY),
Zoom(ZOOM)
{
Position = position;
CameraOffset = offset;
WorldUp = up;
Yaw = yaw;
Pitch = pitch;
@@ -62,25 +65,22 @@ public:
void ProcessKeyboard(Camera_Movement direction, float deltaTime)
{
float velocity = MovementSpeed * deltaTime;
if (direction == FORWARD)
if (direction == _FORWARD)
Position += Front * velocity;
if (direction == BACKWARD)
if (direction == _BACKWARD)
Position -= Front * velocity;
if (direction == LEFT)
if (direction == _LEFT)
Position -= Right * velocity;
if (direction == RIGHT)
if (direction == _RIGHT)
Position += Right * velocity;
}
void ProcessMouseMovement(float xoffset, float yoffset, GLboolean constrainPitch = true)
void ProcessMouseMovement(float XOffset, float YOffset, GLboolean bConstrainPitch = true)
{
xoffset *= MouseSensitivity;
yoffset *= MouseSensitivity;
//Yaw += XOffset;
Pitch += YOffset;
Yaw += xoffset;
Pitch += yoffset;
if (constrainPitch)
if (bConstrainPitch)
{
if (Pitch > 89.0f)
Pitch = 89.0f;
@@ -100,6 +100,7 @@ public:
Zoom = 45.0f;
}
private:
void updateCameraVectors()
{
glm::vec3 front;