Build the iqm vertex arrays in the correct order.

They need to be built in ascending type order (makes life easier in the
renderer).
This commit is contained in:
Bill Currie 2012-05-11 15:40:28 +09:00
parent bea8f8f9c4
commit 551dfc47fb
1 changed files with 11 additions and 11 deletions

View File

@ -250,6 +250,13 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
va[1].offset = va->offset + va->size * sizeof (float);
va++;
}
if (texcoord) {
va->type = IQM_TEXCOORD;
va->format = IQM_FLOAT;
va->size = 2;
va[1].offset = va->offset + va->size * sizeof (float);
va++;
}
if (normal) {
va->type = IQM_NORMAL;
va->format = IQM_FLOAT;
@ -264,13 +271,6 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
va[1].offset = va->offset + va->size * sizeof (float);
va++;
}
if (texcoord) {
va->type = IQM_TEXCOORD;
va->format = IQM_FLOAT;
va->size = 2;
va[1].offset = va->offset + va->size * sizeof (float);
va++;
}
if (blendindex) {
va->type = IQM_BLENDINDEXES;
va->format = IQM_UBYTE;
@ -303,6 +303,10 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
memcpy (vert + va->offset, &position[i * 3], 3 * sizeof (float));
va++;
}
if (texcoord) {
memcpy (vert + va->offset, &texcoord[i * 2], 2 * sizeof (float));
va++;
}
if (normal) {
memcpy (vert + va->offset, &normal[i * 3], 3 * sizeof (float));
va++;
@ -311,10 +315,6 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
memcpy (vert + va->offset, &tangent[i * 4], 4 * sizeof (float));
va++;
}
if (texcoord) {
memcpy (vert + va->offset, &texcoord[i * 2], 2 * sizeof (float));
va++;
}
if (blendindex) {
memcpy (vert + va->offset, &blendindex[i * 4], 4);
va++;