Share Mod_LoadQBSPNodes between renders

This commit is contained in:
Denis Pauk 2023-10-07 15:24:02 +03:00
parent 1121407e39
commit d6de468c49
7 changed files with 38 additions and 70 deletions

View file

@ -1404,12 +1404,7 @@ Mod_NumberLeafs(mleaf_t *leafs, mnode_t *node, int *r_leaftovis, int *r_vistolea
numvisleafs);
}
/*
=================
Mod_LoadNodes
=================
*/
void
static void
Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
const lump_t *l)
@ -1491,12 +1486,7 @@ Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
Mod_NumberLeafs(leafs, *nodes, r_leaftovis, r_vistoleaf, &numvisleafs);
}
/*
=================
Mod_LoadQNodes
=================
*/
void
static void
Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
const lump_t *l)
@ -1578,6 +1568,23 @@ Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs
Mod_NumberLeafs(leafs, *nodes, r_leaftovis, r_vistoleaf, &numvisleafs);
}
void
Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *leafs,
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
const lump_t *l, int ident)
{
if (ident == IDBSPHEADER)
{
Mod_LoadNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
mod_base, l);
}
else
{
Mod_LoadQNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
mod_base, l);
}
}
/*
=================
Mod_LoadVisibility

View file

@ -800,18 +800,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
mod->marksurfaces, mod->nummarksurfaces, mod_base,
&header->lumps[LUMP_LEAFS], header->ident);
if (header->ident == IDBSPHEADER)
{
Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
else
{
Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
&header->lumps[LUMP_NODES], header->ident);
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
mod->numframes = 2; /* regular and alternate animation */
}

View file

@ -766,18 +766,9 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
mod->marksurfaces, mod->nummarksurfaces, mod_base,
&header->lumps[LUMP_LEAFS], header->ident);
if (header->ident == IDBSPHEADER)
{
Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
else
{
Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
&header->lumps[LUMP_NODES], header->ident);
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
mod->numframes = 2; /* regular and alternate animation */
}

View file

@ -534,9 +534,9 @@ Mod_LoadBrushModel(gl4model_t *mod, void *buffer, int modfilelen)
Mod_LoadMarksurfaces(mod, mod_base, &header->lumps[LUMP_LEAFFACES]);
Mod_LoadVisibility(&mod->vis, mod_base, &header->lumps[LUMP_VISIBILITY]);
Mod_LoadLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]);
Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
&header->lumps[LUMP_NODES], header->ident);
Mod_LoadSubmodels (mod, mod_base, &header->lumps[LUMP_MODELS]);
mod->numframes = 2; /* regular and alternate animation */
}

View file

@ -328,12 +328,12 @@ extern struct image_s *GetTexImage(const char *name, findimage_t find_image);
extern struct image_s *R_FindPic(const char *name, findimage_t find_image);
extern struct image_s* R_LoadImage(const char *name, const char* namewe, const char *ext,
imagetype_t type, qboolean r_retexturing, loadimage_t load_image);
extern void Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes,
extern void Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes,
mleaf_t *leafs, int numleafs, mnode_t **nodes, int *numnodes,
const byte *mod_base, const lump_t *l);
extern void Mod_LoadQNodes(const char *name, cplane_t *planes, int numplanes,
mleaf_t *leafs, int numleafs, mnode_t **nodes, int *numnodes,
const byte *mod_base, const lump_t *l);
const byte *mod_base, const lump_t *l, int ident);
extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
msurface_t **marksurfaces, int nummarksurfaces,
const byte *mod_base, const lump_t *l, int ident);
extern void Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes,
const byte *mod_base, const lump_t *l, int extra);
extern void Mod_LoadVisibility(dvis_t **vis, const byte *mod_base, const lump_t *l);
@ -352,9 +352,6 @@ extern void Mod_LoadPlanes(const char *name, cplane_t **planes, int *numplanes,
const byte *mod_base, const lump_t *l, int extra);
extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges,
const byte *mod_base, const lump_t *l, int extra);
extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
msurface_t **marksurfaces, int nummarksurfaces,
const byte *mod_base, const lump_t *l, int ident);
extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra);
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header,

View file

@ -618,18 +618,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
mod->marksurfaces, mod->nummarksurfaces, mod_base,
&header->lumps[LUMP_LEAFS], header->ident);
if (header->ident == IDBSPHEADER)
{
Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
else
{
Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
&header->lumps[LUMP_NODES], header->ident);
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
mod->numframes = 2; /* regular and alternate animation */

View file

@ -770,18 +770,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs,
mod->marksurfaces, mod->nummarksurfaces, mod_base,
&header->lumps[LUMP_LEAFS], header->ident);
if (header->ident == IDBSPHEADER)
{
Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
Mod_LoadQBSPNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
else
{
Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs,
mod->numleafs, &mod->nodes, &mod->numnodes, mod_base,
&header->lumps[LUMP_NODES]);
}
&header->lumps[LUMP_NODES], header->ident);
Mod_LoadSubmodels(mod, mod_base, &header->lumps[LUMP_MODELS]);
mod->numframes = 2; /* regular and alternate animation */
}