History

adding Z command to voxel server and interface, Z command allows sending "erase all" and "add scene" commands

ZappoMan committed 13 years ago

Commit 54155431 parent 12e06136 files · +115 −4Browse files

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

Unified · Split

interface/src/VoxelSystem.cpp+23−0
@@ -97,6 +97,29 @@ void VoxelSystem::parseData(void *data, int size) { · 96 unmodified lines
97 // ask the tree to read the "remove" bitstream97 // ask the tree to read the "remove" bitstream
98 tree->processRemoveVoxelBitstream((unsigned char*)data,size);98 tree->processRemoveVoxelBitstream((unsigned char*)data,size);
99 break;99 break;
100 case 'Z':
101
102 // the Z command is a special command that allows the sender to send high level semantic
103 // requests, like erase all, or add sphere scene, different receivers may handle these
104 // messages differently
105 char* packetData =(char*)data;
106 char* command = &packetData[1]; // start of the command
107 int commandLength = strlen(command); // commands are null terminated strings
108 int totalLength = 1+commandLength+1;
109
110 printf("got Z message len(%d)= %s\n",size,command);
111
112 while (totalLength <= size) {
113 if (0==strcmp(command,(char*)"erase all")) {
114 printf("got Z message == erase all\n");
115 tree->eraseAllVoxels();
116 }
117 if (0==strcmp(command,(char*)"add scene")) {
118 printf("got Z message == add scene - NOT SUPPORTED ON INTERFACE\n");
119 }
120 totalLength += commandLength+1;
121 }
122 break;
100 }123 }
101 124
102 setupNewVoxelsForDrawing();125 setupNewVoxelsForDrawing();