mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 04:37:59 +02:00
Merge pull request #4469 from jherico/frustumFetchCheck
Fix broken aspect ratio in mirror
This commit is contained in:
commit
55d9560c9e
4 changed files with 29 additions and 4 deletions
|
@ -2795,7 +2795,27 @@ QImage Application::renderAvatarBillboard() {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME, preprocessor guard this check to occur only in DEBUG builds
|
||||||
|
static QThread * activeRenderingThread = nullptr;
|
||||||
|
|
||||||
|
ViewFrustum* Application::getViewFrustum() {
|
||||||
|
if (QThread::currentThread() == activeRenderingThread) {
|
||||||
|
// FIXME, should this be an assert?
|
||||||
|
qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";
|
||||||
|
}
|
||||||
|
return &_viewFrustum;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewFrustum* Application::getDisplayViewFrustum() {
|
||||||
|
if (QThread::currentThread() != activeRenderingThread) {
|
||||||
|
// FIXME, should this be an assert?
|
||||||
|
qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
|
||||||
|
}
|
||||||
|
return &_displayViewFrustum;
|
||||||
|
}
|
||||||
|
|
||||||
void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs::RenderSide renderSide) {
|
void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs::RenderSide renderSide) {
|
||||||
|
activeRenderingThread = QThread::currentThread();
|
||||||
PROFILE_RANGE(__FUNCTION__);
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
PerformanceTimer perfTimer("display");
|
PerformanceTimer perfTimer("display");
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()");
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()");
|
||||||
|
@ -3020,6 +3040,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
_overlays.renderWorld(true);
|
_overlays.renderWorld(true);
|
||||||
}
|
}
|
||||||
|
activeRenderingThread = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) {
|
void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) {
|
||||||
|
|
|
@ -174,8 +174,12 @@ public:
|
||||||
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
|
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
|
||||||
|
|
||||||
Camera* getCamera() { return &_myCamera; }
|
Camera* getCamera() { return &_myCamera; }
|
||||||
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
// Represents the current view frustum of the avatar.
|
||||||
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
ViewFrustum* getViewFrustum();
|
||||||
|
// Represents the view frustum of the current rendering pass,
|
||||||
|
// which might be different from the viewFrustum, i.e. shadowmap
|
||||||
|
// passes, mirror window passes, etc
|
||||||
|
ViewFrustum* getDisplayViewFrustum();
|
||||||
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
||||||
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
||||||
EntityTreeRenderer* getEntities() { return &_entities; }
|
EntityTreeRenderer* getEntities() { return &_entities; }
|
||||||
|
|
|
@ -338,7 +338,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
// simple frustum check
|
// simple frustum check
|
||||||
float boundingRadius = getBillboardSize();
|
float boundingRadius = getBillboardSize();
|
||||||
ViewFrustum* frustum = (renderMode == Avatar::SHADOW_RENDER_MODE) ?
|
ViewFrustum* frustum = (renderMode == Avatar::SHADOW_RENDER_MODE) ?
|
||||||
Application::getInstance()->getShadowViewFrustum() : Application::getInstance()->getViewFrustum();
|
Application::getInstance()->getShadowViewFrustum() : Application::getInstance()->getDisplayViewFrustum();
|
||||||
if (frustum->sphereInFrustum(getPosition(), boundingRadius) == ViewFrustum::OUTSIDE) {
|
if (frustum->sphereInFrustum(getPosition(), boundingRadius) == ViewFrustum::OUTSIDE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re
|
||||||
float myAvatarScale = 1.0f;
|
float myAvatarScale = 1.0f;
|
||||||
|
|
||||||
auto lodManager = DependencyManager::get<LODManager>();
|
auto lodManager = DependencyManager::get<LODManager>();
|
||||||
RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(),
|
RenderArgs args = { NULL, Application::getInstance()->getDisplayViewFrustum(),
|
||||||
lodManager->getOctreeSizeScale(),
|
lodManager->getOctreeSizeScale(),
|
||||||
lodManager->getBoundaryLevelAdjust(),
|
lodManager->getBoundaryLevelAdjust(),
|
||||||
renderMode, renderSide,
|
renderMode, renderSide,
|
||||||
|
|
Loading…
Reference in a new issue