Showing the changes to interface/src/VoxelSystem.cpp (1 of 13 files). Show all
Unified · Split
| @@ -17,6 +17,8 @@ · 16 unmodified lines | |||
| 17 | #include <PacketHeaders.h> | 17 | #include <PacketHeaders.h> |
| 18 | #include <OctalCode.h> | 18 | #include <OctalCode.h> |
| 19 | #include <pthread.h> | 19 | #include <pthread.h> |
| 20 | #include "Log.h" | ||
| 21 | |||
| 20 | #include "VoxelSystem.h" | 22 | #include "VoxelSystem.h" |
| 21 | 23 | ||
| 22 | const int MAX_VOXELS_PER_SYSTEM = 250000; | 24 | const int MAX_VOXELS_PER_SYSTEM = 250000; |
| @@ -136,15 +138,15 @@ void VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 113 unmodified lines | |||
| 136 | int commandLength = strlen(command); // commands are null terminated strings | 138 | int commandLength = strlen(command); // commands are null terminated strings |
| 137 | int totalLength = 1+commandLength+1; | 139 | int totalLength = 1+commandLength+1; |
| 138 | 140 | ||
| 139 | printf("got Z message len(%d)= %s\n", numBytes, command); | 141 | printLog("got Z message len(%d)= %s\n", numBytes, command); |
| 140 | 142 | ||
| 141 | while (totalLength <= numBytes) { | 143 | while (totalLength <= numBytes) { |
| 142 | if (0==strcmp(command,(char*)"erase all")) { | 144 | if (0==strcmp(command,(char*)"erase all")) { |
| 143 | printf("got Z message == erase all\n"); | 145 | printLog("got Z message == erase all\n"); |
| 144 | tree->eraseAllVoxels(); | 146 | tree->eraseAllVoxels(); |
| 145 | } | 147 | } |
| 146 | if (0==strcmp(command,(char*)"add scene")) { | 148 | if (0==strcmp(command,(char*)"add scene")) { |
| 147 | printf("got Z message == add scene - NOT SUPPORTED ON INTERFACE\n"); | 149 | printLog("got Z message == add scene - NOT SUPPORTED ON INTERFACE\n"); |
| 148 | } | 150 | } |
| 149 | totalLength += commandLength+1; | 151 | totalLength += commandLength+1; |
| 150 | } | 152 | } |
| @@ -194,14 +196,14 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode, float nodePosition[3]) { · 43 unmodified lines | |||
| 194 | float viewerZ = swapXandZ ? viewerPosition[0] : viewerPosition[2]; | 196 | float viewerZ = swapXandZ ? viewerPosition[0] : viewerPosition[2]; |
| 195 | 197 | ||
| 196 | // debugging code. | 198 | // debugging code. |
| 197 | //printf("treeToArrays() halfUnitForVoxel=%f\n",halfUnitForVoxel); | 199 | //printLog("treeToArrays() halfUnitForVoxel=%f\n",halfUnitForVoxel); |
| 198 | //printf("treeToArrays() viewerPosition {x,y,z or [0],[1],[2]} ={%f,%f,%f}\n", | 200 | //printLog("treeToArrays() viewerPosition {x,y,z or [0],[1],[2]} ={%f,%f,%f}\n", |
| 199 | // viewerPosition[0],viewerPosition[1],viewerPosition[2]); | 201 | // viewerPosition[0],viewerPosition[1],viewerPosition[2]); |
| 200 | //printf("treeToArrays() nodePosition {x,y,z or [0],[1],[2]} = {%f,%f,%f}\n", | 202 | //printLog("treeToArrays() nodePosition {x,y,z or [0],[1],[2]} = {%f,%f,%f}\n", |
| 201 | // nodePosition[0],nodePosition[1],nodePosition[2]); | 203 | // nodePosition[0],nodePosition[1],nodePosition[2]); |
| 202 | //float* vertices = firstVertexForCode(currentNode->octalCode); | 204 | //float* vertices = firstVertexForCode(currentNode->octalCode); |
| 203 | //printf("treeToArrays() firstVerticesForCode(currentNode->octalCode)={x,y,z or [0],[1],[2]} = {%f,%f,%f}\n", | 205 | //printLog("treeToArrays() firstVerticesForCode(currentNode->octalCode)={x,y,z or [0],[1],[2]} = {%f,%f,%f}\n", |
| 204 | // vertices[0],vertices[1],vertices[2]); | 206 | // vertices[0],vertices[1],vertices[2]); |
| 205 | //delete []vertices; | 207 | //delete []vertices; |
| 206 | 208 | ||
| 207 | float distanceToVoxelCenter = sqrtf(powf(viewerX - nodePosition[0] - halfUnitForVoxel, 2) + | 209 | float distanceToVoxelCenter = sqrtf(powf(viewerX - nodePosition[0] - halfUnitForVoxel, 2) + |
| @@ -209,7 +211,7 @@ int VoxelSystem::treeToArrays(VoxelNode *currentNode, float nodePosition[3]) { · 1 unmodified line | |||
| 209 | powf(viewerZ - nodePosition[2] - halfUnitForVoxel, 2)); | 211 | powf(viewerZ - nodePosition[2] - halfUnitForVoxel, 2)); |
| 210 | 212 | ||
| 211 | int boundaryPosition = boundaryDistanceForRenderLevel(*currentNode->octalCode + 1); | 213 | int boundaryPosition = boundaryDistanceForRenderLevel(*currentNode->octalCode + 1); |
| 212 | //printf("treeToArrays() distanceToVoxelCenter=%f boundaryPosition=%d\n",distanceToVoxelCenter,boundaryPosition); | 214 | //printLog("treeToArrays() distanceToVoxelCenter=%f boundaryPosition=%d\n",distanceToVoxelCenter,boundaryPosition); |
| 213 | 215 | ||
| 214 | bool alwaysDraw = false; // XXXBHG - temporary debug code. Flip this to true to disable LOD blurring | 216 | bool alwaysDraw = false; // XXXBHG - temporary debug code. Flip this to true to disable LOD blurring |
| 215 | 217 | ||