[iqm] Use type-specified enums

This should make debugging a little easier in the future.
This commit is contained in:
Bill Currie 2023-09-04 12:24:40 +09:00
parent 084ac76f55
commit 5c32077c2a
3 changed files with 15 additions and 14 deletions

View file

@ -31,7 +31,7 @@ typedef struct iqmmesh_s {
uint32_t first_triangle, num_triangles; uint32_t first_triangle, num_triangles;
} iqmmesh; } iqmmesh;
enum { typedef enum : uint32_t {
IQM_POSITION = 0, IQM_POSITION = 0,
IQM_TEXCOORD = 1, IQM_TEXCOORD = 1,
IQM_NORMAL = 2, IQM_NORMAL = 2,
@ -40,9 +40,9 @@ enum {
IQM_BLENDWEIGHTS = 5, IQM_BLENDWEIGHTS = 5,
IQM_COLOR = 6, IQM_COLOR = 6,
IQM_CUSTOM = 0x10 IQM_CUSTOM = 0x10
}; } iqmverttype;
enum { typedef enum : uint32_t {
IQM_BYTE = 0, IQM_BYTE = 0,
IQM_UBYTE = 1, IQM_UBYTE = 1,
IQM_SHORT = 2, IQM_SHORT = 2,
@ -52,7 +52,7 @@ enum {
IQM_HALF = 6, IQM_HALF = 6,
IQM_FLOAT = 7, IQM_FLOAT = 7,
IQM_DOUBLE = 8 IQM_DOUBLE = 8
}; } iqmformat;
typedef struct iqmtriangle_s { typedef struct iqmtriangle_s {
uint32_t vertex[3]; uint32_t vertex[3];
@ -84,21 +84,21 @@ typedef struct iqmpose_s {
float channelscale[10]; float channelscale[10];
} iqmpose; } iqmpose;
typedef enum : uint32_t {
IQM_LOOP = 1<<0
} iqmanimflags;
typedef struct iqmanim_s { typedef struct iqmanim_s {
uint32_t name; uint32_t name;
uint32_t first_frame, num_frames; uint32_t first_frame, num_frames;
float framerate; float framerate;
uint32_t flags; iqmanimflags flags;
} iqmanim; } iqmanim;
enum {
IQM_LOOP = 1<<0
};
typedef struct iqmvertexarray_s { typedef struct iqmvertexarray_s {
uint32_t type; iqmverttype type;
uint32_t flags; uint32_t flags;
uint32_t format; iqmformat format;
uint32_t size; uint32_t size;
uint32_t offset; uint32_t offset;
} iqmvertexarray; } iqmvertexarray;

View file

@ -235,6 +235,8 @@ load_iqm_vertex_arrays (model_t *mod, const iqmheader *hdr, byte *buffer)
bytes += va->size; bytes += va->size;
color = (byte *) (buffer + va->offset); color = (byte *) (buffer + va->offset);
break; break;
case IQM_CUSTOM:
break;
} }
} }
iqm->vertexarrays = calloc (iqm->num_arrays + 1, sizeof (iqmvertexarray)); iqm->vertexarrays = calloc (iqm->num_arrays + 1, sizeof (iqmvertexarray));

View file

@ -302,11 +302,10 @@ glsl_R_IQMBegin (void)
void void
glsl_R_IQMEnd (void) glsl_R_IQMEnd (void)
{ {
int i;
qfeglBindBuffer (GL_ARRAY_BUFFER, 0); qfeglBindBuffer (GL_ARRAY_BUFFER, 0);
qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); qfeglBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
for (i = 0; i <= IQM_COLOR; i++) for (uint32_t i = 0; i <= IQM_COLOR; i++) {
qfeglDisableVertexAttribArray (vertex_attribs[i].attr->location); qfeglDisableVertexAttribArray (vertex_attribs[i].attr->location);
}
} }