switching to OctreeQuery instead of VoxelQuery

This commit is contained in:
ZappoMan 2014-02-26 01:22:53 -08:00
parent 5fdfee4cd5
commit 5b1037cc63
2 changed files with 29 additions and 29 deletions

View file

@ -1931,23 +1931,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
bool wantExtraDebugging = getLogger()->extraDebugging(); bool wantExtraDebugging = getLogger()->extraDebugging();
// These will be the same for all servers, so we can set them up once and then reuse for each server we send to. // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
_voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes)); _octreeQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));
_voxelQuery.setWantColor(!Menu::getInstance()->isOptionChecked(MenuOption::DisableColorVoxels)); _octreeQuery.setWantColor(!Menu::getInstance()->isOptionChecked(MenuOption::DisableColorVoxels));
_voxelQuery.setWantDelta(!Menu::getInstance()->isOptionChecked(MenuOption::DisableDeltaSending)); _octreeQuery.setWantDelta(!Menu::getInstance()->isOptionChecked(MenuOption::DisableDeltaSending));
_voxelQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::EnableOcclusionCulling)); _octreeQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::EnableOcclusionCulling));
_voxelQuery.setWantCompression(Menu::getInstance()->isOptionChecked(MenuOption::EnableVoxelPacketCompression)); _octreeQuery.setWantCompression(Menu::getInstance()->isOptionChecked(MenuOption::EnableVoxelPacketCompression));
_voxelQuery.setCameraPosition(_viewFrustum.getPosition()); _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
_voxelQuery.setCameraOrientation(_viewFrustum.getOrientation()); _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
_voxelQuery.setCameraFov(_viewFrustum.getFieldOfView()); _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());
_voxelQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio()); _octreeQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio());
_voxelQuery.setCameraNearClip(_viewFrustum.getNearClip()); _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip());
_voxelQuery.setCameraFarClip(_viewFrustum.getFarClip()); _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());
_voxelQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition()); _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
_voxelQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale()); _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale());
_voxelQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust()); _octreeQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());
unsigned char voxelQueryPacket[MAX_PACKET_SIZE]; unsigned char queryPacket[MAX_PACKET_SIZE];
// Iterate all of the nodes, and get a count of how many voxel servers we have... // Iterate all of the nodes, and get a count of how many voxel servers we have...
int totalServers = 0; int totalServers = 0;
@ -2057,7 +2057,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
} }
if (inView) { if (inView) {
_voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); _octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
} else if (unknownView) { } else if (unknownView) {
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " qDebug() << "no known jurisdiction for node " << *node << ", give it budget of "
@ -2068,11 +2068,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
// If there's only one server, then don't do this, and just let the normal voxel query pass through // If there's only one server, then don't do this, and just let the normal voxel query pass through
// as expected... this way, we will actually get a valid scene if there is one to be seen // as expected... this way, we will actually get a valid scene if there is one to be seen
if (totalServers > 1) { if (totalServers > 1) {
_voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1)); _octreeQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0); const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
_voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE); _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
_voxelQuery.setCameraNearClip(0.1f); _octreeQuery.setCameraNearClip(0.1f);
_voxelQuery.setCameraFarClip(0.1f); _octreeQuery.setCameraFarClip(0.1f);
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "Using 'minimal' camera position for node" << *node; qDebug() << "Using 'minimal' camera position for node" << *node;
} }
@ -2081,23 +2081,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
qDebug() << "Using regular camera position for node" << *node; qDebug() << "Using regular camera position for node" << *node;
} }
} }
_voxelQuery.setMaxOctreePacketsPerSecond(perUnknownServer); _octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
} else { } else {
_voxelQuery.setMaxOctreePacketsPerSecond(0); _octreeQuery.setMaxOctreePacketsPerSecond(0);
} }
// set up the packet for sending... // set up the packet for sending...
unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; unsigned char* endOfQueryPacket = queryPacket;
// insert packet type/version and node UUID // insert packet type/version and node UUID
endOfVoxelQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfVoxelQueryPacket), packetType); endOfQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfQueryPacket), packetType);
// encode the query data... // encode the query data...
endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); endOfQueryPacket += _octreeQuery.getBroadcastData(endOfQueryPacket);
int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; int packetLength = endOfQueryPacket - queryPacket;
// make sure we still have an active socket // make sure we still have an active socket
nodeList->writeDatagram(reinterpret_cast<const char*>(voxelQueryPacket), packetLength, node); nodeList->writeDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
// Feed number of bytes to corresponding channel of the bandwidth meter // Feed number of bytes to corresponding channel of the bandwidth meter
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);

View file

@ -27,7 +27,7 @@
#include <ParticleCollisionSystem.h> #include <ParticleCollisionSystem.h>
#include <ParticleEditPacketSender.h> #include <ParticleEditPacketSender.h>
#include <ScriptEngine.h> #include <ScriptEngine.h>
#include <VoxelQuery.h> #include <OctreeQuery.h>
#include "Audio.h" #include "Audio.h"
@ -387,7 +387,7 @@ private:
Oscilloscope _audioScope; Oscilloscope _audioScope;
VoxelQuery _voxelQuery; // NodeData derived class for querying voxels from voxel server OctreeQuery _octreeQuery; // NodeData derived class for querying voxels from voxel server
AvatarManager _avatarManager; AvatarManager _avatarManager;
MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be) MyAvatar* _myAvatar; // TODO: move this and relevant code to AvatarManager (or MyAvatar as the case may be)