mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-19 02:23:27 +00:00
improved simple game
This commit is contained in:
@@ -8,5 +8,5 @@
|
||||
|
||||
namespace omath::opengl_engine
|
||||
{
|
||||
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait>;
|
||||
using Camera = projection::Camera<Mat4X4, ViewAngles, CameraTrait, true>;
|
||||
} // namespace omath::opengl_engine
|
||||
@@ -52,7 +52,7 @@ namespace omath::projection
|
||||
requires noexcept(T::calc_projection_matrix(fov, viewport, znear, zfar));
|
||||
};
|
||||
|
||||
template<class Mat4X4Type, class ViewAnglesType, class TraitClass>
|
||||
template<class Mat4X4Type, class ViewAnglesType, class TraitClass, bool inverted_z = false>
|
||||
requires CameraEngineConcept<TraitClass, Mat4X4Type, ViewAnglesType>
|
||||
class Camera final
|
||||
{
|
||||
@@ -87,6 +87,9 @@ namespace omath::projection
|
||||
Vector3<float> get_forward() const noexcept
|
||||
{
|
||||
const auto& view_matrix = get_view_matrix();
|
||||
|
||||
if constexpr (inverted_z)
|
||||
return -Vector3<float>{view_matrix[2, 0], view_matrix[2, 1], view_matrix[2, 2]};
|
||||
return {view_matrix[2, 0], view_matrix[2, 1], view_matrix[2, 2]};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user