Skip to content

Make members of SplatEncoding non-optional to avoid repeated fallback handling - #415

Open
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:splat-encoding-type
Open

Make members of SplatEncoding non-optional to avoid repeated fallback handling#415
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:splat-encoding-type

Conversation

@mrxz

@mrxz mrxz commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

The SplatEncoding type 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 SplatEncoding such that all members are required, removing the need for implementing fallbacks throughout the code base. For the PackedSplats and SplatMesh constructors a Partial<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) and WASM_SPLAT_SORT (obsolete with #322)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant