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