debugging voxel sending behavior

This commit is contained in:
ZappoMan 2013-05-02 12:26:51 -07:00
parent 174c3ee65b
commit 275772bb3d
3 changed files with 28 additions and 2 deletions

View file

@ -423,10 +423,17 @@ void VoxelSystem::render() {
int VoxelSystem::_nodeCount = 0;
void VoxelSystem::killLocalVoxels() {
_tree->eraseAllVoxels();
_voxelsInArrays = 0; // better way to do this??
//setupNewVoxelsForDrawing();
}
bool VoxelSystem::randomColorOperation(VoxelNode* node, void* extraData) {
_nodeCount++;
if (node->isColored()) {
nodeColor newColor = { randomColorValue(150), randomColorValue(150), randomColorValue(150), 1 };
nodeColor newColor = { 255, randomColorValue(150), randomColorValue(150), 1 };
node->setColor(newColor);
}
return true;
@ -442,7 +449,7 @@ void VoxelSystem::randomizeVoxelColors() {
bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, void* extraData) {
_nodeCount++;
// always false colorize
node->setFalseColor(randomColorValue(150), randomColorValue(150), randomColorValue(150));
node->setFalseColor(255, randomColorValue(150), randomColorValue(150));
return true; // keep going!
}

View file

@ -58,6 +58,8 @@ public:
void falseColorizeInView(ViewFrustum* viewFrustum);
void falseColorizeDistanceFromView(ViewFrustum* viewFrustum);
void killLocalVoxels();
private:
// Operation functions for tree recursion methods
static int _nodeCount;

View file

@ -130,6 +130,9 @@ glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE);
VoxelSystem voxels;
bool wantToKillLocalVoxels = false;
#ifndef _WIN32
Audio audio(&audioScope, &myAvatar);
#endif
@ -1071,6 +1074,13 @@ int setFrustumRenderMode(int state) {
return ::frustumDrawingMode;
}
int doKillLocalVoxels(int state) {
if (state == MENU_ROW_PICKED) {
::wantToKillLocalVoxels = true;
}
return state;
}
int doRandomizeVoxelColors(int state) {
if (state == MENU_ROW_PICKED) {
::voxels.randomizeVoxelColors();
@ -1168,6 +1178,7 @@ void initMenu() {
// Debug
menuColumnDebug = menu.addColumn("Debug");
menuColumnDebug->addRow("Kill Local Voxels", doKillLocalVoxels);
menuColumnDebug->addRow("Randomize Voxel TRUE Colors", doRandomizeVoxelColors);
menuColumnDebug->addRow("FALSE Color Voxels Randomly", doFalseRandomizeVoxelColors);
menuColumnDebug->addRow("FALSE Color Voxels by Distance", doFalseColorizeByDistance);
@ -1412,6 +1423,12 @@ void* networkReceive(void* args)
ssize_t bytesReceived;
while (!stopNetworkReceiveThread) {
// check to see if the UI thread asked us to kill the voxel tree. since we're the only thread allowed to do that
if (::wantToKillLocalVoxels) {
::voxels.killLocalVoxels();
::wantToKillLocalVoxels = false;
}
if (AgentList::getInstance()->getAgentSocket().receive(&senderAddress, incomingPacket, &bytesReceived)) {
packetCount++;
bytesCount += bytesReceived;