Original Post
Hi, I am currently implementing the lwo mesh loading feature in my engine. But unfortunately I can't get the UV to be loaded correctly and the result looks wrong like this:
(this is supposed to be a dead imp like the one we can see in Doom3's demon museum) I use the C parser code provided in the Newtek SDK to read the file and to add uv coordinates to my vertexbuffer (verts) I use the following code.
(this is supposed to be a dead imp like the one we can see in Doom3's demon museum) I use the C parser code provided in the Newtek SDK to read the file and to add uv coordinates to my vertexbuffer (verts) I use the following code.
for (lwVMap* vmap = layer->vmap; vmap; vmap = vmap->next)
{
if (vmap->dim == 2) // texture coords
{
for (int i = 0; i < vmap->nverts; i++)
{
int index = vmap->vindex;
float *values = vmap->val;
verts[index].uv = D3DXVECTOR2(values[0], 1.0 - values[1]);
}
}
}
Here I only deal with 1 layer and my vmap contains as much values as I get vertices so I assume it is a bijection (no projected texture here). I tried to flip and swizzle u and v but didn't get a convincing result. I render using DirectX. I'd really appreciate some hints. Phil