Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
148 lines
2.9 KiB
C++
148 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include "bndgbox.h"
|
|
#include "memblock.h"
|
|
|
|
//##########################################################################
|
|
//####################### BoundingBoxListNode ########################
|
|
//##########################################################################
|
|
|
|
class BoundingBoxList;
|
|
class BoxedSolidList;
|
|
class BoundingBoxTree;
|
|
|
|
class BoundingBoxListNode SIGNATURED
|
|
{
|
|
friend class BoundingBoxList;
|
|
friend class BoxedSolidList;
|
|
|
|
//##########################################################################
|
|
// Memory Allocation
|
|
//
|
|
private:
|
|
static MemoryBlock* GetAllocatedMemory();
|
|
|
|
void* operator new(size_t) { return GetAllocatedMemory()->New(); }
|
|
void operator delete(void *where) { GetAllocatedMemory()->Delete(where); }
|
|
|
|
//##########################################################################
|
|
// Construction and Destruction
|
|
//
|
|
protected:
|
|
BoundingBox
|
|
*boundingBox;
|
|
BoundingBoxListNode
|
|
*previousNode;
|
|
|
|
BoundingBoxListNode(
|
|
BoundingBox *volume,
|
|
const ExtentBox &slice
|
|
):
|
|
boundingBox(volume),
|
|
solidSlice(slice),
|
|
previousNode(NULL)
|
|
{Check_Pointer(this); Check(volume);}
|
|
~BoundingBoxListNode()
|
|
{Check(this);}
|
|
|
|
public:
|
|
ExtentBox
|
|
solidSlice;
|
|
BoundingBox*
|
|
GetBoundingBox()
|
|
{Check(this); return boundingBox;}
|
|
BoundingBoxListNode*
|
|
GetNextNode()
|
|
{Check(this); return previousNode;}
|
|
|
|
//##########################################################################
|
|
// Test Support
|
|
//
|
|
public:
|
|
Logical
|
|
TestInstance() const;
|
|
};
|
|
|
|
//##########################################################################
|
|
//######################## BoundingBoxList ###########################
|
|
//##########################################################################
|
|
|
|
class BoundingBoxList SIGNATURED
|
|
{
|
|
|
|
//##########################################################################
|
|
// Construction and Destruction
|
|
//
|
|
protected:
|
|
BoundingBoxListNode
|
|
*root;
|
|
int
|
|
nodeCount;
|
|
int*
|
|
scoreBoard;
|
|
BoundingBox
|
|
**boundingBoxIndex;
|
|
Logical
|
|
isXMajorAxis;
|
|
|
|
public:
|
|
BoundingBoxList();
|
|
~BoundingBoxList();
|
|
|
|
void
|
|
Add(
|
|
BoundingBox* volume,
|
|
const ExtentBox &slice
|
|
);
|
|
void
|
|
Remove(BoundingBox* volume);
|
|
void
|
|
EraseList();
|
|
|
|
BoundingBoxListNode*
|
|
GetRoot()
|
|
{Check(this); return root;}
|
|
|
|
//##########################################################################
|
|
// Tree Traversal Functions
|
|
//
|
|
public:
|
|
BoundingBox*
|
|
FindBoundingBoxContaining(const Point3D &point);
|
|
|
|
void
|
|
FindBoundingBoxesContaining(
|
|
BoundingBox *volume,
|
|
BoundingBoxCollisionList &list
|
|
);
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxUnder(
|
|
const Point3D &point,
|
|
Scalar *height
|
|
);
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxHitBy(Line *line);
|
|
|
|
void
|
|
Reduce();
|
|
void
|
|
SortForTree();
|
|
|
|
protected:
|
|
void
|
|
Sort(
|
|
BoundingBoxList &active_solids,
|
|
ExtentBox &clipping_box,
|
|
BoundingBoxTree &tree_so_far
|
|
);
|
|
|
|
//##########################################################################
|
|
// Test Support
|
|
//
|
|
public:
|
|
Logical
|
|
TestInstance() const;
|
|
};
|