I have an object broken into many small parts. I could maintain a global list of vertices and figure out which belong to each small part, but it would be easier in my use case if I could index relatively.
IE, I specify that part 0 has 8 vertices, and face 0 of part 0 uses vertex 0, 3, 4 of that part.
Is there a way to do this in Wavefront OBJ files? It's a little unclear how Groups and Objects work.
For example, is the following legal?
o myObj1
v 3159.000000 203.000000 1959.000000 1.000000
v 3161.000000 203.000000 1959.000000 1.000000
v 3161.000000 203.000000 1961.000000 1.000000
v 3159.000000 203.000000 1961.000000 1.000000
v 3159.000000 205.000000 1959.000000 1.000000
v 3161.000000 205.000000 1959.000000 1.000000
v 3161.000000 205.000000 1961.000000 1.000000
v 3159.000000 205.000000 1961.000000 1.000000
f 1 4 5
f 4 5 8
f 2 3 6
f 3 6 7
f 1 2 3
f 1 3 4
f 5 6 7
f 5 7 8
f 1 2 5
f 2 5 6
f 4 3 8
f 3 8 7
o myObj2
v 3159.000000 203.000000 1961.000000 1.000000
v 3161.000000 203.000000 1961.000000 1.000000
v 3161.000000 203.000000 1963.000000 1.000000
v 3159.000000 203.000000 1963.000000 1.000000
v 3159.000000 205.000000 1961.000000 1.000000
v 3161.000000 205.000000 1961.000000 1.000000
v 3161.000000 205.000000 1963.000000 1.000000
v 3159.000000 205.000000 1963.000000 1.000000
f 1 4 5
f 4 5 8
f 2 3 6
f 3 6 7
f 1 2 3
f 1 3 4
f 5 6 7
f 5 7 8
f 1 2 5
f 2 5 6
f 4 3 8
f 3 8 7
And so on. (Assuming coordinates is the coordinates, of course)
EDIT: Wikipedia states:
OBJ files, due to their list structure, are able to reference vertices, normals, etc. either by their absolute position (1 represents the first defined vertex, N representing the Nth defined vertex), or by their relative position (-1 represents the latest defined vertex). However, not all software supports the latter approach, and conversely some software inherently writes only the latter form (due to the convenience of appending elements without needing to recalculate vertex offsets, etc.), leading to occasional incompatibilities.
So this...should work? It's unclear what the format would look like however. In any case, it fails to work properly in 3D Viewer.