Make members of SplatEncoding non-optional to avoid repeated fallback handling - #415
Conversation
|
@mrxz this is a long overdue cleanup, I agree this is much better than all the optionals and fallbacks we had in that past. Thank you for your attention to it! @oscarlorentzon @dmarcos this is a good idea right? |
|
We might want to handle the remaining default assignments at Should the |
d00fe62 to
0026ab4
Compare
Addressed both of these as well, does nicely get rid of some more repeated default values. Also eliminated them from the initial values of the uniforms, as the
From the user's POV nothing should have changed. While it's slightly confusing that it states I'd rather leave the docs improvements for future PRs. Ideally we'd move to JSDoc based comments throughout, ensuring people get these comments straight in their IDE, and in time hopefully automatically generate the relevant (reference) docs from it. |
0026ab4 to
4a4a5c1
Compare
|
Leaving the docs as is for now makes sense. Looks good to merge @dmarcos. |
|
thanks |
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)