From 985c27b52d20c73887a08527e6359ffc25d6dda1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 12 Oct 2010 19:33:27 +0900 Subject: [PATCH] Some more brush documentation. --- tools/qfbsp/include/brush.h | 6 ++++++ tools/qfbsp/source/brush.c | 27 +++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 61b51b223..492ec56e2 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -58,6 +58,12 @@ extern plane_t planes[MAX_MAP_PLANES]; */ brush_t *AllocBrush (void); +/** Load the brushes from the entity. + + \param ent The entity from which to load the brushes. + \param hullnum The number of the hull for which to load the brushes. + \return The brush set holding the brushes loaded from the entity. +*/ brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); /** Determine the primary axis of the normal. diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index ac0555ca8..24c5d07f0 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -61,10 +61,11 @@ AllocBrush (void) return b; } -/* - CheckFace +/** Check the face for validity. - Note: this will not catch 0 area polygons + \param f The face to check. + + \note Does not catch 0 area polygons. */ static void CheckFace (const face_t *f) @@ -123,18 +124,28 @@ CheckFace (const face_t *f) } } +/** Initialize the bounding box of the brush set. + + \param bs The brush set of which to initialize the bounding box. +*/ static void ClearBounds (brushset_t *bs) { int i, j; - for (j = 0; j < NUM_HULLS; j++) + for (j = 0; j < NUM_HULLS; j++) { for (i = 0; i < 3; i++) { bs->mins[i] = BOGUS_RANGE; bs->maxs[i] = -BOGUS_RANGE; } + } } +/** Grow the bounding box of the brush set to include the vector. + + \param bs The brush set of which to grown the bounding box. + \param v The vector to be included in the bounding box. +*/ static void AddToBounds (brushset_t *bs, const vec3_t v) { @@ -289,6 +300,11 @@ FindPlane (const plane_t *dplane, int *side) vec3_t brush_mins, brush_maxs; face_t *brush_faces; +/** Find the entity with the matching target name. + + \param targetname The target name for which to search. + \return The matching entity or NULL if not found. +*/ static entity_t * FindTargetEntity (const char *targetname) { @@ -302,6 +318,9 @@ FindTargetEntity (const char *targetname) } #define ZERO_EPSILON 0.001 + +/** Create the faces of the active brush. +*/ static void CreateBrushFaces (void) {