src/GLTFLoader.cpp
void GetFloatsFromAccessor(const cgltf_accessor& accessor, unsigned int componentCount, std::vector<float>& outValues)
   {
      outValues.resize(accessor.count * componentCount);

      for (cgltf_size i = 0; i < accessor.count; ++i)
      {
         cgltf_accessor_read_float(&accessor, i, &outValues[i * componentCount], componentCount);
      }
   }
// In a glTF file...
// - A buffer contains data that is read from a file
//   Properties: byteLength, uri
// - A bufferView defines a segment of the buffer data
//   Properties: buffer, byteOffset, byteLength, byteStride, target (optional OpenGL buffer target)
// - An accessor defines how the data of a bufferView is interpreted
//   Properties: bufferView, byteOffset, type (e.g. "VEC2"), componentType (e.g. GL_FLOAT), count (e.g. number of "VEC2"s in the bufferView), min, max
// The function below reads the values of an accessor whose componentType must be GL_FLOAT
// E.g. For an accessor with a type of "VEC2", a componentType of GL_FLOAT and a count of 32, componentCount should be equal to 2,
//      which would result in 64 floats being read
In a glTF file
A buffer contains data that is read from a file
Properties: byteLength, uri
A bufferView defines a segment of the buffer data
Properties: buffer, byteOffset, byteLength, byteStride, target (optional OpenGL buffer target)
An accessor defines how the data of a bufferView is interpreted
Properties: bufferView, byteOffset, type , componentType , count , min, max
The function below reads the values of an accessor whose componentType must be GL_FLOAT
E.g. For an accessor with a type of "VEC2", a componentType of GL_FLOAT and a count of 32, componentCount should be equal to 2,
which would result in 64 floats being read
In a glTF file A buffer contains data that is read from a file Properties : byteLength uri A bufferView defines a segment of the buffer data Properties : buffer byteOffset byteLength byteStride target ( optional OpenGL buffer target ) An accessor defines how the data of a bufferView is interpreted Properties : bufferView byteOffset type componentType count min max The function below reads the values of an accessor whose componentType must be GL_FLOAT E . g . For an accessor with a type of " VEC2 " a componentType of GL_FLOAT and a count of 32 componentCount should be equal to 2 which would result in 64 floats being read
void GetFloatsFromAccessor(const cgltf_accessor& accessor, unsigned int componentCount, std::vector<float>& outValues)
   {
      outValues.resize(accessor.count * componentCount);
      for (cgltf_size i = 0; i < accessor.count; ++i)
      {
         cgltf_accessor_read_float(&accessor, i, &outValues[i * componentCount], componentCount);
      }
   }
void GetFloatsFromAccessor ( const cgltf_accessor & accessor , unsigned int componentCount , std :: vector < float > & outValues ) { outValues . resize ( accessor . count * componentCount ) ; for ( cgltf_size i = 0 ; i < accessor . count ; ++ i ) { cgltf_accessor_read_float ( & accessor , i , & outValues [ i * componentCount ] , componentCount ) ; } }
In a glTF file...
 A buffer contains data that is read from a file
Properties: byteLength, uri
 A bufferView defines a segment of the buffer data
Properties: buffer, byteOffset, byteLength, byteStride, target (optional OpenGL buffer target)
 An accessor defines how the data of a bufferView is interpreted
Properties: bufferView, byteOffset, type (e.g.
In a glTF file ... A buffer contains data that is read from a file Properties : byteLength uri A bufferView defines a segment of the buffer data Properties : buffer byteOffset byteLength byteStride target ( optional OpenGL buffer target ) An accessor defines how the data of a bufferView is interpreted Properties : bufferView byteOffset type ( e . g .