You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there some technical reason behind using a dynamic allocation for the cgltf_data output structure? Since it's a static size, I think it would be more convenient and practical to do something like this:
#defineCGLTF_IMPLEMENTATION#include"cgltf.h"void*buf; /* Pointer to glb or gltf file data */size_tsize; /* Size of the file data */cgltf_optionsoptions= {0};
cgltf_datadata= {0};
cgltf_resultresult=cgltf_parse(&options, buf, size, &data);
if (result==cgltf_result_success) {
/* [Do stuff with data] */
}
The text was updated successfully, but these errors were encountered:
You’d still need cgltf_free; it’s easier to forget in code like above. With that it doesn’t seem like ergonomics is any better, and cgltf allocates enough that one extra allocation won’t matter for performance.
Is there some technical reason behind using a dynamic allocation for the
cgltf_data
output structure? Since it's a static size, I think it would be more convenient and practical to do something like this:The text was updated successfully, but these errors were encountered: