-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rendering): Add OrthographicCamera component
- Loading branch information
Showing
6 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
engine/include/cubos/engine/render/camera/orthographic_camera.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// @file | ||
/// @brief Component @ref cubos::engine::OrthographicCamera | ||
/// @ingroup render-camera-plugin | ||
|
||
#pragma once | ||
|
||
#include <glm/vec2.hpp> | ||
|
||
#include <cubos/core/reflection/reflect.hpp> | ||
|
||
#include <cubos/engine/api.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Component which defines parameters of a orthographic camera used to render the world. | ||
/// @note Should be used with @ref LocalToWorld. | ||
/// @ingroup render-camera-plugin | ||
struct CUBOS_ENGINE_API OrthographicCamera | ||
{ | ||
CUBOS_REFLECT; | ||
|
||
/// @brief Size multiplier for orthographic camera planes. | ||
glm::vec2 size{1.0F, 1.0F}; | ||
|
||
/// @brief Near clipping plane. | ||
float zNear{0.1F}; | ||
|
||
/// @brief Far clipping plane. | ||
float zFar{1000.0F}; | ||
}; | ||
} // namespace cubos::engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <cubos/core/ecs/reflection.hpp> | ||
#include <cubos/core/reflection/external/glm.hpp> | ||
#include <cubos/core/reflection/external/primitives.hpp> | ||
|
||
#include <cubos/engine/render/camera/orthographic_camera.hpp> | ||
|
||
CUBOS_REFLECT_IMPL(cubos::engine::OrthographicCamera) | ||
{ | ||
return core::ecs::TypeBuilder<OrthographicCamera>("cubos::engine::OrthographicCamera") | ||
.withField("size", &OrthographicCamera::size) | ||
.withField("zNear", &OrthographicCamera::zNear) | ||
.withField("zFar", &OrthographicCamera::zFar) | ||
.build(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters