Skip to content

Commit 29b7ac6

Browse files
authored
Merge pull request #177 from orange-cpp/feature/custom_ndc_z_range
Feature/custom ndc z range
2 parents a9ff786 + 89df10b commit 29b7ac6

39 files changed

Lines changed: 592 additions & 86 deletions

File tree

include/omath/engines/cry_engine/camera.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
namespace omath::cry_engine
1111
{
12-
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait>;
12+
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, false, NDCDepthRange::ZERO_TO_ONE>;
1313
} // namespace omath::cry_engine

include/omath/engines/cry_engine/formulas.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace omath::cry_engine
2222
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
2323

2424
[[nodiscard]]
25-
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far) noexcept;
25+
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far,
26+
NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept;
2627

2728
template<class FloatingType>
2829
requires std::is_floating_point_v<FloatingType>

include/omath/engines/cry_engine/traits/camera_trait.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace omath::cry_engine
1818
static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
1919
[[nodiscard]]
2020
static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port,
21-
float near, float far) noexcept;
21+
float near, float far, NDCDepthRange ndc_depth_range) noexcept;
2222
};
2323

2424
} // namespace omath::cry_engine

include/omath/engines/frostbite_engine/camera.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
namespace omath::frostbite_engine
1111
{
12-
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait>;
12+
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, false, NDCDepthRange::ZERO_TO_ONE>;
1313
} // namespace omath::unity_engine

include/omath/engines/frostbite_engine/formulas.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace omath::frostbite_engine
2222
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
2323

2424
[[nodiscard]]
25-
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far) noexcept;
25+
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far,
26+
NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept;
2627

2728
template<class FloatingType>
2829
requires std::is_floating_point_v<FloatingType>

include/omath/engines/frostbite_engine/traits/camera_trait.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace omath::frostbite_engine
1818
static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
1919
[[nodiscard]]
2020
static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port,
21-
float near, float far) noexcept;
21+
float near, float far, NDCDepthRange ndc_depth_range) noexcept;
2222
};
2323

2424
} // namespace omath::unreal_engine

include/omath/engines/iw_engine/camera.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
namespace omath::iw_engine
1111
{
12-
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait>;
12+
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, false, NDCDepthRange::ZERO_TO_ONE>;
1313
} // namespace omath::iw_engine

include/omath/engines/iw_engine/formulas.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace omath::iw_engine
2222
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
2323

2424
[[nodiscard]]
25-
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far) noexcept;
25+
Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far,
26+
NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept;
2627

2728
template<class FloatingType>
2829
requires std::is_floating_point_v<FloatingType>

include/omath/engines/iw_engine/traits/camera_trait.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace omath::iw_engine
1818
static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
1919
[[nodiscard]]
2020
static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port,
21-
float near, float far) noexcept;
21+
float near, float far, NDCDepthRange ndc_depth_range) noexcept;
2222
};
2323

2424
} // namespace omath::iw_engine

include/omath/engines/opengl_engine/camera.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
namespace omath::opengl_engine
1010
{
11-
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, true>;
11+
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, true, NDCDepthRange::NEGATIVE_ONE_TO_ONE>;
1212
} // namespace omath::opengl_engine

0 commit comments

Comments
 (0)