diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6cc318af06..f28d09ef51 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2440,7 +2440,7 @@ void Application::resizeGL() { // Possible change in aspect ratio { QMutexLocker viewLocker(&_viewMutex); - loadViewFrustum(_myCamera, _viewFrustum); + _myCamera.loadViewFrustum(_viewFrustum); } auto offscreenUi = DependencyManager::get(); @@ -4525,7 +4525,7 @@ void Application::update(float deltaTime) { // to the server. { QMutexLocker viewLocker(&_viewMutex); - loadViewFrustum(_myCamera, _viewFrustum); + _myCamera.loadViewFrustum(_viewFrustum); } quint64 now = usecTimestampNow(); @@ -4853,24 +4853,6 @@ QRect Application::getDesirableApplicationGeometry() const { return applicationGeometry; } -///////////////////////////////////////////////////////////////////////////////////// -// loadViewFrustum() -// -// Description: this will load the view frustum bounds for EITHER the head -// or the "myCamera". -// -void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { - // We will use these below, from either the camera or head vectors calculated above - viewFrustum.setProjection(camera.getProjection()); - - // Set the viewFrustum up with the correct position and orientation of the camera - viewFrustum.setPosition(camera.getPosition()); - viewFrustum.setOrientation(camera.getOrientation()); - - // Ask the ViewFrustum class to calculate our corners - viewFrustum.calculate(); -} - glm::vec3 Application::getSunDirection() const { // Sun direction is in fact just the location of the sun relative to the origin auto skyStage = DependencyManager::get()->getSkyStage(); @@ -5042,7 +5024,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se // load the view frustum { QMutexLocker viewLocker(&_viewMutex); - loadViewFrustum(theCamera, _displayViewFrustum); + theCamera.loadViewFrustum(_displayViewFrustum); } // TODO fix shadows and make them use the GPU library @@ -5059,7 +5041,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se transaction.resetItem(BackgroundRenderData::_item, backgroundRenderPayload); } - // Assuming nothing get's rendered through that + // Assuming nothing gets rendered through that if (!selfAvatarOnly) { if (DependencyManager::get()->shouldRenderEntities()) { // render models... diff --git a/interface/src/Application.h b/interface/src/Application.h index 12b2fbfd6e..c8856f1026 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -462,7 +462,6 @@ private: void updateDialogs(float deltaTime) const; void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions, bool forceResend = false); - static void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum); glm::vec3 getSunDirection() const; diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 260359da51..9b99aa5d34 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -71,6 +71,7 @@ namespace render { auto avatarPtr = static_pointer_cast(avatar); if (avatarPtr->isInitialized() && args) { PROFILE_RANGE_BATCH(*args->_batch, "renderAvatarPayload"); + // TODO AVATARS_RENDERER: remove need for qApp avatarPtr->render(args, qApp->getMain3DScene(), qApp->getCamera()); } } @@ -641,19 +642,12 @@ void Avatar::render(RenderArgs* renderArgs, render::ScenePointer scene, const Ca } } - { // simple frustum check - ViewFrustum frustum; - if (renderArgs->_renderMode == RenderArgs::SHADOW_RENDER_MODE) { - qApp->copyShadowViewFrustum(frustum); - } else { - qApp->copyDisplayViewFrustum(frustum); - } - if (!frustum.sphereIntersectsFrustum(getPosition(), getBoundingRadius())) { - return; - } + ViewFrustum frustum = renderArgs->getViewFrustum(); + if (!frustum.sphereIntersectsFrustum(getPosition(), getBoundingRadius())) { + return; } - glm::vec3 toTarget = camera.getPosition() - getPosition(); + glm::vec3 toTarget = frustum.getPosition() - getPosition(); float distanceToTarget = glm::length(toTarget); { @@ -686,6 +680,7 @@ void Avatar::render(RenderArgs* renderArgs, render::ScenePointer scene, const Ca const float DISPLAYNAME_DISTANCE = 20.0f; setShowDisplayName(distanceToTarget < DISPLAYNAME_DISTANCE); + // TODO AVATARS_RENDERER: remove need for 'camera' in this context auto cameraMode = camera.getMode(); if (!isMyAvatar() || cameraMode != CAMERA_MODE_FIRST_PERSON) { auto& frustum = renderArgs->getViewFrustum();