fx-gltf
fx-gltf copied to clipboard
thirdparty example addition
I honestly can't remember how to suggest adding it with git's interface.
This file defines data structures so that accessors can be interacted with as STL containers
E.g: ` std::vectorglm::vec3 position;
for (auto const & attrib : primitive.attributes)
{
if(attrib.first == "POSITION")
{
stdAccessorVec3 position_array(document, attrib.second);
position = std::vector<glm::vec3>(position_array.begin(), position_array.end());
}
}`
std::array<float, 3> should work just as well as glm::vec3
When given a fx::gltf::Document &, int accessor pair it will throw an error if there is any risk of a buffer overrun when the iterator class is used in a standard way.
could stand to undergo more testing (especially with sparse structures), but works for my purposes.
EDIT: i realized i messed up the ampersands on the interator preinc/postinc, GCC didn't complain because the STL algorithms i was feeding it to wasn't using the one with a bad reference.