mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 17:12:15 +00:00
Documentation for solidbsp.
This commit is contained in:
parent
4b1b838f87
commit
f3e7a7ca89
2 changed files with 64 additions and 29 deletions
|
@ -30,9 +30,18 @@ struct plane_s;
|
||||||
struct surface_s;
|
struct surface_s;
|
||||||
struct node_s;
|
struct node_s;
|
||||||
|
|
||||||
void DivideFacet (struct visfacet_s *in, struct plane_s *split,
|
/** Calculate the bounding box of the surface.
|
||||||
struct visfacet_s **front, struct visfacet_s **back);
|
|
||||||
|
\param surf The surface of which to calculate the bounding box.
|
||||||
|
*/
|
||||||
void CalcSurfaceInfo (struct surface_s *surf);
|
void CalcSurfaceInfo (struct surface_s *surf);
|
||||||
|
|
||||||
|
/** Partition the surfaces, creating a nice bsp.
|
||||||
|
|
||||||
|
\param surfhead The surfaces to partition.
|
||||||
|
\param midsplit If true, use the volume balancing heuristic rather than
|
||||||
|
the split balancing heuristic (false).
|
||||||
|
*/
|
||||||
struct node_s *SolidBSP (struct surface_s *surfhead, qboolean midsplit);
|
struct node_s *SolidBSP (struct surface_s *surfhead, qboolean midsplit);
|
||||||
|
|
||||||
#endif//qfbsp_solidbsp_h
|
#endif//qfbsp_solidbsp_h
|
||||||
|
|
|
@ -48,10 +48,18 @@ int c_solid, c_empty, c_water;
|
||||||
qboolean usemidsplit;
|
qboolean usemidsplit;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/** Determine on which side of the plane a face is.
|
||||||
FaceSide
|
|
||||||
|
|
||||||
For BSP hueristic
|
\param in The face.
|
||||||
|
\param split The plane.
|
||||||
|
\return <dl>
|
||||||
|
<dt>SIDE_FRONT</dt>
|
||||||
|
<dd>The face is in front of or on the plane.</dd>
|
||||||
|
<dt>SIDE_BACK</dt>
|
||||||
|
<dd>The face is behind or on the plane.</dd>
|
||||||
|
<dt>SIDE_ON</dt>
|
||||||
|
<dd>The face is on or cut by the plane.</dd>
|
||||||
|
</dl>
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
FaceSide (face_t *in, plane_t *split)
|
FaceSide (face_t *in, plane_t *split)
|
||||||
|
@ -102,10 +110,16 @@ FaceSide (face_t *in, plane_t *split)
|
||||||
return SIDE_ON;
|
return SIDE_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/** Chose the best plane for dividing the bsp.
|
||||||
ChooseMidPlaneFromList
|
|
||||||
|
|
||||||
The clipping hull BSP doesn't worry about avoiding splits
|
The clipping hull BSP doesn't worry about avoiding splits, so this
|
||||||
|
function tries to find the plane that gives the most even split of the
|
||||||
|
bounding volume.
|
||||||
|
|
||||||
|
\param surfaces The surface chain of the bsp.
|
||||||
|
\param mins The minimum coordinate of the boundiing box.
|
||||||
|
\param maxs The maximum coordinate of the boundiing box.
|
||||||
|
\return The chosen surface.
|
||||||
*/
|
*/
|
||||||
static surface_t *
|
static surface_t *
|
||||||
ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs)
|
ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs)
|
||||||
|
@ -160,10 +174,16 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs)
|
||||||
return bestsurface;
|
return bestsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/** Choose the best plane that produces the fewest splits.
|
||||||
ChoosePlaneFromList
|
|
||||||
|
|
||||||
The real BSP hueristic
|
\param surfaces The surface chain of the bsp.
|
||||||
|
\param mins The minimum coordinate of the boundiing box.
|
||||||
|
\param maxs The maximum coordinate of the boundiing box.
|
||||||
|
\param usefloors If false, floors will not be chosen.
|
||||||
|
\param usedetail If true, the plain must have structure faces, else
|
||||||
|
the plain must not have structure faces.
|
||||||
|
\return The chosen surface, or NULL if a suitable surface could
|
||||||
|
not be found.
|
||||||
*/
|
*/
|
||||||
static surface_t *
|
static surface_t *
|
||||||
ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs,
|
ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs,
|
||||||
|
@ -257,11 +277,12 @@ ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs,
|
||||||
return bestsurface;
|
return bestsurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/** Select a surface on which to split the group of surfaces.
|
||||||
SelectPartition
|
|
||||||
|
|
||||||
Selects a surface from a linked list of surfaces to split the group on
|
\param surfaces The group of surfaces.
|
||||||
returns NULL if the surface list can not be divided any more (a leaf)
|
\param detail Set to 1 if the selected surface has detail.
|
||||||
|
\return The selected surface or NULL if the list can no longer
|
||||||
|
be defined (ie, a leaf).
|
||||||
*/
|
*/
|
||||||
static surface_t *
|
static surface_t *
|
||||||
SelectPartition (surface_t *surfaces, int *detail)
|
SelectPartition (surface_t *surfaces, int *detail)
|
||||||
|
@ -322,13 +343,6 @@ SelectPartition (surface_t *surfaces, int *detail)
|
||||||
return ChoosePlaneFromList (surfaces, mins, maxs, true, true);
|
return ChoosePlaneFromList (surfaces, mins, maxs, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
|
|
||||||
/*
|
|
||||||
CalcSurfaceInfo
|
|
||||||
|
|
||||||
Calculates the bounding box
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
CalcSurfaceInfo (surface_t *surf)
|
CalcSurfaceInfo (surface_t *surf)
|
||||||
{
|
{
|
||||||
|
@ -359,6 +373,13 @@ CalcSurfaceInfo (surface_t *surf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Divide a surface by the plane.
|
||||||
|
|
||||||
|
\param in The surface to divide.
|
||||||
|
\param split The plane by which to divide the surface.
|
||||||
|
\param front Tne part of the surface in front of the plane.
|
||||||
|
\param back The part of the surface behind the plane.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
DividePlane (surface_t *in, plane_t *split, surface_t **front,
|
DividePlane (surface_t *in, plane_t *split, surface_t **front,
|
||||||
surface_t **back)
|
surface_t **back)
|
||||||
|
@ -483,11 +504,11 @@ DividePlane (surface_t *in, plane_t *split, surface_t **front,
|
||||||
CalcSurfaceInfo (in);
|
CalcSurfaceInfo (in);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/** Determine the contents of the leaf and create the final list of
|
||||||
LinkConvexFaces
|
|
||||||
|
|
||||||
Determines the contents of the leaf and creates the final list of
|
|
||||||
original faces that have some fragment inside this leaf
|
original faces that have some fragment inside this leaf
|
||||||
|
|
||||||
|
\param planelist surfaces bounding the leaf.
|
||||||
|
\param leafnode The leaf.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
LinkConvexFaces (surface_t *planelist, node_t *leafnode)
|
LinkConvexFaces (surface_t *planelist, node_t *leafnode)
|
||||||
|
@ -552,10 +573,10 @@ LinkConvexFaces (surface_t *planelist, node_t *leafnode)
|
||||||
leafnode->markfaces[i] = NULL; // sentinal
|
leafnode->markfaces[i] = NULL; // sentinal
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/** Return a duplicated list of all faces on surface
|
||||||
LinkNodeFaces
|
|
||||||
|
|
||||||
Returns a duplicated list of all faces on surface
|
\param surface The surface of which to duplicate the faces.
|
||||||
|
\return The duplicated list.
|
||||||
*/
|
*/
|
||||||
static face_t *
|
static face_t *
|
||||||
LinkNodeFaces (surface_t *surface)
|
LinkNodeFaces (surface_t *surface)
|
||||||
|
@ -589,6 +610,11 @@ LinkNodeFaces (surface_t *surface)
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Partition the surfaces, creating a nice bsp.
|
||||||
|
|
||||||
|
\param surfaces The surfaces to partition.
|
||||||
|
\param node The current node.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
PartitionSurfaces (surface_t *surfaces, node_t *node)
|
PartitionSurfaces (surface_t *surfaces, node_t *node)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue