struct polygon
{
vec3_t p1, p2, p3;
vec3_t normal;
vec3_t color;
polygon* next;
};
struct bsp
{
polygon splitter;
bsp* front;
bsp* back;
};
//----------------------------------------------------------------------------
// BSP_Delete -- Delete a bsp struct
//
// Parameters
// currentnode -- The starting node to delete beneath.
//
// Returns
// none
//----------------------------------------------------------------------------
void BSP_Delete(bsp* currentnode)
{
// If there is a node to the front of this process it.
if (currentnode->front != NULL)
{
BSP_Delete(currentnode->front);
}
// Processed everything to the front of this so delete it
delete(currentnode->front);
// If there is a node to the back of this process it.
if (currentnode->back != NULL)
{
BSP_Delete(currentnode->back);
}
// Processed everything to the back of this so delete it
delete(currentnode->back);
}
Deleting a BSP tree
After installing a memory manager in my sample I realized it was time to clean up after my self as far as the bsp struct goes when I saw that I had 24 memory leaks. So I wrote this function to solve all my problems but it didn''t 15 of those memory leaks still exist in the bsp tree. Is there something I''m missing or is there an easier way to delete this struct.
"Don't make me come down there..." -GOD
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement