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

Changes - suggestion for the Serialization example #110

Open
jimver04 opened this issue Nov 15, 2022 · 4 comments
Open

Changes - suggestion for the Serialization example #110

jimver04 opened this issue Nov 15, 2022 · 4 comments
Labels
help wanted Extra attention is needed triaged Issues that have been triaged

Comments

@jimver04
Copy link

In the Serialization example main.cpp

perhaps it worths changing

std::vector<uint16_t> indices;
to
std::vector<uint32_t> indices;

and

accessorIdIndices = bufferBuilder.AddAccessor(indices, { Microsoft::glTF::TYPE_SCALAR, Microsoft::glTF::COMPONENT_UNSIGNED_SHORT}).id;

to

accessorIdIndices = bufferBuilder.AddAccessor(indices, { Microsoft::glTF::TYPE_SCALAR, Microsoft::glTF::COMPONENT_UNSIGNED_INT}).id;

because it took me days to figure out why it was not working with my data. Some meshes had more than 2^16 vertices and were scrumbled whereas some other meshes were ok.

Best,
Dimitrios

@bghgary
Copy link
Contributor

bghgary commented Nov 15, 2022

I'm not sure I understand. Why does it make more sense to use a larger index type to store the indices when the smaller type works? Maybe a comment would suffice?

@jimver04
Copy link
Author

Yes a comment would be nice there to point out that these should be changed according to the size of data, i.e. when the number of vertices > 65536

@jimver04 jimver04 changed the title Changes suggestion for the Serialization example Changes - suggestion for the Serialization example Nov 15, 2022
@bghgary
Copy link
Contributor

bghgary commented Nov 15, 2022

Please open a PR. I will review and merge.

@bghgary
Copy link
Contributor

bghgary commented Dec 7, 2023

Is this still needed?

@bghgary bghgary added help wanted Extra attention is needed triaged Issues that have been triaged labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed triaged Issues that have been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants