I'm having issues with textures for "some" of my meshes. We have two types of mesh primitive types in our data: triangle and polygon. Triangle prims have 3 vertices, and polygon prims can have any number of vertices.
OpenFlight textures are working great for our triangle prims, but not for our polygon prims. I'm using the same exact code for both, and I don't assume 3 vertices anywhere, so both should work identically. I use this for both types (is MPRIM_INDEXED_POLY okay for both types?):
mgMeshPrimitiveSetType(db_mesh, db_prim_index, MPRIM_INDEXED_POLY) )
The interesting thing is when I look at the FLT file in a viewer it appears like my polygons (in this case simple squares) are bisected into triangles. That is it looks like my square polygon is now 2 triangles, and the texture is repeating on each triangle. I set the prim vertex indices array this way, and the last parameter seems to indicate that OpenFlight can handle any number of vertex indices:
mgMeshPrimitiveSetVtxIndexArray(db_mesh, db_prim_index, vinds, v_index.size()) )
First, note that the file you sent has polygons, not meshes.
1. It looks like they have multiple copies of the same texture image in the Textures folder. Are they somehow using different texture files for each primitive face of the cube?
They are but they certainly don't need to. I.E., they have 3 identical copies of the same image in the Texture palette, one at index 0, one at index 1 and one at index 2. Some of the faces are assigned texture index 0, some texture index 1 and some texture index 2. This is not incorrect, but certainly wasteful. This file would render exactly the same if they removed texture indices 1 and 2 and assigned all faces texture index 0.
2. If so, how is that possible? Is this in fact a single mesh with 6 primitives, or did they do something differently than I am (e.g. these are actually 6 meshes, not a single, 6 faced mesh)?
3. If it is a single, 6 faced mesh, how are they managing faces with no textures?
4. If it is a single, 6 faced mesh, how are they managing to make shared vertices have multiple (u,v) coords, or are they?
As I noted above, this is not a mesh. It is 12 separate polygons. OpenFlight polygons don't have shared vertices, OpenFlight meshes do.
I see. That explains a lot. What I ended up trying today that works is to create a new fltMesh with one mesh primitive for each face. I suppose at this point though I don't see any reason to even use meshes, since each one is basically a single polygon. I guess I'll just see which approach works faster and/or results in smaller FLT files.
Thanks for your time.
Certainly if your vertices are not "shareable" meshes become less attractive.
I suppose at this point though I donÃ¢â¬â¢t see any reason to even use meshes, since each one is basically a single polygon.