Game Development Reference
In-Depth Information
enum BSPChildType
{
NODE,
OBJECTS
};
struct BSPChild
{
BSPChildType type;
union {
BSPNode *node;
BSPObjectSet *objects;
};
};
struct BSPNode
{
Plane plane;
BSPChild front;
BSPChild back;
};
Using polymorphism, inheritance, and C++'s runtime time inference (RTTI), the im-
plementation would look like this:
struct BSPElement
{
};
struct BSPObjectSet : public BSPElement
{
vector<Object*> objects;
};
struct BSPNode : public BSPElement
{
Plane plane;
BSPElement front;
BSPElement back;
};
Search Nedrilad ::




Custom Search