-
Okay, So I can understand this part
Code:
ObjectInfo
{
int ObjectID;
int NumGeometryNodes;
int NumDOFNodes;
// any other nodes we might have
}
But what about the more complex issues, such as, linking the nodes together properly?
I'm thinking we could have an array of integers, and we could use that in some way to just iterate through the children and link em together that way, but this is really getting too nitpicky for my programming style..
Any thoughts anyone?
-
Code:
ObjectInfo
{
int ObjectID;
int NumGeometryNodes;
int NumDOFNodes;
ObjectInfo *m_pNextNode;
ObjectInfo *m_pPrevNode;
// any other nodes we might have
};
Or use the STL list, vector, etc.
For example a quadtree structure:
Code:
struct QuadTreeNode
{
int m_iType; //Node or leaf?
QuadTreeNode *m_pUL; //Upper left child
QuadTreeNode *m_pUR; //Upper right child
QuadTreeNode *m_pLL; //Lower left child
QuadTreeNode *m_pLR; //Lower right child
D3DXVECTOR3 m_vecMin,m_vecMax; //Bounding box
Object *m_pObjectArray; //Objects in this node
int m_iNumObjects; //Number of objects in node
};
Code:
class CTerrain
{
QuadTreeNode *m_pRoot; //Start of quad tree
....
....
};
-
Nice, so the final structure we pass to the add to scene function will just hold a pointer to the root node, which will point to the next node, which will point to the next node, etc etc...
Like a linked list?
Hmm, this is nifty, All I gotta do is create the stuff, and set the pointers, I can do that in the editor!
Question: Where do BSP trees come into play here?
EDIT:
Now I understand *how* the stuff is linked together, But I'm still unsure what to put in the file I create with my editor, to, well, have the program interpret it and know what to do?
The root node holds a vector of children, each child of the root holds its own vector of children. So in theory I'll be able to simply add a base node to my tree and the rest will kinda just, follow.
But lets see, if, in an editor, we set the hierarchy up, so that the truck is the base node, and has 4 children, for the 4 wheels...
How do we hold this information in a file, ready to be converted to hard code in my project? I understand how the stuff is linked together, but how do I interpret a file to create the links and link them in the right way?