mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
reasonable values for iitial OctreeQueryNode view
make sure newViewFrustum is fully initialized before using it
This commit is contained in:
parent
0597970bb4
commit
d061627a1d
3 changed files with 22 additions and 10 deletions
|
@ -17,7 +17,18 @@
|
||||||
#include "OctreeConstants.h"
|
#include "OctreeConstants.h"
|
||||||
#include "OctreeQuery.h"
|
#include "OctreeQuery.h"
|
||||||
|
|
||||||
OctreeQuery::OctreeQuery() {
|
const float DEFAULT_FOV = 45.0f; // degrees
|
||||||
|
const float DEFAULT_ASPECT_RATIO = 1.0f;
|
||||||
|
const float DEFAULT_NEAR_CLIP = 0.1f;
|
||||||
|
const float DEFAULT_FAR_CLIP = 3.0f;
|
||||||
|
|
||||||
|
OctreeQuery::OctreeQuery() :
|
||||||
|
_cameraFov(DEFAULT_FOV),
|
||||||
|
_cameraAspectRatio(DEFAULT_ASPECT_RATIO),
|
||||||
|
_cameraNearClip(DEFAULT_NEAR_CLIP),
|
||||||
|
_cameraFarClip(DEFAULT_FAR_CLIP),
|
||||||
|
_cameraCenterRadius(DEFAULT_FAR_CLIP)
|
||||||
|
{
|
||||||
_maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
_maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,14 +89,14 @@ public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// camera details for the avatar
|
// camera details for the avatar
|
||||||
glm::vec3 _cameraPosition = glm::vec3(0.0f);
|
glm::vec3 _cameraPosition { glm::vec3(0.0f) };
|
||||||
glm::quat _cameraOrientation = glm::quat();
|
glm::quat _cameraOrientation { glm::quat() };
|
||||||
float _cameraFov = 0.0f;
|
float _cameraFov;
|
||||||
float _cameraAspectRatio = 1.0f;
|
float _cameraAspectRatio;
|
||||||
float _cameraNearClip = 0.0f;
|
float _cameraNearClip;
|
||||||
float _cameraFarClip = 0.0f;
|
float _cameraFarClip;
|
||||||
float _cameraCenterRadius { 0.0f };
|
float _cameraCenterRadius;
|
||||||
glm::vec3 _cameraEyeOffsetPosition = glm::vec3(0.0f);
|
glm::vec3 _cameraEyeOffsetPosition { glm::vec3(0.0f) };
|
||||||
|
|
||||||
// octree server sending items
|
// octree server sending items
|
||||||
int _maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
int _maxQueryPPS = DEFAULT_MAX_OCTREE_PPS;
|
||||||
|
|
|
@ -182,6 +182,7 @@ bool OctreeQueryNode::updateCurrentViewFrustum() {
|
||||||
getCameraAspectRatio(),
|
getCameraAspectRatio(),
|
||||||
getCameraNearClip(),
|
getCameraNearClip(),
|
||||||
getCameraFarClip()));
|
getCameraFarClip()));
|
||||||
|
newestViewFrustum.calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ bool OctreeQueryNode::updateCurrentViewFrustum() {
|
||||||
QMutexLocker viewLocker(&_viewMutex);
|
QMutexLocker viewLocker(&_viewMutex);
|
||||||
if (!newestViewFrustum.isVerySimilar(_currentViewFrustum)) {
|
if (!newestViewFrustum.isVerySimilar(_currentViewFrustum)) {
|
||||||
_currentViewFrustum = newestViewFrustum;
|
_currentViewFrustum = newestViewFrustum;
|
||||||
_currentViewFrustum.calculate();
|
//_currentViewFrustum.calculateProjection();
|
||||||
currentViewFrustumChanged = true;
|
currentViewFrustumChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue