Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -113,6 +113,7 @@ float VoxelSystem::getVoxelsBytesReadPerSecondAverage() { · 112 unmodified lines | |||
| 113 | return tree->voxelsBytesReadStats.getAverageSampleValuePerSecond(); | 113 | return tree->voxelsBytesReadStats.getAverageSampleValuePerSecond(); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | bool pickAorB = false; | ||
| 116 | 117 | ||
| 117 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { | 118 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { |
| 118 | 119 | ||
| @@ -121,8 +122,80 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 2 unmodified lines | |||
| 121 | 122 | ||
| 122 | switch(command) { | 123 | switch(command) { |
| 123 | case PACKET_HEADER_VOXEL_DATA: | 124 | case PACKET_HEADER_VOXEL_DATA: |
| 125 | { | ||
| 126 | /***************** TEMPORARY CODE ********************************************************************************* | ||
| 127 | // YES! Stephen - I have intentionally placed this horrible UGLY LINE across your screen! I did it so you and I | ||
| 128 | // would make a point of removing this code when all this work is done. But in the mean time, I need it here for | ||
| 129 | // debugging purposes... When you do the code review... DO NOT tell me to remove it. :) Thank you! | ||
| 130 | // | ||
| 131 | unsigned char fakeBuffer[18] = { | ||
| 132 | 86, // V | ||
| 133 | 2,0, // octcode for root | ||
| 134 | 136, // child color bits | ||
| 135 | 0,0,255, // child 128 color | ||
| 136 | 0,255,0, // child 8 color | ||
| 137 | 0, // child tree bits - none | ||
| 138 | |||
| 139 | // now some extra bits, what happens??? | ||
| 140 | 2,252, // octcode for root | ||
| 141 | 1, // child color bits | ||
| 142 | 255,0,0, // child 1 color | ||
| 143 | 0 // child tree bits | ||
| 144 | }; | ||
| 145 | |||
| 146 | //printf("loading fake data! fakeBuffer \n"); | ||
| 147 | tree->readBitstreamToTree((unsigned char*)&fakeBuffer[1], sizeof(fakeBuffer)-1); | ||
| 148 | |||
| 149 | unsigned char fakeBuffer[11] = { | ||
| 150 | 86, // V | ||
| 151 | 2,0, // octcode for root | ||
| 152 | 136, // child color bits | ||
| 153 | 0,0,255, // child 128 color | ||
| 154 | 0,255,0, // child 8 color | ||
| 155 | 0 // child tree bits - none | ||
| 156 | }; | ||
| 157 | |||
| 158 | printf("loading fake data! fakeBuffer \n"); | ||
| 159 | tree->readBitstreamToTree((unsigned char*)&fakeBuffer[1], sizeof(fakeBuffer)-1); | ||
| 160 | |||
| 161 | unsigned char fakeBufferA[11] = { | ||
| 162 | 86, // V | ||
| 163 | 0, // octcode for root | ||
| 164 | 0, // child color bits? | ||
| 165 | 128, // child exists bits | ||
| 166 | 0, // child color bits | ||
| 167 | 128, // child exists | ||
| 168 | 128, // child color bits | ||
| 169 | 0,0,255, // child color | ||
| 170 | 0 // child exists bits | ||
| 171 | }; | ||
| 172 | |||
| 173 | unsigned char fakeBufferB[11] = { | ||
| 174 | 86, // V | ||
| 175 | 0, // octcode for root | ||
| 176 | 0, // child color bits? | ||
| 177 | 128, // child exists bits | ||
| 178 | 0, // child color bits | ||
| 179 | 128, // child exists | ||
| 180 | 16, // child color bits | ||
| 181 | 0,255,0, // child color?? | ||
| 182 | 0 // child exists bits | ||
| 183 | }; | ||
| 184 | |||
| 185 | // trim off the "V" | ||
| 186 | printf("loading fake data! pickAorB=%s\n", (pickAorB ? "A" : "B") ); | ||
| 187 | if (pickAorB) { | ||
| 188 | tree->readBitstreamToTree((unsigned char*)&fakeBufferA[1], sizeof(fakeBufferA)-1); | ||
| 189 | } else { | ||
| 190 | tree->readBitstreamToTree((unsigned char*)&fakeBufferB[1], sizeof(fakeBufferB)-1); | ||
| 191 | } | ||
| 192 | pickAorB = !pickAorB; | ||
| 193 | |||
| 194 | ***** END OF TEMPORARY CODE ***************************************************************************************/ | ||
| 195 | |||
| 124 | // ask the VoxelTree to read the bitstream into the tree | 196 | // ask the VoxelTree to read the bitstream into the tree |
| 125 | tree->readBitstreamToTree(voxelData, numBytes - 1); | 197 | tree->readBitstreamToTree(voxelData, numBytes - 1); |
| 198 | } | ||
| 126 | break; | 199 | break; |
| 127 | case PACKET_HEADER_ERASE_VOXEL: | 200 | case PACKET_HEADER_ERASE_VOXEL: |
| 128 | // ask the tree to read the "remove" bitstream | 201 | // ask the tree to read the "remove" bitstream |
| @@ -618,4 +691,19 @@ void VoxelSystem::falseColorizeDistanceFromView(ViewFrustum* viewFrustum) { · 489 unmodified lines | |||
| 618 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); | 691 | tree->recurseTreeWithOperation(falseColorizeDistanceFromViewOperation,(void*)viewFrustum); |
| 619 | printf("setting in distance false color for %d nodes\n",_nodeCount); | 692 | printf("setting in distance false color for %d nodes\n",_nodeCount); |
| 620 | setupNewVoxelsForDrawing(); | 693 | setupNewVoxelsForDrawing(); |
| 694 | |||
| 695 | |||
| 696 | printf("--------- DEBUG TESTING ------------\n"); | ||
| 697 | unsigned char* lastOctalCode = tree->rootNode->octalCode; | ||
| 698 | unsigned char* fullOutputBuffer = new unsigned char[MAX_VOXEL_PACKET_SIZE]; | ||
| 699 | unsigned char* outputBuffer = fullOutputBuffer; | ||
| 700 | bool startedWriting = false; | ||
| 701 | int bytesWritten = 0; | ||
| 702 | |||
| 703 | bytesWritten = tree->bhgLoadBitstream(tree->rootNode, *viewFrustum, lastOctalCode, startedWriting, | ||
| 704 | outputBuffer,MAX_VOXEL_PACKET_SIZE); | ||
| 705 | |||
| 706 | printf("--------- results ------------\n"); | ||
| 707 | outputBufferBits(fullOutputBuffer, bytesWritten, true); | ||
| 708 | printf("--------- DONE DEBUG TESTING ------------\n"); | ||
| 621 | } | 709 | } |