Make members of SplatEncoding non-optional to avoid repeated fallback handling - #415
Open
mrxz wants to merge 1 commit into
Open
Make members of SplatEncoding non-optional to avoid repeated fallback handling#415mrxz wants to merge 1 commit into
SplatEncoding non-optional to avoid repeated fallback handling#415mrxz wants to merge 1 commit into
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.
The
SplatEncodingtype was used both as the actual encoding values as well as the type for specifying non-default encoding values. This meant that each member had to be optional, which in turn meant a lot of code repeated the same default fallback values as the type suggested it could be undefined.In practice however, these values would always be set and these fallbacks were just repeated to appease the type system. This PR changes the typing of
SplatEncodingsuch that all members are required, removing the need for implementing fallbacks throughout the code base. For thePackedSplatsandSplatMeshconstructors aPartial<SplatEncoding>is used so these can still receive only the encoding properties that need to be overridden.Additionally this PR contains some tightening of a few "result" types, marking their members as readonly for good measure, as well as the removal of two unused constants
USE_COMPILED_PARSER_FUNCTION(obsolete with #374) andWASM_SPLAT_SORT(obsolete with #322)