-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleCamera.h
More file actions
51 lines (42 loc) · 1.44 KB
/
Copy pathModuleCamera.h
File metadata and controls
51 lines (42 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "Module.h"
#include "SimpleMath.h"
class ModuleCamera : public Module {
public:
bool init() override;
void update() override;
void SetFOV(float fovRadians);
void SetAspectRatio(float aspect);
void SetPlaneDistances(float nearP, float farP);
void LookAt(const Vector3& target);
const Matrix& GetProjectionMatrix() const;
const Matrix& GetViewMatrix() const { return view; }
Vector3 getPosition() const { return position; }
const Matrix& getViewMatrix() const { return GetViewMatrix(); }
const Matrix& getProjectionMatrix() const { return GetProjectionMatrix(); }
// Función para obtener forward vector
Vector3 GetForward() const {
return Vector3::Transform(Vector3(0, 0, 1), rotation);
}
private:
Vector3 position = { 0.0f, 2.0f, 10.0f };
Quaternion rotation = Quaternion::Identity;
Matrix view;
Matrix projection;
// Variables para zoom con rueda (añadido extra)
int lastScrollValue = 0;
int dragPosX = 0;
int dragPosY = 0;
// Parámetros como los tiene tu profesor
struct {
float polar = 0.0f; // Rotación horizontal (yaw)
float azimuthal = 0.0f; // Rotación vertical (pitch)
Vector3 translation = { 0.0f, 2.0f, 10.0f };
} params;
float fov = 0.785f; // 45°
float aspectRatio = 1.77f;
float nearPlane = 0.1f;
float farPlane = 200.0f;
float speed = 5.0f;
float sensitivity = 0.25f;
};