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

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[1].offset = va->offset + va->size * sizeof (float);
va++; 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) { if (normal) {
va->type = IQM_NORMAL; va->type = IQM_NORMAL;
va->format = IQM_FLOAT; 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[1].offset = va->offset + va->size * sizeof (float);
va++; 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) { if (blendindex) {
va->type = IQM_BLENDINDEXES; va->type = IQM_BLENDINDEXES;
va->format = IQM_UBYTE; 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)); memcpy (vert + va->offset, &position[i * 3], 3 * sizeof (float));
va++; va++;
} }
if (texcoord) {
memcpy (vert + va->offset, &texcoord[i * 2], 2 * sizeof (float));
va++;
}
if (normal) { if (normal) {
memcpy (vert + va->offset, &normal[i * 3], 3 * sizeof (float)); memcpy (vert + va->offset, &normal[i * 3], 3 * sizeof (float));
va++; 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)); memcpy (vert + va->offset, &tangent[i * 4], 4 * sizeof (float));
va++; va++;
} }
if (texcoord) {
memcpy (vert + va->offset, &texcoord[i * 2], 2 * sizeof (float));
va++;
}
if (blendindex) { if (blendindex) {
memcpy (vert + va->offset, &blendindex[i * 4], 4); memcpy (vert + va->offset, &blendindex[i * 4], 4);
va++; va++;