Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor toplevel section parsing and remove duplicate code #427

Open
wants to merge 3 commits into
base: release
Choose a base branch
from

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