mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 19:04:27 +02:00
Merge branch 'master' of https://github.com/worklist/hifi
This commit is contained in:
commit
a58352df7b
1 changed files with 50 additions and 19 deletions
|
@ -2359,9 +2359,27 @@ void Application::queryVoxels() {
|
||||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||||
if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||||
|
|
||||||
|
// get the server bounds for this server
|
||||||
|
QUuid nodeUUID = node->getUUID();
|
||||||
|
const JurisdictionMap& map = (_voxelServerJurisdictions)[nodeUUID];
|
||||||
|
|
||||||
|
unsigned char* rootCode = map.getRootOctalCode();
|
||||||
|
|
||||||
|
if (rootCode) {
|
||||||
|
VoxelPositionSize rootDetails;
|
||||||
|
voxelDetailsForCode(rootCode, rootDetails);
|
||||||
|
AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s);
|
||||||
|
serverBounds.scale(TREE_SCALE);
|
||||||
|
|
||||||
|
ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds);
|
||||||
|
|
||||||
|
if (serverFrustumLocation != ViewFrustum::OUTSIDE) {
|
||||||
voxelServerCount++;
|
voxelServerCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// make sure there's at least one voxel server
|
// make sure there's at least one voxel server
|
||||||
if (voxelServerCount < 1) {
|
if (voxelServerCount < 1) {
|
||||||
|
@ -2370,7 +2388,6 @@ void Application::queryVoxels() {
|
||||||
|
|
||||||
// set our preferred PPS to be exactly evenly divided among all of the voxel servers...
|
// set our preferred PPS to be exactly evenly divided among all of the voxel servers...
|
||||||
int perServerPPS = DEFAULT_MAX_VOXEL_PPS/voxelServerCount;
|
int perServerPPS = DEFAULT_MAX_VOXEL_PPS/voxelServerCount;
|
||||||
printf("queryVoxels()... perServerPPS=%d\n",perServerPPS);
|
|
||||||
|
|
||||||
_voxelQuery.setMaxVoxelPacketsPerSecond(perServerPPS);
|
_voxelQuery.setMaxVoxelPacketsPerSecond(perServerPPS);
|
||||||
|
|
||||||
|
@ -2379,10 +2396,22 @@ void Application::queryVoxels() {
|
||||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||||
if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||||
|
|
||||||
// we can use this to get the voxel server details
|
|
||||||
//QUuid nodeUUID = node->getUUID();
|
|
||||||
//const JurisdictionMap& map = (_voxelServerJurisdictions)[nodeUUID];
|
|
||||||
|
|
||||||
|
// get the server bounds for this server
|
||||||
|
QUuid nodeUUID = node->getUUID();
|
||||||
|
const JurisdictionMap& map = (_voxelServerJurisdictions)[nodeUUID];
|
||||||
|
|
||||||
|
unsigned char* rootCode = map.getRootOctalCode();
|
||||||
|
|
||||||
|
if (rootCode) {
|
||||||
|
VoxelPositionSize rootDetails;
|
||||||
|
voxelDetailsForCode(rootCode, rootDetails);
|
||||||
|
AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s);
|
||||||
|
serverBounds.scale(TREE_SCALE);
|
||||||
|
|
||||||
|
ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds);
|
||||||
|
|
||||||
|
if (serverFrustumLocation != ViewFrustum::OUTSIDE) {
|
||||||
// set up the packet for sending...
|
// set up the packet for sending...
|
||||||
unsigned char* endOfVoxelQueryPacket = voxelQueryPacket;
|
unsigned char* endOfVoxelQueryPacket = voxelQueryPacket;
|
||||||
|
|
||||||
|
@ -2403,6 +2432,8 @@ void Application::queryVoxels() {
|
||||||
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
|
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue