Add support to render surface labels to custom cameras#669
Open
M3d1cZ4pp3r wants to merge 5 commits into
Open
Conversation
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.
This changes the Custom Camera render path to support rendering surface labels when a respective flag is set at camera creation.
Additionally, a scale can be set from the gcCore API. This is needed because we don't know how the target surface will be scaled on the actual screen later on, so the client of the custom camera needs to scale up the surface labels so they are readable.
The scale is applied to the symbols as well as on the fonts. For the fonts a cache of bigger fonts is created and used.
While there are other solutions that work and might take less resources, e.g. I did a small change to render the text to a sprite before rendering it to the sketchpad. This makes it sensitive to the sketchpads transform matrix and the font is upscaled too.
But this is a more invasive approach into the general text render path, while my requested approach only changes Custom Camera and Label Rendering logic, on the cost of keeping bigger fonts in memory and rendering them.
Additionally the Camera structures need to carry that scale information and also the dimensions of the render target.
This is because the projection logic of the Label Renderer needs to know the viewport dimensions.
In general I tried to minimize invasiveness and kept it backwards compatible, so no interface should break.
The reason for this change is that in the NASSP Apollo Project the superimposition technique on the optics sextant uses a custom camera. The user cannot spot landmarks then anymore. This allows to still render them, and resize them according to the size of the custom camera rendered texture on the screen.