complete rework of the user interface (using raygui)
This commit is contained in:
@ -7,43 +7,24 @@
|
||||
#include <raymath.h>
|
||||
|
||||
class OrbitCamera3D {
|
||||
friend class Renderer;
|
||||
public:
|
||||
Vector3 position = Vector3Zero();
|
||||
Vector3 target = Vector3Zero();
|
||||
float distance = CAMERA_DISTANCE;
|
||||
float fov = CAMERA_FOV;
|
||||
CameraProjection projection = CAMERA_PERSPECTIVE;
|
||||
float angle_x = 0.0;
|
||||
float angle_y = 0.0;
|
||||
|
||||
private:
|
||||
Camera camera;
|
||||
|
||||
Vector3 position;
|
||||
Vector3 target;
|
||||
float distance;
|
||||
float angle_x;
|
||||
float angle_y;
|
||||
|
||||
// Input
|
||||
Vector2 last_mouse;
|
||||
bool rotating;
|
||||
bool panning;
|
||||
bool target_lock;
|
||||
Camera camera = Camera{Vector3(0, 0, -distance), target, Vector3(0, 1.0, 0),
|
||||
fov, projection};
|
||||
|
||||
public:
|
||||
OrbitCamera3D()
|
||||
: camera(Camera(Vector3Zero(), Vector3Zero(), Vector3Zero(), 0.0, 0)),
|
||||
position(Vector3Zero()), target(Vector3Zero()),
|
||||
distance(CAMERA_DISTANCE), angle_x(0.0), angle_y(0.0),
|
||||
last_mouse(Vector2Zero()), rotating(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;
|
||||
}
|
||||
auto Rotate(Vector2 last_mouse, Vector2 mouse) -> void;
|
||||
|
||||
~OrbitCamera3D() {}
|
||||
auto Pan(Vector2 last_mouse, Vector2 mouse) -> void;
|
||||
|
||||
public:
|
||||
auto HandleCameraInput() -> Vector2;
|
||||
|
||||
auto Update(const Vector3 ¤t_target) -> void;
|
||||
auto Update(const Vector3 ¤t_target, bool lock) -> void;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user