Skip to content

Commit

Permalink
BSP Builder|Refactor: Renamed objects for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 14, 2012
1 parent 50791dd commit 00a74fc
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 148 deletions.
48 changes: 24 additions & 24 deletions doomsday/engine/portable/include/bsp_intersection.h
Expand Up @@ -30,10 +30,10 @@

#include "bsp_edge.h"

struct bspartitioninfo_s;
struct hplanepartition_s;
struct superblock_s;

typedef struct bspartitioninfo_s {
typedef struct hplanepartition_s {
double x, y;
double dX, dY;
double length;
Expand All @@ -43,60 +43,60 @@ typedef struct bspartitioninfo_s {
double pSX, pSY;
double pDX, pDY;
double pPara, pPerp;
} BsPartitionInfo;
} HPlanePartition;

typedef struct bspintersection_s BspIntersection;
typedef struct hplaneintercept_s HPlaneIntercept;

BspIntersection* BspIntersection_Next(BspIntersection* intersection);
HPlaneIntercept* HPlaneIntercept_Next(HPlaneIntercept* intersection);

BspIntersection* BspIntersection_Prev(BspIntersection* intersection);
HPlaneIntercept* HPlaneIntercept_Prev(HPlaneIntercept* intersection);

void* BspIntersection_UserData(BspIntersection* intersection);
void* HPlaneIntercept_UserData(HPlaneIntercept* intersection);

/**
* BspIntersections instance. Created with BspIntersections_New().
* HPlane instance. Created with HPlane_New().
*/
typedef struct bspintersections_s BspIntersections;
typedef struct hplane_s HPlane;

/**
* Create a new BspIntersections.
* Create a new HPlane.
*/
BspIntersections* BspIntersections_New(void);
HPlane* HPlane_New(void);

BsPartitionInfo* BspIntersections_Info(BspIntersections* bspIntersections);
HPlanePartition* HPlane_Partition(HPlane* hPlane);

/**
* Destroy a BspIntersections.
* Destroy a HPlane.
*/
void BspIntersections_Delete(BspIntersections* bspIntersections);
void HPlane_Delete(HPlane* hPlane);

/**
* Empty all intersections from the specified BspIntersections.
* Empty all intersections from the specified HPlane.
*/
void BspIntersections_Clear(BspIntersections* bspIntersections);
void HPlane_Clear(HPlane* hPlane);

/**
* Insert a point at the given intersection into the intersection list.
*/
BspIntersection* BspIntersections_Insert2(BspIntersections* bspIntersections, double distance, void* userData);
BspIntersection* BspIntersections_Insert(BspIntersections* bspIntersections, double distance/*, userData=NULL*/);
HPlaneIntercept* HPlane_NewIntercept2(HPlane* hPlane, double distance, void* userData);
HPlaneIntercept* HPlane_NewIntercept(HPlane* hPlane, double distance/*, userData=NULL*/);

int BspIntersections_Iterate2(BspIntersections* bi, int (*callback)(BspIntersection*, void*), void* parameters);
int BspIntersections_Iterate(BspIntersections* bi, int (*callback)(BspIntersection*, void*)/*, parameters=NULL*/);
int HPlane_IterateIntercepts2(HPlane* bi, int (*callback)(HPlaneIntercept*, void*), void* parameters);
int HPlane_IterateIntercepts(HPlane* bi, int (*callback)(HPlaneIntercept*, void*)/*, parameters=NULL*/);

#if _DEBUG
void BspIntersection_Print(BspIntersections* bspIntersections);
void HPlaneIntercept_Print(HPlane* hPlane);
#endif

void BSP_InitIntersectionAllocator(void);
void BSP_InitHPlaneInterceptAllocator(void);
void BSP_ShutdownIntersectionAllocator(void);

/**
* @todo the following functions do not belong in this module.
*/

void Bsp_MergeIntersections(BspIntersections* intersections);
void Bsp_BuildHEdgesAtIntersectionGaps(BspIntersections* bspIntersections,
void Bsp_MergeIntersections(HPlane* intersections);
void Bsp_BuildHEdgesAtIntersectionGaps(HPlane* hPlane,
struct superblock_s* rightList, struct superblock_s* leftList);

#endif /// LIBDENG_MAP_BSP_INTERSECTION
14 changes: 7 additions & 7 deletions doomsday/engine/portable/include/bsp_main.h
Expand Up @@ -59,9 +59,9 @@
// Degrees, 0 is E, 90 is N
typedef double angle_g;

struct bspintersections_s;
struct hplane_s;
struct superblock_s;
struct bspartitioninfo_s;
struct hplanepartition_s;
struct bsp_hedge_s;

/**
Expand All @@ -84,7 +84,7 @@ typedef struct hedgeintercept_s {
/**
* Create a new intersection.
*/
HEdgeIntercept* Bsp_NewHEdgeIntercept(Vertex* vertex, const struct bspartitioninfo_s* partition,
HEdgeIntercept* Bsp_NewHEdgeIntercept(Vertex* vertex, const struct hplanepartition_s* partition,
boolean lineDefIsSelfReferencing);

/**
Expand All @@ -106,18 +106,18 @@ void Bsp_PrintHEdgeIntercept(HEdgeIntercept* intercept);
*
* @return Ptr to the found intersection, else @c NULL;
*/
HEdgeIntercept* Bsp_HEdgeInterceptByVertex(struct bspintersections_s* bspIntersections, Vertex* v);
HEdgeIntercept* Bsp_HEdgeInterceptByVertex(struct hplane_s* hPlane, Vertex* v);

/**
* Analyze the intersection list, and add any needed minihedges to the given half-edge lists
* (one minihedge on each side).
*
* @note All the intersections in the bspIntersections will be free'd back into the quick-alloc list.
* @note All the intersections in the hPlane will be free'd back into the quick-alloc list.
*/
void BSP_AddMiniHEdges(struct bspintersections_s* bspIntersections,
void BSP_AddMiniHEdges(struct hplane_s* hPlane,
struct superblock_s* rightList, struct superblock_s* leftList);

void Bsp_BuildHEdgesBetweenIntersections(struct bspintersections_s* bspIntersections,
void Bsp_BuildHEdgesBetweenIntersections(struct hplane_s* hPlane,
HEdgeIntercept* start, HEdgeIntercept* end, struct bsp_hedge_s** right, struct bsp_hedge_s** left);

// CVar for tuning the BSP edge split cost factor.
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/portable/include/bsp_node.h
Expand Up @@ -55,7 +55,7 @@ typedef struct bspnodedata_s {
* reworked, heavily). I think it is important that both these routines follow
* the exact same logic.
*/
void BSP_DivideOneHEdge(bsp_hedge_t* hEdge, BspIntersections* bspIntersections,
void BSP_DivideOneHEdge(bsp_hedge_t* hEdge, HPlane* hPlane,
SuperBlock* rightList, SuperBlock* leftList);

/**
Expand All @@ -67,15 +67,15 @@ void BSP_DivideOneHEdge(bsp_hedge_t* hEdge, BspIntersections* bspIntersections,
*
* @return @c true= A suitable partition was found.
*/
boolean BSP_PickPartition(SuperBlock* hEdgeList, size_t depth, BspIntersections* bspIntersections);
boolean Bsp_ChoosePartition(SuperBlock* hEdgeList, size_t depth, HPlane* hPlane);

/**
* Remove all the half-edges from the list, partitioning them into the left or right
* lists based on the given partition line. Adds any intersections onto the
* intersection list as it goes.
*/
void BSP_PartitionHEdges(SuperBlock* hEdgeList, SuperBlock* rightList, SuperBlock* leftList,
BspIntersections* bspIntersections);
HPlane* hPlane);

/**
* Takes the half-edge list and determines if it is convex, possibly converting it
Expand All @@ -94,11 +94,11 @@ void BSP_PartitionHEdges(SuperBlock* hEdgeList, SuperBlock* rightList, SuperBloc
* @param hEdgeList Ptr to the list of half edges at the current node.
* @param parent Ptr to write back the address of any newly created subtree.
* @param depth Current tree depth.
* @param bspIntersections BspIntersection list for storing any new intersections.
* @param hPlane HPlaneIntercept list for storing any new intersections.
* @return @c true iff successfull.
*/
boolean BuildNodes(struct superblock_s* hEdgeList, binarytree_t** parent, size_t depth,
BspIntersections* bspIntersections);
HPlane* hPlane);

/**
* Traverse the BSP tree and put all the half-edges in each BSP leaf into clockwise
Expand Down

0 comments on commit 00a74fc

Please sign in to comment.