tinygltf icon indicating copy to clipboard operation
tinygltf copied to clipboard

Store texture as map?

Open pkarasev3-tri opened this issue 6 years ago • 2 comments

https://github.com/syoyo/tinygltf/blob/edf8d5cae1eb69376832da69b1e06e5f4daf3740/tiny_gltf.h#L809

The "TODO" in glview.cc seems difficult/impossible unless the textures are stored as an associated container... should the definition of Model be given maps instead of vectors for some cases? tinygltf/examples/glview/glview.cc:424

pkarasev3-tri avatar May 14 '19 23:05 pkarasev3-tri

In a glTF asset, everything is actually stored as arrays.

Material refer to texture as their index in the "texture" array. This kind of storage makes sense for tinygltf. Same goes for a texture source, it's an image.

Exactly the same for accessing all the binary data. Node -> Mesh -> accessor(s) -> bufferView -> buffer.

Each of these "->" is just an index in the corresponding array.

Hope this helps!

Ybalrid avatar May 14 '19 23:05 Ybalrid

@pkarasev3-tri which "TODO" are you referring to exactly?

Ybalrid avatar May 19 '19 06:05 Ybalrid