Add a stride field to iqm_t.

Since iqm vertex arrays are variable, and I don't want to calculate the
stride every time I render a model, cached the value used when building the
arrays.
This commit is contained in:
Bill Currie 2012-05-11 12:47:20 +09:00
parent 15d35fbdc9
commit 078cb10caf
2 changed files with 2 additions and 0 deletions

View file

@ -127,6 +127,7 @@ typedef struct {
int num_meshes;
iqmmesh *meshes;
byte *vertices;
int stride;
uint16_t *elements;
int num_arrays;
iqmvertexarray *vertexarrays;

View file

@ -295,6 +295,7 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
iqm->vertexarrays = realloc (iqm->vertexarrays,
iqm->num_arrays * sizeof (iqmvertexarray));
iqm->vertices = malloc (hdr->num_vertexes * bytes);
iqm->stride = bytes;
for (i = 0; i < hdr->num_vertexes; i++) {
va = iqm->vertexarrays;
vert = iqm->vertices + i * bytes;