mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 08:20:40 +00:00
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models with more than one skin are quite rare, and those with animated skin groups are even rarer. However, for those models that do have more than one skin, it will allow for reduced allocation overheads, and when supported (glsl, vulkan, maybe gl), loading all the skins into an array texture (since all skins are the same size, though external skins may vary), but that's not implemented yet, this just wraps the old one skin at a time code.
This commit is contained in:
parent
f66df59c43
commit
e40f3f4f93
12 changed files with 105 additions and 35 deletions
|
@ -75,8 +75,14 @@ Mod_LoadAllSkins (mod_alias_ctx_t *alias_ctx, int numskins,
|
|||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = m_funcs->Mod_LoadSkin (alias_ctx, skin, skinsize, snum, 0,
|
||||
false, &pskindesc[snum]);
|
||||
mod_alias_skin_t askin = {
|
||||
.skin_num = snum,
|
||||
.group_num = -1,
|
||||
.texels = skin,
|
||||
.skindesc = &pskindesc[snum],
|
||||
};
|
||||
skin += skinsize;
|
||||
DARRAY_APPEND (&alias_ctx->skins, askin);
|
||||
} else {
|
||||
pskintype++;
|
||||
pinskingroup = (daliasskingroup_t *) pskintype;
|
||||
|
@ -107,13 +113,20 @@ Mod_LoadAllSkins (mod_alias_ctx_t *alias_ctx, int numskins,
|
|||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = mod_funcs->Mod_LoadSkin (alias_ctx, skin, skinsize,
|
||||
snum, gnum, true,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
skin = (byte *) (pskintype + 1);
|
||||
mod_alias_skin_t askin = {
|
||||
.skin_num = snum,
|
||||
.group_num = gnum,
|
||||
.texels = skin,
|
||||
.skindesc = &paliasskingroup->skindescs[gnum],
|
||||
};
|
||||
skin += skinsize;
|
||||
DARRAY_APPEND (&alias_ctx->skins, askin);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
}
|
||||
mod_funcs->Mod_LoadAllSkins (alias_ctx);
|
||||
|
||||
return pskintype;
|
||||
}
|
||||
|
@ -232,6 +245,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
DARRAY_INIT (&alias_ctx.poseverts, 256);
|
||||
DARRAY_INIT (&alias_ctx.stverts, 256);
|
||||
DARRAY_INIT (&alias_ctx.triangles, 256);
|
||||
DARRAY_INIT (&alias_ctx.skins, 256);
|
||||
|
||||
if (LittleLong (* (unsigned int *) buffer) == HEADER_MDL16)
|
||||
extra = 1; // extra precision bytes
|
||||
|
@ -392,4 +406,5 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
DARRAY_CLEAR (&alias_ctx.poseverts);
|
||||
DARRAY_CLEAR (&alias_ctx.stverts);
|
||||
DARRAY_CLEAR (&alias_ctx.triangles);
|
||||
DARRAY_CLEAR (&alias_ctx.skins);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue