From 1e421d222d3c13cf1ba1ddf822c9d68f124d351d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 18 Jul 2013 10:20:01 -0700 Subject: [PATCH] cleaned up some compiler warnings and constants --- libraries/voxels/src/CoverageMap.cpp | 10 +++++----- libraries/voxels/src/VoxelConstants.h | 5 +++-- libraries/voxels/src/VoxelTree.cpp | 5 ++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/voxels/src/CoverageMap.cpp b/libraries/voxels/src/CoverageMap.cpp index 31bcfb64cb..170e30f28d 100644 --- a/libraries/voxels/src/CoverageMap.cpp +++ b/libraries/voxels/src/CoverageMap.cpp @@ -430,7 +430,7 @@ bool CoverageRegion::mergeItemsInArray(VoxelProjectedPolygon* seed, bool seedInA otherPolygon->merge(*seed); if (seedInArray) { - const int IGNORED = NULL; + int* IGNORED = NULL; // remove this otherOtherPolygon for our polygon array _polygonCount = removeFromSortedArrays((void*)seed, (void**)_polygons, _polygonDistances, IGNORED, @@ -479,7 +479,7 @@ void CoverageRegion::storeInArray(VoxelProjectedPolygon* polygon) { // in the list. We still check to see if the polygon is "in front" of the target polygon before we test occlusion. Since // sometimes things come out of order. const bool SORT_BY_SIZE = false; - const int IGNORED = NULL; + int IGNORED = 0; if (SORT_BY_SIZE) { // This old code assumes that polygons will always be added in z-buffer order, but that doesn't seem to // be a good assumption. So instead, we will need to sort this by distance. Use a binary search to find the @@ -488,12 +488,12 @@ void CoverageRegion::storeInArray(VoxelProjectedPolygon* polygon) { float reverseArea = 4.0f - area; //qDebug("store by size area=%f reverse area=%f\n", area, reverseArea); _polygonCount = insertIntoSortedArrays((void*)polygon, reverseArea, IGNORED, - (void**)_polygons, _polygonSizes, IGNORED, + (void**)_polygons, _polygonSizes, &IGNORED, _polygonCount, _polygonArraySize); } else { - const int IGNORED = NULL; + int IGNORED = 0; _polygonCount = insertIntoSortedArrays((void*)polygon, polygon->getDistance(), IGNORED, - (void**)_polygons, _polygonDistances, IGNORED, + (void**)_polygons, _polygonDistances, &IGNORED, _polygonCount, _polygonArraySize); } diff --git a/libraries/voxels/src/VoxelConstants.h b/libraries/voxels/src/VoxelConstants.h index 452772ff07..55dff0c69a 100644 --- a/libraries/voxels/src/VoxelConstants.h +++ b/libraries/voxels/src/VoxelConstants.h @@ -23,7 +23,8 @@ const glm::vec3 IDENTITY_FRONT = glm::vec3( 0.0f, 0.0f,-1.0f); const bool LOW_RES_MONO = false; // while in "low res mode" do voxels switch to monochrome const uint64_t CHANGE_FUDGE = 1000 * 200; // useconds of fudge in determining if we want to resend changed voxels -const int TREE_SCALE = 128; +const int TREE_SCALE = 128; // This is the number of meters of the 0.0 to 1.0 voxel universe +const float VOXEL_SIZE_SCALE = 50000.0f; // This controls the LOD bigger will make smaller voxels visible at greater distance const int NUMBER_OF_CHILDREN = 8; const int MAX_VOXEL_PACKET_SIZE = 1492; @@ -40,4 +41,4 @@ const glBufferIndex GLBUFFER_INDEX_UNKNOWN = ULONG_MAX; const float SIXTY_FPS_IN_MILLISECONDS = 1000.0f / 60.0f; const float VIEW_CULLING_RATE_IN_MILLISECONDS = 1000.0f; // once a second is fine -#endif +#endif \ No newline at end of file diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 203ed7e908..9cb6a85f93 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -32,12 +32,11 @@ #include "VoxelTree.h" float boundaryDistanceForRenderLevel(unsigned int renderLevel) { - const float voxelSizeScale = 50000.0f; - return voxelSizeScale / powf(2, renderLevel); + return ::VOXEL_SIZE_SCALE / powf(2, renderLevel); } float boundaryDistanceSquaredForRenderLevel(unsigned int renderLevel) { - const float voxelSizeScale = (50000.0f/TREE_SCALE) * (50000.0f/TREE_SCALE); + const float voxelSizeScale = (::VOXEL_SIZE_SCALE/TREE_SCALE) * (::VOXEL_SIZE_SCALE/TREE_SCALE); return voxelSizeScale / powf(2, (2 * renderLevel)); }