make view frustum oversend and don't remove oversend in client

This commit is contained in:
ZappoMan 2013-10-04 21:36:21 -07:00
parent 86a27c5f69
commit 0c70a05732
3 changed files with 16 additions and 5 deletions

View file

@ -1416,7 +1416,7 @@ void VoxelSystem::falseColorizeDistanceFromView() {
class removeOutOfViewArgs {
public:
VoxelSystem* thisVoxelSystem;
ViewFrustum* thisViewFrustum;
ViewFrustum thisViewFrustum;
VoxelNodeBag dontRecurseBag;
unsigned long nodesScanned;
unsigned long nodesRemoved;
@ -1426,14 +1426,20 @@ public:
removeOutOfViewArgs(VoxelSystem* voxelSystem) :
thisVoxelSystem(voxelSystem),
thisViewFrustum(voxelSystem->getViewFrustum()),
thisViewFrustum(*voxelSystem->getViewFrustum()),
dontRecurseBag(),
nodesScanned(0),
nodesRemoved(0),
nodesInside(0),
nodesIntersect(0),
nodesOutside(0)
{ }
{
// Widen the FOV for trimming
float originalFOV = thisViewFrustum.getFieldOfView();
float wideFOV = originalFOV + VIEW_FRUSTUM_FOV_OVERSEND;
thisViewFrustum.setFieldOfView(wideFOV); // hack
thisViewFrustum.calculate();
}
};
void VoxelSystem::cancelImport() {
@ -1459,7 +1465,7 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) {
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
VoxelNode* childNode = node->getChildAtIndex(i);
if (childNode) {
ViewFrustum::location inFrustum = childNode->inFrustum(*args->thisViewFrustum);
ViewFrustum::location inFrustum = childNode->inFrustum(args->thisViewFrustum);
switch (inFrustum) {
case ViewFrustum::OUTSIDE: {
args->nodesOutside++;

View file

@ -74,7 +74,10 @@ bool VoxelNodeData::updateCurrentViewFrustum() {
newestViewFrustum.setOrientation(getCameraOrientation());
// Also make sure it's got the correct lens details from the camera
newestViewFrustum.setFieldOfView(getCameraFov());
float originalFOV = getCameraFov();
float wideFOV = originalFOV + VIEW_FRUSTUM_FOV_OVERSEND;
newestViewFrustum.setFieldOfView(wideFOV); // hack
newestViewFrustum.setAspectRatio(getCameraAspectRatio());
newestViewFrustum.setNearClip(getCameraNearClip());
newestViewFrustum.setFarClip(getCameraFarClip());

View file

@ -52,4 +52,6 @@ const float VIEW_CULLING_RATE_IN_MILLISECONDS = 1000.0f; // once a second is fin
const uint64_t CLIENT_TO_SERVER_VOXEL_SEND_INTERVAL_USECS = 1000 * 5; // 1 packet every 50 milliseconds
const float VIEW_FRUSTUM_FOV_OVERSEND = 60.0f;
#endif