History

removed dead code

ZappoMan committed 12 years ago

Commit 63bebc91 parent 5f6a60e2 files · +0 −105Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 2 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+0−103
@@ -675,8 +675,6 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 674 unmodified lines
675 _abandonedVBOSlots = 0; // reset the count of our abandoned slots, why is this here and not earlier????675 _abandonedVBOSlots = 0; // reset the count of our abandoned slots, why is this here and not earlier????
676 }676 }
677 677
678 // since we called treeToArrays, we can assume that our VBO is in sync, and so partial updates to the VBOs are
679 // ok again, until/unless we call removeOutOfView()
680 _writeRenderFullVBO = false;678 _writeRenderFullVBO = false;
681 } else {679 } else {
682 _voxelsUpdated = 0;680 _voxelsUpdated = 0;
@@ -1836,94 +1834,10 @@ VoxelTreeElement* VoxelSystem::getVoxelEnclosing(const glm::vec3& point) { · 1153 unmodified lines
1836 return voxelAndPoint.voxel;1834 return voxelAndPoint.voxel;
1837}1835}
1838 1836
1839// combines the removeOutOfView args into a single class
1840class removeOutOfViewArgs {
1841public:
1842 VoxelSystem* thisVoxelSystem;
1843 ViewFrustum thisViewFrustum;
1844 OctreeElementBag dontRecurseBag;
1845 unsigned long nodesScanned;
1846 unsigned long nodesRemoved;
1847 unsigned long nodesInside;
1848 unsigned long nodesIntersect;
1849 unsigned long nodesOutside;
1850 VoxelTreeElement* insideRoot;
1851 VoxelTreeElement* outsideRoot;
1852
1853 removeOutOfViewArgs(VoxelSystem* voxelSystem, bool widenViewFrustum = true) :
1854 thisVoxelSystem(voxelSystem),
1855 thisViewFrustum(*voxelSystem->getViewFrustum()),
1856 dontRecurseBag(),
1857 nodesScanned(0),
1858 nodesRemoved(0),
1859 nodesInside(0),
1860 nodesIntersect(0),
1861 nodesOutside(0),
1862 insideRoot(NULL),
1863 outsideRoot(NULL)
1864 {
1865 // Widen the FOV for trimming
1866 if (widenViewFrustum) {
1867 float originalFOV = thisViewFrustum.getFieldOfView();
1868 float wideFOV = originalFOV + VIEW_FRUSTUM_FOV_OVERSEND;
1869 thisViewFrustum.setFieldOfView(wideFOV);
1870 thisViewFrustum.calculate();
1871 }
1872 }
1873};
1874
1875void VoxelSystem::cancelImport() {1837void VoxelSystem::cancelImport() {
1876 _tree->cancelImport();1838 _tree->cancelImport();
1877}1839}
1878 1840
1879// "Remove" voxels from the tree that are not in view. We don't actually delete them,
1880// we remove them from the tree and place them into a holding area for later deletion
1881bool VoxelSystem::removeOutOfViewOperation(OctreeElement* element, void* extraData) {
1882 VoxelTreeElement* voxel = (VoxelTreeElement*) element;
1883 removeOutOfViewArgs* args = (removeOutOfViewArgs*)extraData;
1884
1885 // If our node was previously added to the don't recurse bag, then return false to
1886 // stop the further recursion. This means that the whole node and it's children are
1887 // known to be in view, so don't recurse them
1888 if (args->dontRecurseBag.contains(voxel)) {
1889 args->dontRecurseBag.remove(voxel);
1890 return false; // stop recursion
1891 }
1892
1893 VoxelSystem* thisVoxelSystem = args->thisVoxelSystem;
1894 args->nodesScanned++;
1895 // Need to operate on our child nodes, so we can remove them
1896 for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
1897 VoxelTreeElement* childNode = voxel->getChildAtIndex(i);
1898 if (childNode) {
1899 ViewFrustum::location inFrustum = childNode->inFrustum(args->thisViewFrustum);
1900 switch (inFrustum) {
1901 case ViewFrustum::OUTSIDE: {
1902 args->nodesOutside++;
1903 args->nodesRemoved++;
1904 voxel->removeChildAtIndex(i);
1905 thisVoxelSystem->_removedVoxels.insert(childNode);
1906 // by removing the child, it will not get recursed!
1907 } break;
1908 case ViewFrustum::INSIDE: {
1909 // if the child node is fully INSIDE the view, then there's no need to recurse it
1910 // because we know all it's children will also be in the view, so we want to
1911 // tell the caller to NOT recurse this child
1912 args->nodesInside++;
1913 args->dontRecurseBag.insert(childNode);
1914 } break;
1915 case ViewFrustum::INTERSECT: {
1916 // if the child node INTERSECTs the view, then we don't want to remove it because
1917 // it is at least partially in view. But we DO want to recurse the children because
1918 // some of them may not be in view... nothing specifically to do, just keep iterating
1919 // the children
1920 args->nodesIntersect++;
1921 } break;
1922 }
1923 }
1924 }
1925 return true; // keep going!
1926}
1927 1841
1928bool VoxelSystem::isViewChanging() {1842bool VoxelSystem::isViewChanging() {
1929 bool result = false; // assume the best1843 bool result = false; // assume the best
@@ -1952,23 +1866,6 @@ bool VoxelSystem::hasViewChanged() { · 22 unmodified lines
1952 return result;1866 return result;
1953}1867}
1954 1868
1955void VoxelSystem::removeOutOfView() {
1956 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "removeOutOfView()");
1957 removeOutOfViewArgs args(this);
1958 _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)&args);
1959
1960 if (args.nodesRemoved) {
1961 _tree->setDirtyBit();
1962 }
1963 bool showRemoveDebugDetails = false;
1964 if (showRemoveDebugDetails) {
1965 qDebug("removeOutOfView() scanned=%ld removed=%ld inside=%ld intersect=%ld outside=%ld _removedVoxels.count()=%d",
1966 args.nodesScanned, args.nodesRemoved, args.nodesInside,
1967 args.nodesIntersect, args.nodesOutside, _removedVoxels.count()
1968 );
1969 }
1970}
1971
1972// combines the removeOutOfView args into a single class1869// combines the removeOutOfView args into a single class
1973class hideOutOfViewArgs {1870class hideOutOfViewArgs {
1974public:1871public: