extract orbital camera into separate file

This commit is contained in:
2026-02-22 14:29:04 +01:00
parent 7bc1eaae75
commit 157985df6b
8 changed files with 140 additions and 140 deletions

41
include/camera.hpp Normal file
View File

@ -0,0 +1,41 @@
#ifndef __CAMERA_HPP_
#define __CAMERA_HPP_
#include <raylib.h>
#include <raymath.h>
#include "config.hpp"
class OrbitCamera3D {
friend class Renderer;
private:
Camera camera;
Vector3 target;
float distance;
float angle_x;
float angle_y;
Vector2 last_mouse;
bool dragging;
bool panning;
bool target_lock;
public:
OrbitCamera3D()
: camera({0}), target(Vector3Zero()), distance(CAMERA_DISTANCE),
angle_x(0.0), angle_y(0.0), last_mouse(Vector2Zero()), dragging(false),
panning(false), target_lock(true) {
camera.position = Vector3(0, 0, -1.0 * distance);
camera.target = target;
camera.up = Vector3(0, 1.0, 0);
camera.fovy = CAMERA_FOV;
camera.projection = CAMERA_PERSPECTIVE;
}
~OrbitCamera3D() {}
public:
auto Update(const Vector3 &current_target) -> void;
};
#endif