History

first cut at user adjustable LOD

ZappoMan committed 13 years ago

Commit fbc3a4d1 parent 2931e2e14 files · +133 −72Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+9−5
@@ -139,7 +139,8 @@ void VoxelSystem::voxelUpdated(VoxelNode* node) { · 138 unmodified lines
139 if (node->getVoxelSystem() == this) {139 if (node->getVoxelSystem() == this) {
140 bool shouldRender = false; // assume we don't need to render it140 bool shouldRender = false; // assume we don't need to render it
141 // if it's colored, we might need to render it!141 // if it's colored, we might need to render it!
142 shouldRender = node->calculateShouldRender(_viewFrustum);142 float voxelSizeScale = DEFAULT_VOXEL_SIZE_SCALE;
143 shouldRender = node->calculateShouldRender(_viewFrustum, voxelSizeScale);
143 144
144 if (node->getShouldRender() != shouldRender) {145 if (node->getShouldRender() != shouldRender) {
145 node->setShouldRender(shouldRender);146 node->setShouldRender(shouldRender);
@@ -155,7 +156,7 @@ void VoxelSystem::voxelUpdated(VoxelNode* node) { · 9 unmodified lines
155 VoxelNode* childNode = node->getChildAtIndex(i);156 VoxelNode* childNode = node->getChildAtIndex(i);
156 if (childNode) {157 if (childNode) {
157 bool wasShouldRender = childNode->getShouldRender();158 bool wasShouldRender = childNode->getShouldRender();
158 bool isShouldRender = childNode->calculateShouldRender(_viewFrustum);159 bool isShouldRender = childNode->calculateShouldRender(_viewFrustum, voxelSizeScale);
159 if (wasShouldRender && !isShouldRender) {160 if (wasShouldRender && !isShouldRender) {
160 childrenGotHiddenCount++;161 childrenGotHiddenCount++;
161 }162 }
@@ -923,7 +924,8 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 761 unmodified lines
923 int voxelsUpdated = 0;924 int voxelsUpdated = 0;
924 bool shouldRender = false; // assume we don't need to render it925 bool shouldRender = false; // assume we don't need to render it
925 // if it's colored, we might need to render it!926 // if it's colored, we might need to render it!
926 shouldRender = node->calculateShouldRender(_viewFrustum);927 float voxelSizeScale = DEFAULT_VOXEL_SIZE_SCALE;
928 shouldRender = node->calculateShouldRender(_viewFrustum, voxelSizeScale);
927 929
928 node->setShouldRender(shouldRender);930 node->setShouldRender(shouldRender);
929 // let children figure out their renderness931 // let children figure out their renderness
@@ -1771,7 +1773,8 @@ bool VoxelSystem::showAllLocalVoxelsOperation(VoxelNode* node, void* extraData) · 841 unmodified lines
1771 1773
1772 args->nodesScanned++;1774 args->nodesScanned++;
1773 1775
1774 bool shouldRender = true; // node->calculateShouldRender(&args->thisViewFrustum);1776 float voxelSizeScale = DEFAULT_VOXEL_SIZE_SCALE;
1777 bool shouldRender = node->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale);
1775 node->setShouldRender(shouldRender);1778 node->setShouldRender(shouldRender);
1776 1779
1777 if (shouldRender) {1780 if (shouldRender) {
@@ -1947,7 +1950,8 @@ bool VoxelSystem::showAllSubTreeOperation(VoxelNode* node, void* extraData) { · 169 unmodified lines
1947 1950
1948 args->nodesInside++;1951 args->nodesInside++;
1949 1952
1950 bool shouldRender = node->calculateShouldRender(&args->thisViewFrustum);1953 float voxelSizeScale = DEFAULT_VOXEL_SIZE_SCALE;
1954 bool shouldRender = node->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale);
1951 node->setShouldRender(shouldRender);1955 node->setShouldRender(shouldRender);
1952 1956
1953 if (shouldRender && !node->isKnownBufferIndex()) {1957 if (shouldRender && !node->isKnownBufferIndex()) {