some debug code

This commit is contained in:
ZappoMan 2013-06-12 21:46:22 -07:00
parent b8e51943ab
commit 3a33d871e8
3 changed files with 25 additions and 6 deletions

View file

@ -33,6 +33,17 @@ CoverageMap::~CoverageMap() {
delete _childMaps[i];
}
}
if (_isRoot) {
printLog("CoverageMap last to be deleted...\n");
printLog("_mapCount=%d\n",_mapCount);
printLog("_maxPolygonsUsed=%d\n",_maxPolygonsUsed);
printLog("_totalPolygons=%d\n",_totalPolygons);
_maxPolygonsUsed = 0;
_totalPolygons = 0;
_mapCount = 0;
}
};
@ -78,16 +89,18 @@ void CoverageMap::growPolygonArray() {
_polygons = newPolygons;
_polygonDistances = newDistances;
_polygonArraySize = _polygonArraySize + DEFAULT_GROW_SIZE;
printLog("CoverageMap::growPolygonArray() _polygonArraySize=%d...\n",_polygonArraySize);
//printLog("CoverageMap::growPolygonArray() _polygonArraySize=%d...\n",_polygonArraySize);
}
int CoverageMap::_maxPolygonsUsed = 0;
int CoverageMap::_totalPolygons = 0;
// just handles storage in the array, doesn't test for occlusion or
// determining if this is the correct map to store in!
void CoverageMap::storeInArray(VoxelProjectedShadow* polygon) {
_totalPolygons++;
//printLog("CoverageMap::storeInArray()...");
//polygon->printDebugDetails();
@ -142,7 +155,7 @@ CoverageMap::StorageResult CoverageMap::storeInMap(VoxelProjectedShadow* polygon
if (_isRoot || _myBoundingBox.contains(polygon->getBoundingBox())) {
/*
/**
if (_isRoot) {
printLog("CoverageMap::storeInMap()... this map _isRoot, so all polygons are contained....\n");
} else {
@ -150,7 +163,7 @@ if (_isRoot) {
_myBoundingBox.printDebugDetails("_myBoundingBox");
polygon->getBoundingBox().printDebugDetails("polygon->getBoundingBox()");
}
*/
**/
// check to make sure this polygon isn't occluded by something at this level
for (int i = 0; i < _polygonCount; i++) {

View file

@ -74,6 +74,7 @@ private:
static const int DEFAULT_GROW_SIZE = 100;
static int _mapCount;
static int _maxPolygonsUsed;
static int _totalPolygons;
};

View file

@ -89,8 +89,11 @@ void VoxelTree::recurseNodeWithOperationDistanceSorted(VoxelNode* node, RecurseV
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
VoxelNode* childNode = node->getChildAtIndex(i);
if (childNode) {
float distance = glm::distance(point, childNode->getCenter());
currentCount = insertIntoSortedArrays((void*)childNode, distance, i,
// chance to optimize, doesn't need to be actual distance!! Could be distance squared
float distanceSquared = childNode->distanceSquareToPoint(point);
//printLog("recurseNodeWithOperationDistanceSorted() CHECKING child[%d] point=%f,%f center=%f,%f distance=%f...\n", i, point.x, point.y, center.x, center.y, distance);
//childNode->printDebugDetails("");
currentCount = insertIntoSortedArrays((void*)childNode, distanceSquared, i,
(void**)&sortedChildren, (float*)&distancesToChildren,
(int*)&indexOfChildren, currentCount, NUMBER_OF_CHILDREN);
}
@ -101,6 +104,8 @@ void VoxelTree::recurseNodeWithOperationDistanceSorted(VoxelNode* node, RecurseV
for (int i = 0; i < currentCount; i++) {
VoxelNode* childNode = sortedChildren[i];
if (childNode) {
//printLog("recurseNodeWithOperationDistanceSorted() PROCESSING child[%d] distance=%f...\n", i, distancesToChildren[i]);
//childNode->printDebugDetails("");
recurseNodeWithOperationDistanceSorted(childNode, operation, point, extraData);
}
}