1579 lines · 58.7 KB · C++
RawDownload
     VoxelProjectedPolygon::pointInside_calls = 0;    VoxelProjectedPolygon::occludes_calls = 0;    VoxelProjectedPolygon::intersects_calls = 0;        FalseColorizeOccludedArgs args;    args.viewFrustum = Application::getInstance()->getViewFrustum();    args.mapV2 = &myCoverageMapV2;     args.totalVoxels = 0;    args.coloredVoxels = 0;    args.occludedVoxels = 0;    args.notOccludedVoxels = 0;    args.outOfView = 0;    args.subtreeVoxelsSkipped = 0;    args.nonLeaves = 0;    args.nonLeavesOutOfView = 0;    args.nonLeavesOccluded = 0;    args.tree = _tree;        glm::vec3 position = args.viewFrustum->getPosition() * (1.0f/TREE_SCALE);     _tree->recurseTreeWithOperationDistanceSorted(falseColorizeOccludedV2Operation, position, (void*)&args);     qDebug("falseColorizeOccludedV2()\n    position=(%f,%f)\n    total=%ld\n    colored=%ld\n    occluded=%ld\n    notOccluded=%ld\n    outOfView=%ld\n    subtreeVoxelsSkipped=%ld\n    nonLeaves=%ld\n    nonLeavesOutOfView=%ld\n    nonLeavesOccluded=%ld\n    pointInside_calls=%ld\n    occludes_calls=%ld\n    intersects_calls=%ld\n",         position.x, position.y,        args.totalVoxels, args.coloredVoxels, args.occludedVoxels,         args.notOccludedVoxels, args.outOfView, args.subtreeVoxelsSkipped,         args.nonLeaves, args.nonLeavesOutOfView, args.nonLeavesOccluded,        VoxelProjectedPolygon::pointInside_calls,        VoxelProjectedPolygon::occludes_calls,        VoxelProjectedPolygon::intersects_calls    );    //myCoverageMapV2.erase();    _tree->setDirtyBit();    setupNewVoxelsForDrawing();} void VoxelSystem::nodeAdded(Node* node) {    if (node->getType() == NODE_TYPE_VOXEL_SERVER) {        uint16_t nodeID = node->getNodeID();        printf("VoxelSystem... voxel server %u added...\n", nodeID);        _voxelServerCount++;    }} bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) {    uint16_t killedNodeID = *(uint16_t*)extraData;    for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {        VoxelNode* childNode = node->getChildAtIndex(i);        if (childNode) {            uint16_t childNodeID = childNode->getSourceID();            if (childNodeID == killedNodeID) {                node->safeDeepDeleteChildAtIndex(i);            }        }    }    return true;} void VoxelSystem::nodeKilled(Node* node) {    if (node->getType() == NODE_TYPE_VOXEL_SERVER) {        _voxelServerCount--;        uint16_t nodeID = node->getNodeID();        printf("VoxelSystem... voxel server %u removed...\n", nodeID);                if (_voxelServerCount > 0) {            // Kill any voxels from the local tree that match this nodeID            _tree->recurseTreeWithOperation(killSourceVoxelsOperation, &nodeID);            _tree->setDirtyBit();        } else {            // Last server, take the easy way and kill all the local voxels!            _tree->eraseAllVoxels();            _voxelsInWriteArrays = _voxelsInReadArrays = 0; // better way to do this??        }        setupNewVoxelsForDrawing();    }}  

Lines 1501–1579 of 1579. Previous lines