Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -112,32 +112,31 @@ float VoxelSystem::getVoxelsBytesReadPerSecondAverage() { · 111 unmodified lines | ||
| 112 | 112 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { |
| 113 | 113 | |
| 114 | 114 | unsigned char command = *sourceBuffer; |
| 115 | − unsigned char *voxelData = sourceBuffer + 1; | |
| 115 | + int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer); | |
| 116 | + unsigned char *voxelData = sourceBuffer + numBytesPacketHeader; | |
| 116 | 117 | |
| 117 | 118 | pthread_mutex_lock(&_treeLock); |
| 118 | 119 | |
| 119 | 120 | switch(command) { |
| 120 | − case PACKET_TYPE_VOXEL_DATA: | |
| 121 | − { | |
| 121 | + case PACKET_TYPE_VOXEL_DATA: { | |
| 122 | 122 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); |
| 123 | 123 | // ask the VoxelTree to read the bitstream into the tree |
| 124 | − _tree->readBitstreamToTree(voxelData, numBytes - 1, WANT_COLOR, WANT_EXISTS_BITS); | |
| 124 | + _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, WANT_COLOR, WANT_EXISTS_BITS); | |
| 125 | 125 | } |
| 126 | − break; | |
| 127 | − case PACKET_TYPE_VOXEL_DATA_MONOCHROME: | |
| 128 | − { | |
| 126 | + break; | |
| 127 | + case PACKET_TYPE_VOXEL_DATA_MONOCHROME: { | |
| 129 | 128 | PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()"); |
| 130 | 129 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree |
| 131 | − _tree->readBitstreamToTree(voxelData, numBytes - 1, NO_COLOR, WANT_EXISTS_BITS); | |
| 130 | + _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, NO_COLOR, WANT_EXISTS_BITS); | |
| 132 | 131 | } |
| 133 | − break; | |
| 132 | + break; | |
| 134 | 133 | case PACKET_TYPE_Z_COMMAND: |
| 135 | 134 | |
| 136 | 135 | // the Z command is a special command that allows the sender to send high level semantic |
| 137 | 136 | // requests, like erase all, or add sphere scene, different receivers may handle these |
| 138 | 137 | // messages differently |
| 139 | 138 | char* packetData = (char *)sourceBuffer; |
| 140 | − char* command = &packetData[1]; // start of the command | |
| 139 | + char* command = &packetData[numBytesPacketHeader]; // start of the command | |
| 141 | 140 | int commandLength = strlen(command); // commands are null terminated strings |
| 142 | 141 | int totalLength = 1+commandLength+1; |
| 143 | 142 | |