mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:50:38 +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 {
|
class removeOutOfViewArgs {
|
||||||
public:
|
public:
|
||||||
VoxelSystem* thisVoxelSystem;
|
VoxelSystem* thisVoxelSystem;
|
||||||
ViewFrustum* thisViewFrustum;
|
ViewFrustum thisViewFrustum;
|
||||||
VoxelNodeBag dontRecurseBag;
|
VoxelNodeBag dontRecurseBag;
|
||||||
unsigned long nodesScanned;
|
unsigned long nodesScanned;
|
||||||
unsigned long nodesRemoved;
|
unsigned long nodesRemoved;
|
||||||
|
@ -1426,14 +1426,20 @@ public:
|
||||||
|
|
||||||
removeOutOfViewArgs(VoxelSystem* voxelSystem) :
|
removeOutOfViewArgs(VoxelSystem* voxelSystem) :
|
||||||
thisVoxelSystem(voxelSystem),
|
thisVoxelSystem(voxelSystem),
|
||||||
thisViewFrustum(voxelSystem->getViewFrustum()),
|
thisViewFrustum(*voxelSystem->getViewFrustum()),
|
||||||
dontRecurseBag(),
|
dontRecurseBag(),
|
||||||
nodesScanned(0),
|
nodesScanned(0),
|
||||||
nodesRemoved(0),
|
nodesRemoved(0),
|
||||||
nodesInside(0),
|
nodesInside(0),
|
||||||
nodesIntersect(0),
|
nodesIntersect(0),
|
||||||
nodesOutside(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() {
|
void VoxelSystem::cancelImport() {
|
||||||
|
@ -1459,7 +1465,7 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) {
|
||||||
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
||||||
VoxelNode* childNode = node->getChildAtIndex(i);
|
VoxelNode* childNode = node->getChildAtIndex(i);
|
||||||
if (childNode) {
|
if (childNode) {
|
||||||
ViewFrustum::location inFrustum = childNode->inFrustum(*args->thisViewFrustum);
|
ViewFrustum::location inFrustum = childNode->inFrustum(args->thisViewFrustum);
|
||||||
switch (inFrustum) {
|
switch (inFrustum) {
|
||||||
case ViewFrustum::OUTSIDE: {
|
case ViewFrustum::OUTSIDE: {
|
||||||
args->nodesOutside++;
|
args->nodesOutside++;
|
||||||
|
|
|
@ -74,7 +74,10 @@ bool VoxelNodeData::updateCurrentViewFrustum() {
|
||||||
newestViewFrustum.setOrientation(getCameraOrientation());
|
newestViewFrustum.setOrientation(getCameraOrientation());
|
||||||
|
|
||||||
// Also make sure it's got the correct lens details from the camera
|
// 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.setAspectRatio(getCameraAspectRatio());
|
||||||
newestViewFrustum.setNearClip(getCameraNearClip());
|
newestViewFrustum.setNearClip(getCameraNearClip());
|
||||||
newestViewFrustum.setFarClip(getCameraFarClip());
|
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 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
|
#endif
|
Loading…
Reference in a new issue