Repository navigation
document the NDC convention for the initial matrix - #206
Merged
Merged
Conversation
The window coordinate system used by the renderers (to_window_coords, get/set_viewport, get/set_scissor) is always top-left origin (x right, y down). Document this in the context's API docs so the renderers have a single canonical convention to implement.
The framework convention for the initial matrix: NDC (normalized device coordinates) spans x, y, z from [0, 1] with x-axis right, y-axis down and 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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #206 +/- ##
==========================================
- Coverage 28.55% 28.21% -0.35%
==========================================
Files 239 239
Lines 8945 9443 +498
Branches 2785 2883 +98
==========================================
+ Hits 2554 2664 +110
- Misses 6057 6416 +359
- Partials 334 363 +29 ☔ View full report in Codecov by Harness. |
The framework convention maps framework z=0 to the near clipping plane and z=1 to the far plane (z away), and the frustum (r4) now maps near to NDC z=0 and far to NDC z=1. The previous z flip in the widget chain (scale(1, -1, -1)) made framework z=0 map to NDC z=+1, which is the far plane — clipping out-of-range z values. The y flip remains (framework y=0 is top, OpenGL viewport is y-up).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Document the framework convention for the initial matrix in the context's API docs:
This is the single canonical convention that all renderers (OpenGL, OpenGL ES, DirectX, Vulkan) target.