3#include "hellfire/ecs/CameraComponent.h"
8 static Entity*
create(
const std::string& name =
"PerspectiveCamera",
10 float aspect = 16.0f / 9.0f,
11 float near_plane = 0.1f,
12 float far_plane = 100.0f,
13 const glm::vec3& position =
glm::
vec3(0.0f, 0.0f, 0.0f)) {
15 Entity* entity =
new Entity(name);
17 camera->set_perspective(fov, aspect, near_plane, far_plane);
19 entity->transform()->set_position(position.x, position.y, position.z);
26 const glm::vec3& position,
27 const glm::vec3& target,
29 float aspect = 16.0f / 9.0f,
30 float near_plane = 0.1f,
31 float far_plane = 100.0f) {
32 Entity* entity = create(name, fov, aspect, near_plane, far_plane, position);
40 static Entity*
create(
const std::string& name =
"OrthographicCamera",
42 float aspect = 16.0f / 9.0f,
43 float near_plane = 0.1f,
44 float far_plane = 100.0f,
45 const glm::vec3& position =
glm::
vec3(0.0f, 0.0f, 0.0f)) {
47 Entity* entity =
new Entity(name);
50 float half_width = size * aspect * 0.5f;
51 float half_height = size * 0.5f;
52 camera->set_orthographic(-half_width, half_width, -half_height, half_height, near_plane, far_plane);
54 entity->transform()->set_position(position.x, position.y, position.z);
60 float left,
float right,
float bottom,
float top,
61 float near_plane = 0.1f,
float far_plane = 100.0f,
62 const glm::vec3& position =
glm::
vec3(0.0f, 0.0f, 0.0f)) {
63 Entity* entity =
new Entity(name);
65 camera->set_orthographic(left, right, bottom, top, near_plane, far_plane);
67 entity->transform()->set_position(position.x, position.y, position.z);
static Entity * create(const std::string &name="OrthographicCamera", float size=10.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f, const glm::vec3 &position=glm::vec3(0.0f, 0.0f, 0.0f))
static Entity * create_with_bounds(const std::string &name, float left, float right, float bottom, float top, float near_plane=0.1f, float far_plane=100.0f, const glm::vec3 &position=glm::vec3(0.0f, 0.0f, 0.0f))
static Entity * create(const std::string &name="PerspectiveCamera", float fov=45.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f, const glm::vec3 &position=glm::vec3(0.0f, 0.0f, 0.0f))
static Entity * create_looking_at(const std::string &name, const glm::vec3 &position, const glm::vec3 &target, float fov=45.0f, float aspect=16.0f/9.0f, float near_plane=0.1f, float far_plane=100.0f)