mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Merge pull request #1021 from ZappoMan/wider_view_frustum
make view frustum oversend and don't remove oversend in client
This commit is contained in:
commit
3c5d7795e6
3 changed files with 16 additions and 5 deletions
|
@ -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);
|
||||
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++;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue