Move Mod_FindClipDepth and recurse_clip_tree into clip_hull.c.

Since the hull depth needs to be set for the hull to be useful, it makes
sense to move the code into the same place that allocates new hulls (to me,
anyway).
This commit is contained in:
Bill Currie 2012-12-29 16:07:30 +09:00
parent 04a7e87b75
commit a4d95f3f53
2 changed files with 23 additions and 23 deletions

View file

@ -899,29 +899,6 @@ Mod_FindDrawDepth (void)
recurse_draw_tree (loadmodel->nodes, 1);
}
static void
recurse_clip_tree (hull_t *hull, int num, int depth)
{
mclipnode_t *node;
if (num < 0) {
if (depth > hull->depth)
hull->depth = depth;
return;
}
node = hull->clipnodes + num;
recurse_clip_tree (hull, node->children[0], depth + 1);
recurse_clip_tree (hull, node->children[1], depth + 1);
}
void
Mod_FindClipDepth (hull_t *hull)
{
hull->depth = 0;
if (hull->clipnodes) // no hull 3?
recurse_clip_tree (hull, hull->firstclipnode, 1);
}
void
Mod_LoadBrushModel (model_t *mod, void *buffer)
{

View file

@ -69,3 +69,26 @@ MOD_Free_Hull (clip_hull_t *ch)
{
free (ch);
}
static void
recurse_clip_tree (hull_t *hull, int num, int depth)
{
mclipnode_t *node;
if (num < 0) {
if (depth > hull->depth)
hull->depth = depth;
return;
}
node = hull->clipnodes + num;
recurse_clip_tree (hull, node->children[0], depth + 1);
recurse_clip_tree (hull, node->children[1], depth + 1);
}
void
Mod_FindClipDepth (hull_t *hull)
{
hull->depth = 0;
if (hull->clipnodes) // no hull 3?
recurse_clip_tree (hull, hull->firstclipnode, 1);
}