mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Fixes incorrect NDC calculation and updates formulas
Corrects the NDC calculation in `world_to_screen` to improve accuracy. Replaces custom perspective projection matrix calculation with `omath::mat_perspective_right_handed` for correctness and consistency. Updates test cases and provides debugging information by printing view and projection matrices. Addresses an issue in the feature/ndc_invalid_calc_fix branch.
This commit is contained in:
@@ -239,7 +239,8 @@ namespace omath::projection
|
||||
-1 |
|
||||
v
|
||||
*/
|
||||
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (1.f - ndc.y) / 2.f * m_view_port.m_height, ndc.z};
|
||||
|
||||
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (ndc.y / 2.f + 0.5f) * m_view_port.m_height, ndc.z};
|
||||
}
|
||||
|
||||
[[nodiscard]] Vector3<float> screen_to_ndc(const Vector3<float>& screen_pos) const noexcept
|
||||
|
||||
Reference in New Issue
Block a user