mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Assign shaders to surfaces that don't have a shader assigned
This commit is contained in:
parent
0a31ab7558
commit
e8109076f4
1 changed files with 29 additions and 2 deletions
|
@ -176,8 +176,8 @@ dtikianim_t *TIKI_LoadTikiAnim(const char *path)
|
|||
|
||||
TIKI_InitSetup(&loaddef);
|
||||
|
||||
loaddef.path = path;
|
||||
loaddef.numanims = 0;
|
||||
loaddef.path = path;
|
||||
loaddef.numanims = 0;
|
||||
loaddef.numserverinitcmds = 0;
|
||||
loaddef.numclientinitcmds = 0;
|
||||
|
||||
|
@ -451,6 +451,33 @@ dtiki_t *TIKI_LoadTikiModel(dtikianim_t *tikianim, const char *name, con_map<str
|
|||
}
|
||||
}
|
||||
|
||||
// Added in 2.0
|
||||
// For surfaces without shader
|
||||
// assign them the shader with the same name
|
||||
surfOffset = 0;
|
||||
for (i = 0; i < temp.tiki.numMeshes; i++, surfOffset += skelmodel->numSurfaces) {
|
||||
skelmodel = TIKI_GetSkel(temp.tiki.mesh[i]);
|
||||
|
||||
surf = skelmodel->pSurfaces;
|
||||
|
||||
for (j = 0; j < skelmodel->numSurfaces; j++, surf = surf->pNext) {
|
||||
tikiSurf = &tiki->surfaces[surfOffset + j];
|
||||
|
||||
if (tikiSurf->numskins) {
|
||||
// Skip surfaces with skins
|
||||
continue;
|
||||
}
|
||||
|
||||
Q_strncpyz(tikiSurf->name, surf->name, sizeof(tikiSurf->name));
|
||||
|
||||
if (strlen(surf->name) != 9 || !Q_strncmp(surf->name, "material", 8)) {
|
||||
Q_strncpyz(tikiSurf->shader[0], surf->name, sizeof(tikiSurf->shader[0]));
|
||||
}
|
||||
|
||||
tikiSurf->numskins = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tiki->radius) {
|
||||
TIKI_CalcRadius(tiki);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue