-
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
14 changed files
with
117 additions
and
13 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
41 changes: 41 additions & 0 deletions
41
engine/include/cubos/engine/render/camera/orthographic.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,41 @@ | ||
/// @file | ||
/// @brief Component @ref cubos::engine::OrthographicCamera | ||
/// @ingroup render-camera-plugin | ||
|
||
#pragma once | ||
|
||
#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 The axis that can be fixed for this projection. | ||
enum class Axis | ||
{ | ||
Horizontal, | ||
Vertical | ||
}; | ||
|
||
/// @brief The size of the fixed axis of the projection. | ||
float size{50.0F}; | ||
|
||
/// @brief The axis to be fixed for the projection. | ||
Axis axis{Axis::Vertical}; | ||
|
||
/// @brief Near clipping plane. | ||
float zNear{0.1F}; | ||
|
||
/// @brief Far clipping plane. | ||
float zFar{1000.0F}; | ||
}; | ||
} // namespace cubos::engine | ||
|
||
CUBOS_REFLECT_EXTERNAL_DECL(CUBOS_ENGINE_API, cubos::engine::OrthographicCamera::Axis); |
File renamed without changes.
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
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
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
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,28 @@ | ||
#include <cubos/core/ecs/reflection.hpp> | ||
#include <cubos/core/reflection/external/primitives.hpp> | ||
#include <cubos/core/reflection/traits/enum.hpp> | ||
#include <cubos/core/reflection/type.hpp> | ||
|
||
#include <cubos/engine/render/camera/orthographic.hpp> | ||
|
||
using cubos::core::reflection::EnumTrait; | ||
using cubos::core::reflection::Type; | ||
using cubos::engine::OrthographicCamera; | ||
|
||
CUBOS_REFLECT_EXTERNAL_IMPL(OrthographicCamera::Axis) | ||
{ | ||
return Type::create("cubos::engine::CameraAxis") | ||
.with(EnumTrait{} | ||
.withVariant<OrthographicCamera::Axis::Vertical>("Vertical") | ||
.withVariant<OrthographicCamera::Axis::Horizontal>("Horizontal")); | ||
} | ||
|
||
CUBOS_REFLECT_IMPL(OrthographicCamera) | ||
{ | ||
return core::ecs::TypeBuilder<OrthographicCamera>("cubos::engine::OrthographicCamera") | ||
.withField("size", &OrthographicCamera::size) | ||
.withField("axis", &OrthographicCamera::axis) | ||
.withField("zNear", &OrthographicCamera::zNear) | ||
.withField("zFar", &OrthographicCamera::zFar) | ||
.build(); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../src/render/camera/perspective_camera.cpp → engine/src/render/camera/perspective.cpp
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
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