cleanup code

This commit is contained in:
ZappoMan 2013-05-21 11:42:13 -07:00
parent e29bc9972f
commit 7c9be4b9f5
5 changed files with 18 additions and 18 deletions

View file

@ -182,7 +182,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() {
if (_tree->isDirty()) { if (_tree->isDirty()) {
static char buffer[64] = { 0 }; static char buffer[64] = { 0 };
if (_renderWarningsOn) { if (_renderWarningsOn) {
sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", (_writeRenderFullVBO ? "yes" : "no")); sprintf(buffer, "newTreeToArrays() _writeRenderFullVBO=%s", debug::valueOf(_writeRenderFullVBO));
}; };
PerformanceWarning warn(_renderWarningsOn, buffer); PerformanceWarning warn(_renderWarningsOn, buffer);
_callsToTreesToArrays++; _callsToTreesToArrays++;
@ -610,7 +610,7 @@ void VoxelSystem::updatePartialVBOs() {
void VoxelSystem::updateVBOs() { void VoxelSystem::updateVBOs() {
static char buffer[40] = { 0 }; static char buffer[40] = { 0 };
if (_renderWarningsOn) { if (_renderWarningsOn) {
sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", (_readRenderFullVBO ? "yes" : "no")); sprintf(buffer, "updateVBOs() _readRenderFullVBO=%s", debug::valueOf(_readRenderFullVBO));
}; };
PerformanceWarning warn(_renderWarningsOn, buffer); // would like to include _callsToTreesToArrays PerformanceWarning warn(_renderWarningsOn, buffer); // would like to include _callsToTreesToArrays
if (_voxelsDirty) { if (_voxelsDirty) {
@ -1011,7 +1011,7 @@ bool VoxelSystem::collectStatsForTreesAndVBOsOperation(VoxelNode* node, void* ex
if (args->hasIndexFound[nodeIndex]) { if (args->hasIndexFound[nodeIndex]) {
args->duplicateVBOIndex++; args->duplicateVBOIndex++;
printLog("duplicateVBO found... index=%ld, isDirty=%s, shouldRender=%s \n", nodeIndex, printLog("duplicateVBO found... index=%ld, isDirty=%s, shouldRender=%s \n", nodeIndex,
node->isDirty() ? "yes" : "no" , node->getShouldRender() ? "yes" : "no" ); debug::valueOf(node->isDirty()), debug::valueOf(node->getShouldRender()));
} else { } else {
args->hasIndexFound[nodeIndex] = true; args->hasIndexFound[nodeIndex] = true;
} }
@ -1040,7 +1040,7 @@ void VoxelSystem::collectStatsForTreesAndVBOs() {
args.expectedMax = _voxelsInWriteArrays; args.expectedMax = _voxelsInWriteArrays;
_tree->recurseTreeWithOperation(collectStatsForTreesAndVBOsOperation,&args); _tree->recurseTreeWithOperation(collectStatsForTreesAndVBOsOperation,&args);
printLog("_voxelsDirty=%s _voxelsInWriteArrays=%ld minDirty=%ld maxDirty=%ld \n", (_voxelsDirty ? "yes" : "no"), printLog("_voxelsDirty=%s _voxelsInWriteArrays=%ld minDirty=%ld maxDirty=%ld \n", debug::valueOf(_voxelsDirty),
_voxelsInWriteArrays, minDirty, maxDirty); _voxelsInWriteArrays, minDirty, maxDirty);
printLog("stats: total %ld, leaves %ld, dirty %ld, colored %ld, shouldRender %ld, inVBO %ld\n", printLog("stats: total %ld, leaves %ld, dirty %ld, colored %ld, shouldRender %ld, inVBO %ld\n",

View file

@ -80,8 +80,9 @@ int insertIntoSortedArrays(void* value, float key, int originalIndex,
void** valueArray, float* keyArray, int* originalIndexArray, void** valueArray, float* keyArray, int* originalIndexArray,
int currentCount, int maxCount); int currentCount, int maxCount);
class debugHelpers { // Helper Class for debugging
class debug {
public: public:
static const char* booleanValue(bool checkValue) { return checkValue ? "yes" : "no"; }; static const char* valueOf(bool checkValue) { return checkValue ? "yes" : "no"; };
}; };
#endif /* defined(__hifi__SharedUtil__) */ #endif /* defined(__hifi__SharedUtil__) */

View file

@ -243,7 +243,7 @@ bool ViewFrustum::matches(const ViewFrustum& compareTo) const {
compareTo._eyeOffsetOrientation == _eyeOffsetOrientation; compareTo._eyeOffsetOrientation == _eyeOffsetOrientation;
if (!result && debug) { if (!result && debug) {
printLog("ViewFrustum::matches()... result=%s\n", (result ? "yes" : "no")); printLog("ViewFrustum::matches()... result=%s\n", debug::valueOf(result));
printLog("%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f\n", printLog("%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f\n",
(compareTo._position == _position ? "MATCHES " : "NO MATCH"), (compareTo._position == _position ? "MATCHES " : "NO MATCH"),
compareTo._position.x, compareTo._position.y, compareTo._position.z, compareTo._position.x, compareTo._position.y, compareTo._position.z,

View file

@ -278,8 +278,8 @@ void VoxelNode::printDebugDetails(const char* label) const {
printLog("%s - Voxel at corner=(%f,%f,%f) size=%f\n isLeaf=%s isColored=%s isDirty=%s shouldRender=%s\n children=", label, printLog("%s - Voxel at corner=(%f,%f,%f) size=%f\n isLeaf=%s isColored=%s isDirty=%s shouldRender=%s\n children=", label,
_box.getCorner().x, _box.getCorner().y, _box.getCorner().z, _box.getSize().x, _box.getCorner().x, _box.getCorner().y, _box.getCorner().z, _box.getSize().x,
debugHelpers::booleanValue(isLeaf()), debugHelpers::booleanValue(isColored()), debugHelpers::booleanValue(isDirty()), debug::valueOf(isLeaf()), debug::valueOf(isColored()), debug::valueOf(isDirty()),
debugHelpers::booleanValue(getShouldRender()) ); debug::valueOf(getShouldRender()) );
outputBits(childBits,false); outputBits(childBits,false);
printLog("\n octalCode="); printLog("\n octalCode=");

View file

@ -247,9 +247,8 @@ void deepestLevelVoxelDistributor(AgentList* agentList,
if (::debugVoxelSending) { if (::debugVoxelSending) {
printf("deepestLevelVoxelDistributor() viewFrustumChanged=%s, nodeBag.isEmpty=%s, viewSent=%s\n", printf("deepestLevelVoxelDistributor() viewFrustumChanged=%s, nodeBag.isEmpty=%s, viewSent=%s\n",
viewFrustumChanged ? "yes" : "no", debug::valueOf(viewFrustumChanged), debug::valueOf(agentData->nodeBag.isEmpty()),
agentData->nodeBag.isEmpty() ? "yes" : "no", debug::valueOf(agentData->getViewSent())
agentData->getViewSent() ? "yes" : "no"
); );
} }
@ -416,7 +415,7 @@ void *distributeVoxelsToListeners(void *args) {
if (agentData) { if (agentData) {
bool viewFrustumChanged = agentData->updateCurrentViewFrustum(); bool viewFrustumChanged = agentData->updateCurrentViewFrustum();
if (::debugVoxelSending) { if (::debugVoxelSending) {
printf("agentData->updateCurrentViewFrustum() changed=%s\n", (viewFrustumChanged ? "yes" : "no")); printf("agentData->updateCurrentViewFrustum() changed=%s\n", debug::valueOf(viewFrustumChanged));
} }
if (agentData->getWantResIn()) { if (agentData->getWantResIn()) {
@ -468,22 +467,22 @@ int main(int argc, const char * argv[])
const char* DEBUG_VOXEL_SENDING = "--debugVoxelSending"; const char* DEBUG_VOXEL_SENDING = "--debugVoxelSending";
::debugVoxelSending = cmdOptionExists(argc, argv, DEBUG_VOXEL_SENDING); ::debugVoxelSending = cmdOptionExists(argc, argv, DEBUG_VOXEL_SENDING);
printf("debugVoxelSending=%s\n", (::debugVoxelSending ? "yes" : "no")); printf("debugVoxelSending=%s\n", debug::valueOf(::debugVoxelSending));
const char* WANT_ANIMATION_DEBUG = "--shouldShowAnimationDebug"; const char* WANT_ANIMATION_DEBUG = "--shouldShowAnimationDebug";
::shouldShowAnimationDebug = cmdOptionExists(argc, argv, WANT_ANIMATION_DEBUG); ::shouldShowAnimationDebug = cmdOptionExists(argc, argv, WANT_ANIMATION_DEBUG);
printf("shouldShowAnimationDebug=%s\n", (::shouldShowAnimationDebug ? "yes" : "no")); printf("shouldShowAnimationDebug=%s\n", debug::valueOf(::shouldShowAnimationDebug));
const char* WANT_COLOR_RANDOMIZER = "--wantColorRandomizer"; const char* WANT_COLOR_RANDOMIZER = "--wantColorRandomizer";
::wantColorRandomizer = cmdOptionExists(argc, argv, WANT_COLOR_RANDOMIZER); ::wantColorRandomizer = cmdOptionExists(argc, argv, WANT_COLOR_RANDOMIZER);
printf("wantColorRandomizer=%s\n", (::wantColorRandomizer ? "yes" : "no")); printf("wantColorRandomizer=%s\n", debug::valueOf(::wantColorRandomizer));
// By default we will voxel persist, if you want to disable this, then pass in this parameter // By default we will voxel persist, if you want to disable this, then pass in this parameter
const char* NO_VOXEL_PERSIST = "--NoVoxelPersist"; const char* NO_VOXEL_PERSIST = "--NoVoxelPersist";
if (cmdOptionExists(argc, argv, NO_VOXEL_PERSIST)) { if (cmdOptionExists(argc, argv, NO_VOXEL_PERSIST)) {
::wantVoxelPersist = false; ::wantVoxelPersist = false;
} }
printf("wantVoxelPersist=%s\n", (::wantVoxelPersist ? "yes" : "no")); printf("wantVoxelPersist=%s\n", debug::valueOf(::wantVoxelPersist));
// if we want Voxel Persistance, load the local file now... // if we want Voxel Persistance, load the local file now...
bool persistantFileRead = false; bool persistantFileRead = false;
@ -491,7 +490,7 @@ int main(int argc, const char * argv[])
printf("loading voxels from file...\n"); printf("loading voxels from file...\n");
persistantFileRead = ::randomTree.readFromFileV2(::wantLocalDomain ? LOCAL_VOXELS_PERSIST_FILE : VOXELS_PERSIST_FILE); persistantFileRead = ::randomTree.readFromFileV2(::wantLocalDomain ? LOCAL_VOXELS_PERSIST_FILE : VOXELS_PERSIST_FILE);
::randomTree.clearDirtyBit(); // the tree is clean since we just loaded it ::randomTree.clearDirtyBit(); // the tree is clean since we just loaded it
printf("DONE loading voxels from file... fileRead=%s\n", persistantFileRead ? "yes" : "no" ); printf("DONE loading voxels from file... fileRead=%s\n", debug::valueOf(persistantFileRead));
unsigned long nodeCount = ::randomTree.getVoxelCount(); unsigned long nodeCount = ::randomTree.getVoxelCount();
printf("Nodes after loading scene %ld nodes\n", nodeCount); printf("Nodes after loading scene %ld nodes\n", nodeCount);
} }