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
112112 int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) {
113113
114114 unsigned char command = *sourceBuffer;
115− unsigned char *voxelData = sourceBuffer + 1;
115+ int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer);
116+ unsigned char *voxelData = sourceBuffer + numBytesPacketHeader;
116117
117118 pthread_mutex_lock(&_treeLock);
118119
119120 switch(command) {
120− case PACKET_TYPE_VOXEL_DATA:
121− {
121+ case PACKET_TYPE_VOXEL_DATA: {
122122 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
123123 // 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);
125125 }
126− break;
127− case PACKET_TYPE_VOXEL_DATA_MONOCHROME:
128− {
126+ break;
127+ case PACKET_TYPE_VOXEL_DATA_MONOCHROME: {
129128 PerformanceWarning warn(_renderWarningsOn, "readBitstreamToTree()");
130129 // 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);
132131 }
133− break;
132+ break;
134133 case PACKET_TYPE_Z_COMMAND:
135134
136135 // the Z command is a special command that allows the sender to send high level semantic
137136 // requests, like erase all, or add sphere scene, different receivers may handle these
138137 // messages differently
139138 char* packetData = (char *)sourceBuffer;
140− char* command = &packetData[1]; // start of the command
139+ char* command = &packetData[numBytesPacketHeader]; // start of the command
141140 int commandLength = strlen(command); // commands are null terminated strings
142141 int totalLength = 1+commandLength+1;
143142

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