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

Based on the current node, how to find out the bufferView number? #251

Open
native-engine opened this issue Mar 30, 2024 · 1 comment
Open

Comments

@native-engine
Copy link

native-engine commented Mar 30, 2024

In a function that takes the current node as input argument, how can I find out the number of the "bufferView" belonging to it? In the gltf file the number is simply specified: «"accessors":[ { "bufferView":0» but the parser already refers to the "bufferView" itself (node->mesh->primitives->indices->buffer_view) and does not allow to find out its number in order to correctly refer to other data, e.g. "accessor", by this number. So far, I've done this:
int iBufferView = (node - data->scene->nodes[0]) * 4;
but I doubt it's fair to the children.

@native-engine
Copy link
Author

That's kind of more correct:
int iBufferView = node->mesh->primitives->indices->buffer_view - data->accessors->buffer_view - 3;

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

No branches or pull requests

1 participant