Make Sphere3D/Icosphere reserve space better#6067
Merged
fluffyfreak merged 4 commits intopioneerspacesim:masterfrom Feb 25, 2025
Merged
Make Sphere3D/Icosphere reserve space better#6067fluffyfreak merged 4 commits intopioneerspacesim:masterfrom
fluffyfreak merged 4 commits intopioneerspacesim:masterfrom
Conversation
sturnclaw
approved these changes
Feb 14, 2025
Member
sturnclaw
left a comment
There was a problem hiding this comment.
Overall I like this change, just one "side quest" thing I'd like to see tackled if you get time.
Contributor
Author
|
Changing it based on the planets detail level ended up being quite involved so this now hits 11 files 🤷 |
Member
|
Whoops, I thought I had merged this already. My bad! |
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.
Whilst doing something else I found that the Icosphere::Generate method wasn't reserving space for the indices it generates, and it was also miscalculating the number of vertices it would generate.
I spent some time trying to figure out a nifty formula to calculate those values and then realised I could just build a table of 11 entries for each of the valid subdivision we allow instead.
I have also increased the BaseSphere use of subdivision to 5 (from 4) for smoother atmospheres.
EDIT:
Made the
BaseSphere::m_atmosinto a static so it's only created once and used throughout the games lifetime instead of creating a new one for every single planet with an atmosphere. Making the icosphere generation faster is good, but avoiding doing it altogether is better still!