Merge pull request #4469 from jherico/frustumFetchCheck

Fix broken aspect ratio in mirror
This commit is contained in:
Brad Hefta-Gaub 2015-03-17 17:06:21 -07:00
commit 55d9560c9e
4 changed files with 29 additions and 4 deletions

View file

@ -2795,7 +2795,27 @@ QImage Application::renderAvatarBillboard() {
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) {
activeRenderingThread = QThread::currentThread();
PROFILE_RANGE(__FUNCTION__);
PerformanceTimer perfTimer("display");
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);
_overlays.renderWorld(true);
}
activeRenderingThread = nullptr;
}
void Application::updateUntranslatedViewMatrix(const glm::vec3& viewMatrixTranslation) {

View file

@ -174,8 +174,12 @@ public:
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
Camera* getCamera() { return &_myCamera; }
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
// Represents the current view frustum of the avatar.
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; }
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
EntityTreeRenderer* getEntities() { return &_entities; }

View file

@ -338,7 +338,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
// simple frustum check
float boundingRadius = getBillboardSize();
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) {
return;
}

View file

@ -122,7 +122,7 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re
float myAvatarScale = 1.0f;
auto lodManager = DependencyManager::get<LODManager>();
RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(),
RenderArgs args = { NULL, Application::getInstance()->getDisplayViewFrustum(),
lodManager->getOctreeSizeScale(),
lodManager->getBoundaryLevelAdjust(),
renderMode, renderSide,