Skip to content

Commit adcd11e

Browse files
MD3: Reduce temporary vertex remap table size by 50%
MDL code needed to be able to remap both the original vertex and a version of it with an UV seam adjustment applied. Since seam adjustments are not needed for MD3, we can use a smaller remapping table.
1 parent ce8ac15 commit adcd11e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Quake/gl_model.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5003,21 +5003,20 @@ static void Mod_LoadMD3Model (qmodel_t* mod, const char* buffer)
50035003
}
50045004

50055005
int mark = Hunk_LowMark ();
5006-
unsigned short* remap = (unsigned short*)Hunk_Alloc (hdr->numverts * 2 * sizeof (remap[0]));
5006+
unsigned short* remap = (unsigned short*)Hunk_Alloc (hdr->numverts * sizeof (remap[0]));
50075007
hdr->numindexes = 0;
50085008
hdr->numverts_vbo = 0;
50095009
for (i = 0; i < hdr->numtris; i++) {
50105010
for (j = 0; j < 3; j++) {
50115011
unsigned short vertindex = LittleLong (in_tris_md3[i].indexes[j]);
5012-
int v = vertindex * 2;
50135012
if (vertindex >= (unsigned short)numVerts) Sys_Error ("Vertex index out of bounds");
5014-
if (!remap[v]) {
5013+
if (!remap[vertindex]) {
50155014
out_meshdesc[hdr->numverts_vbo].vertindex = vertindex;
50165015
out_meshdesc[hdr->numverts_vbo].st[0] = raw_stverts[vertindex].s;
50175016
out_meshdesc[hdr->numverts_vbo].st[1] = raw_stverts[vertindex].t;
5018-
remap[v] = ++hdr->numverts_vbo;
5017+
remap[vertindex] = ++hdr->numverts_vbo;
50195018
}
5020-
poutindexes[hdr->numindexes++] = remap[v] - 1;
5019+
poutindexes[hdr->numindexes++] = remap[vertindex] - 1;
50215020
}
50225021
}
50235022
Hunk_FreeToLowMark (mark);

0 commit comments

Comments
 (0)