fx-gltf icon indicating copy to clipboard operation
fx-gltf copied to clipboard

thirdparty example addition

Open pdJeeves opened this issue 6 years ago • 0 comments

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.

stl_accessor.zip

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.

pdJeeves avatar Oct 06 '18 02:10 pdJeeves