2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
#include <engine/base/base.hpp>
|
|
|
|
#include <engine/camera/camera.hpp>
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
namespace Light {
|
|
|
|
|
|
|
|
class SceneCamera: public Camera
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class ProjectionType
|
|
|
|
{
|
|
|
|
Orthographic = 0,
|
2025-07-05 13:28:41 +03:30
|
|
|
Perspetcive = 1
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
struct OrthographicSpecification
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
float size;
|
2025-07-06 14:02:50 +03:30
|
|
|
|
|
|
|
float near_plane;
|
|
|
|
|
|
|
|
float far_plane;
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
struct PerspectiveSpecification
|
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
float vertical_fov;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
float near_plane;
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
float far_plane;
|
|
|
|
};
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
SceneCamera();
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_viewport_size(unsigned int width, unsigned int height);
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_projection_type(ProjectionType projectionType);
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_orthographic_size(float size);
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_orthographic_far_plane(float farPlane);
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_orthographic_near_plane(float nearPlane);
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_perspective_vertical_fov(float verticalFov);
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_perspective_far_plane(float farPlane);
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void set_perspective_near_plane(float nearPlane);
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto get_orthographic_size() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_orthographic_specification.size;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
|
|
|
auto get_orthographic_far_plane() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
return m_orthographic_specification.far_plane;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
|
|
|
auto get_orthographic_near_plane() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
return m_orthographic_specification.near_plane;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto get_perspective_vertical_fov() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
return m_perspective_specification.vertical_fov;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
|
|
|
auto get_perspective_far_plane() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
return m_perspective_specification.far_plane;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
|
|
|
auto get_perspective_near_plane() const -> float
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-06 14:02:50 +03:30
|
|
|
return m_perspective_specification.near_plane;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto get_projection_type() const -> ProjectionType
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_projection_type;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2022-03-08 21:19:19 +03:30
|
|
|
private:
|
2025-07-06 14:02:50 +03:30
|
|
|
OrthographicSpecification m_orthographic_specification;
|
|
|
|
|
|
|
|
PerspectiveSpecification m_perspective_specification;
|
|
|
|
|
|
|
|
float m_aspect_ratio;
|
|
|
|
|
|
|
|
ProjectionType m_projection_type;
|
|
|
|
|
2025-07-05 15:36:53 +03:30
|
|
|
void calculate_projection();
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
2025-07-05 13:28:41 +03:30
|
|
|
} // namespace Light
|