Skip to content

Commit

Permalink
Limit alias models to 32k vertices
Browse files Browse the repository at this point in the history
(16-bit index buffer + onseam duplication)
  • Loading branch information
andrei-drexler committed Nov 10, 2024
1 parent 322733f commit d6943b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Quake/gl_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -3256,16 +3256,16 @@ static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)

if (pheader->numverts <= 0)
Sys_Error ("model %s has no vertices", mod->name);

if (pheader->numverts > MAXALIASVERTS_QS && (developer.value || map_checks.value))
else if (pheader->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices (%d; max = %d)", mod->name, pheader->numverts, MAXALIASVERTS);
else if (pheader->numverts > MAXALIASVERTS_QS && (developer.value || map_checks.value))
Con_Warning ("model %s vertex count of %d exceeds QS limit of %d\n", mod->name, pheader->numverts, MAXALIASVERTS_QS);

pheader->numtris = LittleLong (pinmodel->numtris);

if (pheader->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name);

if (pheader->numtris > MAXALIASTRIS_QS && (developer.value || map_checks.value))
else if (pheader->numtris > MAXALIASTRIS_QS && (developer.value || map_checks.value))
Con_Warning ("model %s triangle count of %d exceeds QS limit of %d\n", mod->name, pheader->numtris, MAXALIASTRIS_QS);

pheader->numframes = LittleLong (pinmodel->numframes);
Expand Down
1 change: 1 addition & 0 deletions Quake/gl_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ typedef struct
bonepose_t inverse;
} boneinfo_t;

#define MAXALIASVERTS 0x7fff //16-bit index buffer + onseam duplication
#define MAXALIASVERTS_QS 2000 //johnfitz -- was 1024
#define MAXALIASFRAMES 1024 //spike -- was 256
#define MAXALIASTRIS_QS 4096 //ericw -- was 2048
Expand Down

0 comments on commit d6943b4

Please sign in to comment.