From 81fd3bbc6a4ce9ea9ea613b559da2f185618fc2c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 17 May 2013 16:15:05 -0700 Subject: [PATCH] CR feedback --- animation-server/src/main.cpp | 4 ++-- voxel-server/src/main.cpp | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/animation-server/src/main.cpp b/animation-server/src/main.cpp index b4c5143ffa..18b4ad787c 100644 --- a/animation-server/src/main.cpp +++ b/animation-server/src/main.cpp @@ -275,7 +275,7 @@ static void sendBillboard() { for (int i = 0; i < BILLBOARD_HEIGHT; i++) { for (int j = 0; j < BILLBOARD_WIDTH; j++) { - int nthVoxel = ((i*BILLBOARD_WIDTH) + j); + int nthVoxel = ((i * BILLBOARD_WIDTH) + j); int item = nthVoxel % VOXELS_PER_PACKET; billboardLights[i][j] = billboardPosition + glm::vec3(j * lightScale, (float)((BILLBOARD_HEIGHT - i) * lightScale), 0); @@ -295,7 +295,7 @@ static void sendBillboard() { details[item].blue = billboardOffColor[2]; } - if (item == VOXELS_PER_PACKET-1) { + if (item == VOXELS_PER_PACKET - 1) { if (createVoxelEditMessage(message, 0, VOXELS_PER_PACKET, (VoxelDetail*)&details, bufferOut, sizeOut)){ ::packetsSent++; ::bytesSent += sizeOut; diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index 58a7cf0061..8dd153576c 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -56,7 +56,7 @@ bool wantLocalDomain = false; bool wantColorRandomizer = false; bool debugVoxelSending = false; -bool wantAnimationDebug = false; +bool shouldShowAnimationDebug = false; @@ -355,7 +355,8 @@ void persistVoxelsWhenDirty() { if (::wantVoxelPersist && ::randomTree.isDirty() && sinceLastTime > VOXEL_PERSIST_INTERVAL) { { - PerformanceWarning warn(::wantAnimationDebug, "persistVoxelsWhenDirty() - reaverageVoxelColors()", ::wantAnimationDebug); + PerformanceWarning warn(::shouldShowAnimationDebug, + "persistVoxelsWhenDirty() - reaverageVoxelColors()", ::shouldShowAnimationDebug); // after done inserting all these voxels, then reaverage colors randomTree.reaverageVoxelColors(randomTree.rootNode); @@ -363,7 +364,8 @@ void persistVoxelsWhenDirty() { { - PerformanceWarning warn(::wantAnimationDebug, "persistVoxelsWhenDirty() - writeToFileV2()", ::wantAnimationDebug); + PerformanceWarning warn(::shouldShowAnimationDebug, + "persistVoxelsWhenDirty() - writeToFileV2()", ::shouldShowAnimationDebug); printf("saving voxels to file...\n"); randomTree.writeToFileV2(::wantLocalDomain ? LOCAL_VOXELS_PERSIST_FILE : VOXELS_PERSIST_FILE); @@ -444,9 +446,9 @@ int main(int argc, const char * argv[]) ::debugVoxelSending = cmdOptionExists(argc, argv, DEBUG_VOXEL_SENDING); printf("debugVoxelSending=%s\n", (::debugVoxelSending ? "yes" : "no")); - const char* WANT_ANIMATION_DEBUG = "--wantAnimationDebug"; - ::wantAnimationDebug = cmdOptionExists(argc, argv, WANT_ANIMATION_DEBUG); - printf("wantAnimationDebug=%s\n", (::wantAnimationDebug ? "yes" : "no")); + const char* WANT_ANIMATION_DEBUG = "--shouldShowAnimationDebug"; + ::shouldShowAnimationDebug = cmdOptionExists(argc, argv, WANT_ANIMATION_DEBUG); + printf("shouldShowAnimationDebug=%s\n", (::shouldShowAnimationDebug ? "yes" : "no")); const char* WANT_COLOR_RANDOMIZER = "--wantColorRandomizer"; ::wantColorRandomizer = cmdOptionExists(argc, argv, WANT_COLOR_RANDOMIZER); @@ -534,13 +536,13 @@ int main(int argc, const char * argv[]) if (packetData[0] == PACKET_HEADER_SET_VOXEL || packetData[0] == PACKET_HEADER_SET_VOXEL_DESTRUCTIVE) { bool destructive = (packetData[0] == PACKET_HEADER_SET_VOXEL_DESTRUCTIVE); - PerformanceWarning warn(::wantAnimationDebug, + PerformanceWarning warn(::shouldShowAnimationDebug, destructive ? "PACKET_HEADER_SET_VOXEL_DESTRUCTIVE" : "PACKET_HEADER_SET_VOXEL", - ::wantAnimationDebug); + ::shouldShowAnimationDebug); unsigned short int itemNumber = (*((unsigned short int*)&packetData[1])); - if (::wantAnimationDebug) { + if (::shouldShowAnimationDebug) { printf("got %s - command from client receivedBytes=%ld itemNumber=%d\n", destructive ? "PACKET_HEADER_SET_VOXEL_DESTRUCTIVE" : "PACKET_HEADER_SET_VOXEL", receivedBytes,itemNumber); @@ -558,7 +560,7 @@ int main(int argc, const char * argv[]) int green = pVoxelData[voxelCodeSize+1]; int blue = pVoxelData[voxelCodeSize+2]; - if (::wantAnimationDebug) { + if (::shouldShowAnimationDebug) { printf("insert voxels - wantColorRandomizer=%s old r=%d,g=%d,b=%d \n", (::wantColorRandomizer?"yes":"no"),red,green,blue); } @@ -567,7 +569,7 @@ int main(int argc, const char * argv[]) green = std::max(0,std::min(255,green + colorRandomizer)); blue = std::max(0,std::min(255,blue + colorRandomizer)); - if (::wantAnimationDebug) { + if (::shouldShowAnimationDebug) { printf("insert voxels - wantColorRandomizer=%s NEW r=%d,g=%d,b=%d \n", (::wantColorRandomizer?"yes":"no"),red,green,blue); } @@ -575,7 +577,7 @@ int main(int argc, const char * argv[]) pVoxelData[voxelCodeSize+1]=green; pVoxelData[voxelCodeSize+2]=blue; - if (::wantAnimationDebug) { + if (::shouldShowAnimationDebug) { float* vertices = firstVertexForCode(pVoxelData); printf("inserting voxel at: %f,%f,%f\n",vertices[0],vertices[1],vertices[2]); delete []vertices;