Skip to content

Refactor toplevel section parsing and remove duplicate code#427

Open
agnat wants to merge 3 commits intosyoyo:releasefrom
agnat:generalize_section_parsing
Open

Refactor toplevel section parsing and remove duplicate code#427
agnat wants to merge 3 commits intosyoyo:releasefrom
agnat:generalize_section_parsing

Conversation

@agnat
Copy link
Contributor

@agnat agnat commented Jun 9, 2023

Introduce a new function ParseSection(…), which handles populating the toplevel GLTF arrays. This removes a bunch of duplicated code. Use a variadic template to facilitate passing additional arguments, that don’t fit the common signature. See Buffer or Mesh.

Refactor object parsing functions (ParseBuffer(), &c.) into a set of overloaded functions ParseObject(…). That way we can invoke them without knowning the actual type.

Pass the TinyGLTF context to the parser functions, so we can actually use it.

To keep the changeset size in check, this deals with all toplevel objects but Image, which is more involved and requires a closer look.

Also, add some getters and fix minor const-correctness issues.

agnat added 3 commits June 9, 2023 14:16
Introduce a new function ParseSection(…), which handles populating the toplevel GLTF arrays. This removes a bunch of duplicated code. Use a variadic template to facilitate passing additional arguments, that don’t fit the common signature. See Buffer or Mesh.

Refactor object parsing functions (ParseBuffer(), &c.) into a set of overloaded functions ParseObject(…). That way we can invoke them without knowning the actual type.

Pass the TinyGLTF context to the parser functions, so we can actually use it.

To keep the changeset size in check, this deals with all toplevel objects but Image, which is more involved and requires a closer look.

Also, add some getters and fix minor const-correctness issues.
@syoyo syoyo added the trivial label Jun 11, 2023
@syoyo
Copy link
Owner

syoyo commented Jun 13, 2023

I don't like variadic template, which makes C++ code difficult to read and debug, and code refactoring is a trivial thing, so won't merge this PR

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants