History

packet version handling in VoxelSystem parseData

Stephen Birarda committed 13 years ago

Commit c64a9611 parent 729074b1 file · +9 −10Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all

Unified · Split

interface/src/VoxelSystem.cpp+9−10
@@ -112,32 +112,31 @@ float VoxelSystem::getVoxelsBytesReadPerSecondAverage() { · 111 unmodified lines
112int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {112int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
113 113
114 unsigned char command = *sourceBuffer;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 pthread_mutex_lock(&_treeLock);118 pthread_mutex_lock(&_treeLock);
118 119
119 switch(command) {120 switch(command) {
120 case PACKET_TYPE_VOXEL_DATA:121 case PACKET_TYPE_VOXEL_DATA: {
121 {
122 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");122 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
123 // ask the VoxelTree to read the bitstream into the tree123 // 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;126 break;
127 case PACKET_TYPE_VOXEL_DATA_MONOCHROME:127 case PACKET_TYPE_VOXEL_DATA_MONOCHROME: {
128 {
129 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");128 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
130 // ask the VoxelTree to read the MONOCHROME bitstream into the tree129 // 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 case PACKET_TYPE_Z_COMMAND:133 case PACKET_TYPE_Z_COMMAND:
135 134
136 // the Z command is a special command that allows the sender to send high level semantic135 // the Z command is a special command that allows the sender to send high level semantic
137 // requests, like erase all, or add sphere scene, different receivers may handle these136 // requests, like erase all, or add sphere scene, different receivers may handle these
138 // messages differently137 // messages differently
139 char* packetData = (char *)sourceBuffer;138 char* packetData = (char *)sourceBuffer;
140 char* command = &packetData[1]; // start of the command139 char* command = &packetData[numBytesPacketHeader]; // start of the command
141 int commandLength = strlen(command); // commands are null terminated strings140 int commandLength = strlen(command); // commands are null terminated strings
142 int totalLength = 1+commandLength+1;141 int totalLength = 1+commandLength+1;
143 142

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t