terravisor/include/camera.h

39 lines
1.1 KiB
C
Raw Normal View History

2024-08-21 17:14:35 -04:00
#ifndef CAMERA_H_
#define CAMERA_H_
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "transform.h"
struct Camera {
Transform transform;
float focalLength; // In mm
float sensorHeight;
float nearPlane;
float farPlane;
};
namespace CameraControls {
void TranslateCamera(Camera& camera, const glm::vec3& translationDelta);
void RotateCamera(Camera& camera, const glm::vec3& rotationDelta);
void SetPosition(Camera& camera, const glm::vec3& position);
void SetRotation(Camera& camera, const glm::vec3& rotation);
glm::vec3 GetPosition(Camera& camera);
glm::vec3 GetCenter(Camera& camera);
float GetFOV(Camera& camera);
void AdjustFocalLength(Camera& camera, float focalLength);
void AdjustSensorHeight(Camera& camera, float sensorHeight);
void AdjustNearPlane(Camera& camera, float nearPlane);
void AdjustFarPlane(Camera& camera, float farPlane);
glm::mat4 GetViewMatrix(Camera& camera);
}
#endif // CAMERA_H_