From 687772f073563e83b3f75647195251637397ccba Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 12 Aug 2025 09:29:09 +0300 Subject: [PATCH] feat(omath): Add NDC to screen position coordinate diagram --- include/omath/projection/camera.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/omath/projection/camera.hpp b/include/omath/projection/camera.hpp index 76b07d8..b02ccdb 100644 --- a/include/omath/projection/camera.hpp +++ b/include/omath/projection/camera.hpp @@ -186,6 +186,18 @@ namespace omath::projection [[nodiscard]] Vector3 ndc_to_screen_position(const Vector3& ndc) const noexcept { +/* + ^ + | y + 1 | + | + | + -1 ---------0--------- 1 --> x + | + | + -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}; } };