VoxelTreeElement* VoxelTree::createNewElement(unsigned char * octalCode) const { VoxelSystem* voxelSystem = NULL; if (_rootNode) { voxelSystem = ((VoxelTreeElement*)_rootNode)->getVoxelSystem(); } VoxelTreeElement* newElement = new VoxelTreeElement(octalCode); newElement->setVoxelSystem(voxelSystem); return newElement; }
// This will be called primarily on addChildAt(), which means we're adding a child of our // own type to our own tree. This means we should initialize that child with any tree and type // specific settings that our children must have. One example is out VoxelSystem, which // we know must match ours. OctreeElement* VoxelTreeElement::createNewElement(unsigned char* octalCode) { VoxelTreeElement* newChild = new VoxelTreeElement(octalCode); newChild->setVoxelSystem(getVoxelSystem()); // our child is always part of our voxel system NULL ok return newChild; }