const Mesh& Octree::getMesh() const { if (mesh_.empty()) { std::vector<Box> cubes; getCubes(cubes); for(std::vector<Box>::iterator it = cubes.begin(); it != cubes.end(); ++it) { Box& b = *it; mesh_.add(b.getMesh()); } mesh_.filterOverlappingVertices(); } return mesh_; }
bool isLeggal(glm::vec3 in) { auto cubes = getCubes(); for (auto it = cubes.begin(); it != cubes.end();++it) { GLfloat WALL_OFFSET = 0.0001f; if ((*it).type == Maze::WALL) { glm::vec3 vec = (*it).pos; if (abs(in.x - vec.x)< 0.75f+WALL_OFFSET && abs(in.z - vec.z) < 0.75f+WALL_OFFSET ) return false; } } return true; }