improved camera

This commit is contained in:
2025-03-22 17:39:40 +03:00
parent 2b59fb6aa2
commit 481d7b85df
6 changed files with 38 additions and 24 deletions

View File

@@ -26,10 +26,10 @@ namespace omath::iw_engine
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
}
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
{
return MatCameraView(ForwardVector(angles), RightVector(angles), -UpVector(angles), cam_origin);
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
}
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,

View File

@@ -40,7 +40,6 @@ namespace omath::opengl_engine
{0, 1.f / (fovHalfTan), 0, 0},
{0, 0, -(far + near) / (far - near), -(2.f * far * near) / (far - near)},
{0, 0, -1, 0},
};
}
} // namespace omath::opengl_engine

View File

@@ -28,7 +28,7 @@ namespace omath::source_engine
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
{
return MatCameraView(ForwardVector(angles), RightVector(angles), -UpVector(angles), cam_origin);
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
}
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,

View File

@@ -39,7 +39,7 @@ namespace omath::unity_engine
{1.f / (aspectRatio * fovHalfTan), 0, 0, 0},
{0, 1.f / (fovHalfTan), 0, 0},
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
{0, 0, 1.f, 0},
{0, 0, -1.f, 0},
};
}