Showing the changes to interface/src/VoxelSystem.cpp (1 of 6 files). Show all
Unified · Split
| @@ -97,6 +97,29 @@ void VoxelSystem::parseData(void *data, int size) { · 96 unmodified lines | ||
| 97 | 97 | // ask the tree to read the "remove" bitstream |
| 98 | 98 | tree->processRemoveVoxelBitstream((unsigned char*)data,size); |
| 99 | 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 | 125 | setupNewVoxelsForDrawing(); |