Twinklebear / tobj

Tiny OBJ Loader in Rust
MIT License
233 stars 47 forks source link

missing a way to get texcord indices #37

Closed manthanabc closed 3 years ago

manthanabc commented 3 years ago

there seem no way to get the sequence of tex-cordinates used . like for example consider this obj file

# Blender v2.79 (sub 0) OBJ File: ''
# www.blender.org
mtllib plane.mtl
o Plane

v 0.000000 -1.000000 1.000000

v 0.000000 1.000000 -1.000000

v 0.000000 1.000000 1.000000

v 0.000000 -1.000000 -1.000000

vt 0.000000 0.000000

vt 1.000000 1.000000

vt 0.000000 1.000000

vt 1.000000 0.000000

vn 1.0000 0.0000 0.0000

usemtl Material.001
s 1

f 1/1/1 2/2/1 3/3/1

f 1/1/1 4/4/1 2/2/1

here we can get the indices for sequence in which the vertices are used but i cannot find a way to get indices of tex cordinates . i might just be missing something .

Twinklebear commented 3 years ago

You're correct, right now tobj doesn't provide a way to get separate indices of position/normal/texcoord per-face. I've been thinking to add an option to get the loaded mesh data back in a multi-indexed layout, similar to what tinyobjloader provides now: https://github.com/tinyobjloader/tinyobjloader#data-format . Then you'd have a list with different position/normal/texcoord indices per vertex, and tobj would still provide a mode that can flatten it down to a single indexed layout.

virtualritz commented 3 years ago

My multi_index branch has support for this.

Build the docs for that branch for more information.

Twinklebear commented 3 years ago

Now released in 3.0.0