-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathCameraConfig.h
More file actions
31 lines (24 loc) · 907 Bytes
/
CameraConfig.h
File metadata and controls
31 lines (24 loc) · 907 Bytes
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
#ifndef CAMERACONFIG_H
#define CAMERACONFIG_H
#include <string>
#include <optional>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
struct CameraConfig {
glm::vec3 position{0.0f, 0.0f, 0.0f};
glm::quat rotation{1.0f, 0.0f, 0.0f, 0.0f}; // Identity quaternion
float fov = 45.0f;
float nearPlane = 0.1f;
float farPlane = 1000.0f;
// Alternative: specify rotation as Euler angles (degrees)
std::optional<glm::vec3> eulerAngles = std::nullopt;
// Alternative: specify look-at target
std::optional<glm::vec3> target = std::nullopt;
std::optional<glm::vec3> up = std::nullopt;
static CameraConfig loadFromFile(const std::string& filePath);
static bool saveToFile(const CameraConfig& config, const std::string& filePath);
private:
void computeRotationFromEuler();
void computeRotationFromLookAt();
};
#endif // CAMERACONFIG_H