spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability
https://fastgltf.readthedocs.io/v0.8.x/
MIT License
315 stars 48 forks source link

Utilities to extract data from accessors #20

Closed forenoonwatch closed 1 year ago

forenoonwatch commented 1 year ago

This PR adds fastgltf_tools.hpp, a header containing several utility functions such as getAccessorElement, iterateAccessor, and fillTargetFromAccessor, the ElementTraits<T> struct for matching metadata about the desired type, and the DefaultBufferDataAdapter, a minimal default implementation of the BufferDataAdapter pattern which allows the accessor indexing functions to resolve used buffer memory.

Currently this PR lacks support for compressed buffer views from EXT_meshopt_compression.

forenoonwatch commented 1 year ago
  • In Release mode on MSVC the "getAccessorElement" test fails sometimes (!) with sparse accessors. With a debugger I noticed the values are definitely wrong but I couldn't tell you why.

REQUIRE(checkValues[i] == fastgltf::getAccessorElementglm::vec3(*asset, secondAccessor, i)) with expansion: {?} == {?}

I've been able to replicate this in my MinGW release (intermittently). Trying to see if I can actually figure out what's causing it.