Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2105,7 +2105,7 @@ void VoxelSystem::hideOutOfView(bool forceFullFrustum) { · 2104 unmodified lines | ||
| 2105 | 2105 | bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraData) { |
| 2106 | 2106 | VoxelTreeElement* voxel = (VoxelTreeElement*)element; |
| 2107 | 2107 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 2108 | − | |
| 2108 | + | |
| 2109 | 2109 | // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine |
| 2110 | 2110 | // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not |
| 2111 | 2111 | // consider that case. |
| @@ -2141,7 +2141,7 @@ bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraDat · 29 unmodified lines | ||
| 2141 | 2141 | bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraData) { |
| 2142 | 2142 | VoxelTreeElement* voxel = (VoxelTreeElement*)element; |
| 2143 | 2143 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 2144 | − | |
| 2144 | + | |
| 2145 | 2145 | // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine |
| 2146 | 2146 | // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not |
| 2147 | 2147 | // consider that case. |
| @@ -2184,7 +2184,7 @@ bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraDat · 36 unmodified lines | ||
| 2184 | 2184 | bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData) { |
| 2185 | 2185 | VoxelTreeElement* voxel = (VoxelTreeElement*)element; |
| 2186 | 2186 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 2187 | − | |
| 2187 | + | |
| 2188 | 2188 | // If we're still recursing the tree using this operator, then we don't know if we're inside or outside... |
| 2189 | 2189 | // so before we move forward we need to determine our frustum location |
| 2190 | 2190 | ViewFrustum::location inFrustum = voxel->inFrustum(args->thisViewFrustum); |
| @@ -2201,7 +2201,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 10 unmodified lines | ||
| 2201 | 2201 | // ok, now do some processing for this node... |
| 2202 | 2202 | switch (inFrustum) { |
| 2203 | 2203 | case ViewFrustum::OUTSIDE: { |
| 2204 | − | |
| 2205 | 2204 | // If this node is outside the current view, then we might want to hide it... unless it was previously OUTSIDE, |
| 2206 | 2205 | // if it was previously outside, then we can safely assume it's already hidden, and we can also safely assume |
| 2207 | 2206 | // that all of it's children are outside both of our views, in which case we can just stop recursing... |
| @@ -2215,12 +2214,10 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines | ||
| 2215 | 2214 | // we need to hide it. Additionally we know that ALL of it's children are also fully OUTSIDE so we can recurse |
| 2216 | 2215 | // the children and simply mark them as hidden |
| 2217 | 2216 | args->tree->recurseNodeWithOperation(voxel, hideAllSubTreeOperation, args ); |
| 2218 | − | |
| 2219 | 2217 | return false; |
| 2220 | 2218 | |
| 2221 | 2219 | } break; |
| 2222 | 2220 | case ViewFrustum::INSIDE: { |
| 2223 | − | |
| 2224 | 2221 | // If this node is INSIDE the current view, then we might want to show it... unless it was previously INSIDE, |
| 2225 | 2222 | // if it was previously INSIDE, then we can safely assume it's already shown, and we can also safely assume |
| 2226 | 2223 | // that all of it's children are INSIDE both of our views, in which case we can just stop recursing... |
| @@ -2234,12 +2231,10 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines | ||
| 2234 | 2231 | // we need to show it. Additionally we know that ALL of it's children are also fully INSIDE so we can recurse |
| 2235 | 2232 | // the children and simply mark them as visible (as appropriate based on LOD) |
| 2236 | 2233 | args->tree->recurseNodeWithOperation(voxel, showAllSubTreeOperation, args); |
| 2237 | − | |
| 2238 | 2234 | return false; |
| 2239 | 2235 | } break; |
| 2240 | 2236 | case ViewFrustum::INTERSECT: { |
| 2241 | 2237 | args->nodesScanned++; |
| 2242 | − | |
| 2243 | 2238 | // If this node INTERSECTS the current view, then we might want to show it... unless it was previously INSIDE |
| 2244 | 2239 | // the last known view, in which case it will already be visible, and we know that all it's children are also |
| 2245 | 2240 | // previously INSIDE and visible. So in this case stop recursing |
| @@ -2253,8 +2248,15 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 7 unmodified lines | ||
| 2253 | 2248 | // if the child node INTERSECTs the view, then we want to check to see if it thinks it should render |
| 2254 | 2249 | // if it should render but is missing it's VBO index, then we want to flip it on, and we can stop recursing from |
| 2255 | 2250 | // here because we know will block any children anyway |
| 2251 | + | |
| 2252 | + float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale(); | |
| 2253 | + int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust(); | |
| 2254 | + bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 2255 | + voxel->setShouldRender(shouldRender); | |
| 2256 | + | |
| 2256 | 2257 | if (voxel->getShouldRender() && !voxel->isKnownBufferIndex()) { |
| 2257 | 2258 | voxel->setDirtyBit(); // will this make it draw? |
| 2259 | + voxel->markWithChangedTime(); // both are needed to force redraw | |
| 2258 | 2260 | args->nodesShown++; |
| 2259 | 2261 | return false; |
| 2260 | 2262 | } |
| @@ -2267,7 +2269,6 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData · 6 unmodified lines | ||
| 2267 | 2269 | } break; |
| 2268 | 2270 | } // switch |
| 2269 | 2271 | |
| 2270 | − | |
| 2271 | 2272 | return true; // keep going! |
| 2272 | 2273 | } |
| 2273 | 2274 | |