Showing the changes to interface/src/VoxelSystem.cpp (1 of 5 files). Show all
Unified · Split
| @@ -1774,38 +1774,6 @@ void VoxelSystem::forceRedrawEntireTree() { · 1773 unmodified lines | |||
| 1774 | setupNewVoxelsForDrawing(); | 1774 | setupNewVoxelsForDrawing(); |
| 1775 | } | 1775 | } |
| 1776 | 1776 | ||
| 1777 | class VoxelAndPoint { | ||
| 1778 | public: | ||
| 1779 | VoxelTreeElement* voxel; | ||
| 1780 | glm::vec3 point; | ||
| 1781 | }; | ||
| 1782 | |||
| 1783 | // Find the smallest colored voxel enclosing a point (if there is one) | ||
| 1784 | bool VoxelSystem::getVoxelEnclosingOperation(OctreeElement* element, void* extraData) { | ||
| 1785 | VoxelTreeElement* voxel = (VoxelTreeElement*)element; | ||
| 1786 | VoxelAndPoint* args = (VoxelAndPoint*) extraData; | ||
| 1787 | AABox voxelBox = voxel->getAABox(); | ||
| 1788 | if (voxelBox.contains(args->point)) { | ||
| 1789 | if (voxel->isColored() && voxel->isLeaf()) { | ||
| 1790 | // we've reached a solid leaf containing the point, return the node. | ||
| 1791 | args->voxel = voxel; | ||
| 1792 | return false; | ||
| 1793 | } | ||
| 1794 | } else { | ||
| 1795 | // The point is not inside this voxel, so stop recursing. | ||
| 1796 | return false; | ||
| 1797 | } | ||
| 1798 | return true; // keep looking | ||
| 1799 | } | ||
| 1800 | |||
| 1801 | VoxelTreeElement* VoxelSystem::getVoxelEnclosing(const glm::vec3& point) { | ||
| 1802 | VoxelAndPoint voxelAndPoint; | ||
| 1803 | voxelAndPoint.point = point; | ||
| 1804 | voxelAndPoint.voxel = NULL; | ||
| 1805 | _tree->recurseTreeWithOperation(getVoxelEnclosingOperation, (void*) &voxelAndPoint); | ||
| 1806 | return voxelAndPoint.voxel; | ||
| 1807 | } | ||
| 1808 | |||
| 1809 | bool VoxelSystem::isViewChanging() { | 1777 | bool VoxelSystem::isViewChanging() { |
| 1810 | bool result = false; // assume the best | 1778 | bool result = false; // assume the best |
| 1811 | 1779 | ||