History

some cleanup pre CR

ZappoMan committed 13 years ago

Commit b69c1a31 parent 68d58652 files · +0 −31Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+0−30
@@ -170,7 +170,6 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 169 unmodified lines
170170 } else {
171171 _voxelsUpdated = 0;
172172 }
173− //printLog("setupNewVoxelsForDrawing() AFTER treeToArray _voxelsUpdated=%ld _voxelsDirty=%s\n", _voxelsUpdated, (_voxelsDirty ? "yes" : "no"));
174173 if (_voxelsUpdated) {
175174 _voxelsDirty=true;
176175 }
@@ -200,10 +199,8 @@ void VoxelSystem::copyWrittenDataToReadArrays() { · 23 unmodified lines
200199
201200 int VoxelSystem::newTreeToArrays(VoxelNode* node) {
202201 assert(_viewFrustum); // you must set up _viewFrustum before calling this
203−
204202 int voxelsUpdated = 0;
205203 bool shouldRender = false; // assume we don't need to render it
206−
207204 // if it's colored, we might need to render it!
208205 if (node->isColored()) {
209206 float distanceToNode = node->distanceToCamera(*_viewFrustum);
@@ -211,11 +208,8 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 1 unmodified line
211208 float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1);
212209 bool inBoundary = (distanceToNode <= boundary);
213210 bool inChildBoundary = (distanceToNode <= childBoundary);
214−
215211 shouldRender = (node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary);
216212 }
217−
218−
219213 node->setShouldRender(shouldRender);
220214 // let children figure out their renderness
221215 for (int i = 0; i < 8; i++) {
@@ -223,7 +217,6 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 1 unmodified line
223217 voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i));
224218 }
225219 }
226−
227220 if (_alwaysRenderFullVBO) {
228221 voxelsUpdated += newway__updateNodeInArray(node);
229222 } else {
@@ -438,7 +431,6 @@ void VoxelSystem::updateVBOs() { · 208 unmodified lines
438431 void VoxelSystem::render() {
439432 PerformanceWarning warn(_renderWarningsOn, "render()");
440433 glPushMatrix();
441− //cleanupRemovedVoxels();
442434 updateVBOs();
443435 // tell OpenGL where to find vertex and color information
444436 glEnableClientState(GL_VERTEX_ARRAY);
@@ -635,25 +627,3 @@ void VoxelSystem::removeOutOfView() { · 190 unmodified lines
635627 _tree->recurseTreeWithOperation(removeOutOfViewOperation,(void*)this);
636628 pthread_mutex_unlock(&_voxelCleanupLock);
637629 }
638−
639−// Deletes the VoxelNodes from the _removedVoxels bag, but also cleans up those items from the vertex arrays
640−void VoxelSystem::cleanupRemovedVoxels() {
641− if (!pthread_mutex_trylock(&_voxelCleanupLock)) {
642− while (!_removedVoxels.isEmpty()){
643− VoxelNode* node = _removedVoxels.extract();
644− // If the voxel is in the vertex, and it was previously rendered, then set it's vertices to "hidden"
645− if (node->isKnownBufferIndex() && node->getShouldRender()) {
646− unsigned long nodeIndex = node->getBufferIndex();
647− _voxelDirtyArray[nodeIndex] = true;
648− for (int j = 0; j < VERTEX_POINTS_PER_VOXEL; j++ ) {
649− GLfloat* writeVerticesAt = _writeVerticesArray + (nodeIndex * VERTEX_POINTS_PER_VOXEL);
650− *(writeVerticesAt+j) = FLT_MAX;
651− }
652− _voxelsDirty = true; // yep
653− }
654− _unusedArraySpace++; // track this so we can blow away our arrays if they get too much
655− delete node; // actually delete the node
656− }
657− pthread_mutex_unlock(&_voxelCleanupLock);
658− }
659−}