Note how quickly we were able to create new tree behavior. In the case of the Y-variant quad-tree, it meant overriding a single method. That is all the code we need to cover for the YV Quad-tree.
Although CBaseTree provides the leaf structure that all our trees will use, the node structure is dependant on the tree being
quad-tree that examining its code will be trivial for the most part. The only real difference in each version of the method implemented for the oct-tree is that each node has eight children to visit/create instead of four. In the Build function we
14.19.1 COctTreeNode – The Source Code
Each node in our oct-tree will be represented by an object of type COctTreeNode which is declared and implemented in COctTree.h and COctTree.cpp. It contains the same SetVisible member function as its quad-tree counterpart and also stores the same members. It stores a pointer to a CBaseLeaf object that will be used only by terminal nodes and contains two vectors describing the extents of the node’s bounding volume. It also contains the same LastFrustumPlane member which we will discuss in the following lesson as it is used to speed up visibility processing. Finally, you will notice that the only difference (except the name) between this object and the CQuadTreeNode object is that each node stores an array of 8 COctTreeNode pointers instead of an array of 4 CQuadTreeNode pointers.