Showing the changes to interface/src/main.cpp (1 of 3 files). Show all
Unified · Split
| @@ -130,6 +130,9 @@ glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE); · 129 unmodified lines | ||
| 130 | 130 | |
| 131 | 131 | VoxelSystem voxels; |
| 132 | 132 | |
| 133 | +bool wantToKillLocalVoxels = false; | |
| 134 | + | |
| 135 | + | |
| 133 | 136 | #ifndef _WIN32 |
| 134 | 137 | Audio audio(&audioScope, &myAvatar); |
| 135 | 138 | #endif |
| @@ -1071,6 +1074,13 @@ int setFrustumRenderMode(int state) { · 935 unmodified lines | ||
| 1071 | 1074 | return ::frustumDrawingMode; |
| 1072 | 1075 | } |
| 1073 | 1076 | |
| 1077 | +int doKillLocalVoxels(int state) { | |
| 1078 | + if (state == MENU_ROW_PICKED) { | |
| 1079 | + ::wantToKillLocalVoxels = true; | |
| 1080 | + } | |
| 1081 | + return state; | |
| 1082 | +} | |
| 1083 | + | |
| 1074 | 1084 | int doRandomizeVoxelColors(int state) { |
| 1075 | 1085 | if (state == MENU_ROW_PICKED) { |
| 1076 | 1086 | ::voxels.randomizeVoxelColors(); |
| @@ -1168,6 +1178,7 @@ void initMenu() { · 91 unmodified lines | ||
| 1168 | 1178 | |
| 1169 | 1179 | // Debug |
| 1170 | 1180 | menuColumnDebug = menu.addColumn("Debug"); |
| 1181 | + menuColumnDebug->addRow("Kill Local Voxels", doKillLocalVoxels); | |
| 1171 | 1182 | menuColumnDebug->addRow("Randomize Voxel TRUE Colors", doRandomizeVoxelColors); |
| 1172 | 1183 | menuColumnDebug->addRow("FALSE Color Voxels Randomly", doFalseRandomizeVoxelColors); |
| 1173 | 1184 | menuColumnDebug->addRow("FALSE Color Voxels by Distance", doFalseColorizeByDistance); |
| @@ -1412,6 +1423,12 @@ void* networkReceive(void* args) · 238 unmodified lines | ||
| 1412 | 1423 | ssize_t bytesReceived; |
| 1413 | 1424 | |
| 1414 | 1425 | while (!stopNetworkReceiveThread) { |
| 1426 | + // check to see if the UI thread asked us to kill the voxel tree. since we're the only thread allowed to do that | |
| 1427 | + if (::wantToKillLocalVoxels) { | |
| 1428 | + ::voxels.killLocalVoxels(); | |
| 1429 | + ::wantToKillLocalVoxels = false; | |
| 1430 | + } | |
| 1431 | + | |
| 1415 | 1432 | if (AgentList::getInstance()->getAgentSocket().receive(&senderAddress, incomingPacket, &bytesReceived)) { |
| 1416 | 1433 | packetCount++; |
| 1417 | 1434 | bytesCount += bytesReceived; |