diff --git a/src/ruis/render/context.hpp b/src/ruis/render/context.hpp index 8b1ac5f0f..94cc1daf6 100644 --- a/src/ruis/render/context.hpp +++ b/src/ruis/render/context.hpp @@ -92,7 +92,12 @@ class context : public std::enable_shared_from_this /** * @brief Initial matrix to use for rendering. * The initial coordinate system is right-handed. - * The initial matrix makes viewport edges to be: left = 0, right = 1, top = 0, bottom = 1. + * + * Convention: NDC (normalized device coordinates) spans x, y, z from [0, 1], + * x-axis right, y-axis down, z-axis away from the viewer. With the initial_matrix: + * x = 0 maps to the left viewport edge, x = 1 to the right viewport edge; + * y = 0 maps to the top viewport edge, y = 1 to the bottom viewport edge; + * z = 0 maps to the near clipping plane, z = 1 to the far clipping plane. */ const r4::matrix4 initial_matrix; diff --git a/tests/app1/src/cube_widget.cpp b/tests/app1/src/cube_widget.cpp index 6f9c76f6f..f825765f3 100644 --- a/tests/app1/src/cube_widget.cpp +++ b/tests/app1/src/cube_widget.cpp @@ -79,9 +79,7 @@ void cube_widget::update(uint32_t dt) void cube_widget::render(const ruis::mat4& matrix) const { ruis::mat4 matr(matrix); - matr.scale(this->rect().d / 2); - matr.translate(1, 1); - matr.scale(1, -1, -1); // y down, z away + matr.scale(this->rect().d); // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) matr.frustum(-2, 2, -1.5, 1.5, 2, 100); matr.translate(0, 0, -4);