models: prepare command compress to share logic

This commit is contained in:
Denis Pauk 2024-03-10 13:56:33 +02:00
parent 28bb559e52
commit 7bce5d75fb
2 changed files with 9 additions and 7 deletions

View File

@ -767,7 +767,7 @@ Mod_LoadModel_MDL(const char *mod_name, const void *buffer, int modfilelen,
/* glcmds generation */
static int
md2_strip_length(int starttri, int startv, dtriangle_t *triangles, int num_tris,
Mod_LoadCmdStripLength(int starttri, int startv, dtriangle_t *triangles, int num_tris,
byte *used, int *strip_xyz, int *strip_st, int *strip_tris)
{
int m1, m2;
@ -854,7 +854,7 @@ done:
}
static int
md2_fan_length(int starttri, int startv, dtriangle_t *triangles, int num_tris,
Mod_LoadCmdFanLength(int starttri, int startv, dtriangle_t *triangles, int num_tris,
byte *used, int *strip_xyz, int *strip_st, int *strip_tris)
{
int m1, m2;
@ -933,8 +933,8 @@ done:
return stripcount;
}
static int
md2_build_glcmds(const dstvert_t *texcoords, dtriangle_t *triangles, int num_tris,
int
Mod_LoadCmdCompress(const dstvert_t *texcoords, dtriangle_t *triangles, int num_tris,
int *commands, int skinwidth, int skinheight)
{
int i, j, numcommands = 0, startv, len, bestlen, type, besttype = -1;
@ -965,12 +965,12 @@ md2_build_glcmds(const dstvert_t *texcoords, dtriangle_t *triangles, int num_tri
{
if (type == 1)
{
len = md2_strip_length(i, startv, triangles, num_tris,
len = Mod_LoadCmdStripLength(i, startv, triangles, num_tris,
used, strip_xyz, strip_st, strip_tris);
}
else
{
len = md2_fan_length(i, startv, triangles, num_tris,
len = Mod_LoadCmdFanLength(i, startv, triangles, num_tris,
used, strip_xyz, strip_st, strip_tris);
}
@ -1206,7 +1206,7 @@ Mod_LoadModel_MD3(const char *mod_name, const void *buffer, int modfilelen,
}
/* write glcmds */
mesh_nodes[i].num = md2_build_glcmds(
mesh_nodes[i].num = Mod_LoadCmdCompress(
(dstvert_t*)((byte *)pheader + pheader->ofs_st),
(dtriangle_t*)((byte *)pheader + pheader->ofs_tris) + num_tris,
LittleLong(md3_mesh->num_tris),

View File

@ -40,5 +40,7 @@ extern void PrepareFrameVertex(dmdx_vert_t *vertexArray, int num_verts,
daliasxframe_t *frame_out);
extern void *Mod_LoadModel_MD5(const char *mod_name, const void *buffer,
int modfilelen, struct image_s ***skins, int *numskins, modtype_t *type);
extern int Mod_LoadCmdCompress(const dstvert_t *texcoords, dtriangle_t *triangles, int num_tris,
int *commands, int skinwidth, int skinheight);
#endif /* SRC_CLIENT_REFRESH_FILES_MODELS_H_ */