Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. void octree::create_node(node*& cur_node, node* parent, G3D::AABox const& node_box, boost::uint32_t cur_height)
  2. {
  3.     cur_node = new octree::node(node_box, parent, (cur_height == 0));
  4.     if (cur_height == 0)
  5.         return;
  6.     for (int i = 0; i < 2; ++i)
  7.     {
  8.         for (int j = 0; j < 2; ++j)
  9.         {
  10.             for (int k = 0; k < 2; ++k)
  11.             {
  12.                 G3D::Vector3 lo = node_box.low() + (node_box.high() - node_box.low()) * G3D::Vector3(i, j, k) / 2;
  13.                 G3D::Vector3 hi = node_box.low() + (node_box.high() - node_box.low()) * G3D::Vector3(i + 1, j + 1, k + 1) / 2;
  14.                 create_node(cur_node->child_[i][j][k], cur_node, G3D::AABox(lo, hi), cur_height - 1);
  15.             }
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement