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

write buffer_view should write TARGET #193

Open
pplux opened this issue Nov 17, 2022 · 0 comments
Open

write buffer_view should write TARGET #193

pplux opened this issue Nov 17, 2022 · 0 comments

Comments

@pplux
Copy link

pplux commented Nov 17, 2022

The function

cgltf/cgltf_write.h

Lines 559 to 570 in 561455e

static void cgltf_write_buffer_view(cgltf_write_context* context, const cgltf_buffer_view* view)
{
cgltf_write_line(context, "{");
cgltf_write_strprop(context, "name", view->name);
CGLTF_WRITE_IDXPROP("buffer", view->buffer, context->data->buffers);
cgltf_write_sizeprop(context, "byteLength", view->size, (cgltf_size)-1);
cgltf_write_sizeprop(context, "byteOffset", view->offset, 0);
cgltf_write_sizeprop(context, "byteStride", view->stride, 0);
// NOTE: We skip writing "target" because the spec says its usage can be inferred.
cgltf_write_extras(context, &view->extras);
cgltf_write_line(context, "}");
}

should (according to the spec) write the property target when the bufferview is used for attributes or indices:

When a buffer view is used by vertex indices or attribute accessors it SHOULD specify bufferView.target with a value of element array buffer or array buffer respectively.

This is just an enhancement, not an error :)

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