History

use references not pointers for ViewFrustums

also unravelling some spaghetti: (1) split Octree stuff out of ViewFrustum (2) moved ViewFrustum from octree to shared lib (3) removed some cruft

Andrew Meadows committed 10 years ago

Commit bcf2cc81 parent 21fa29446 files · +412 −390Browse files

Showing the changes to interface/src/Application.cpp (1 of 46 files). Show all

Unified · Split

interface/src/Application.cpp+10−19
@@ -1513,9 +1513,10 @@ void Application::paintGL() { · 1512 unmodified lines
1513 1513
1514 1514
1515 _viewFrustum.calculate();1515 _viewFrustum.calculate();
1516 RenderArgs renderArgs(_gpuContext, getEntities(), getViewFrustum(), lodManager->getOctreeSizeScale(),1516 RenderArgs renderArgs(_gpuContext, getEntities(), lodManager->getOctreeSizeScale(),
1517 lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,1517 lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
1518 RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);1518 RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
1519 renderArgs.setViewFrustum(getViewFrustum());
1519 1520
1520 PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));1521 PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
1521 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);1522 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@@ -1682,7 +1683,7 @@ void Application::paintGL() { · 160 unmodified lines
1682 renderArgs._context->enableStereo(true);1683 renderArgs._context->enableStereo(true);
1683 mat4 eyeOffsets[2];1684 mat4 eyeOffsets[2];
1684 mat4 eyeProjections[2];1685 mat4 eyeProjections[2];
1685 auto baseProjection = renderArgs._viewFrustum->getProjection();1686 auto baseProjection = renderArgs.getViewFrustum().getProjection();
1686 auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();1687 auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
1687 float IPDScale = hmdInterface->getIPDScale();1688 float IPDScale = hmdInterface->getIPDScale();
1688 mat4 headPose = displayPlugin->getHeadPose();1689 mat4 headPose = displayPlugin->getHeadPose();
@@ -3862,7 +3863,7 @@ PickRay Application::computePickRay(float x, float y) const { · 2173 unmodified lines
3862 getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);3863 getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);
3863 } else {3864 } else {
3864 pickPoint /= getCanvasSize();3865 pickPoint /= getCanvasSize();
3865 getViewFrustum()->computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);3866 getViewFrustum().computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);
3866 }3867 }
3867 return result;3868 return result;
3868}3869}
@@ -3875,34 +3876,24 @@ glm::vec3 Application::getAvatarPosition() const { · 6 unmodified lines
3875 return getMyAvatar()->getPosition();3876 return getMyAvatar()->getPosition();
3876}3877}
3877 3878
3878const ViewFrustum* Application::getViewFrustum() const {3879const ViewFrustum& Application::getViewFrustum() const {
3879#ifdef DEBUG3880#ifdef DEBUG
3880 if (QThread::currentThread() == activeRenderingThread) {3881 if (QThread::currentThread() == activeRenderingThread) {
3881 // FIXME, figure out a better way to do this3882 // FIXME, figure out a better way to do this
3882 //qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";3883 //qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";
3883 }3884 }
3884#endif3885#endif
3885 return &_viewFrustum;3886 return _viewFrustum;
3886}3887}
3887 3888
3888ViewFrustum* Application::getDisplayViewFrustum() {3889const ViewFrustum& Application::getDisplayViewFrustum() const {
3889#ifdef DEBUG3890#ifdef DEBUG
3890 if (QThread::currentThread() != activeRenderingThread) {3891 if (QThread::currentThread() != activeRenderingThread) {
3891 // FIXME, figure out a better way to do this3892 // FIXME, figure out a better way to do this
3892 // qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";3893 // qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
3893 }3894 }
3894#endif3895#endif
3895 return &_displayViewFrustum;3896 return _displayViewFrustum;
3896}
3897
3898const ViewFrustum* Application::getDisplayViewFrustum() const {
3899#ifdef DEBUG
3900 if (QThread::currentThread() != activeRenderingThread) {
3901 // FIXME, figure out a better way to do this
3902 // qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
3903 }
3904#endif
3905 return &_displayViewFrustum;
3906}3897}
3907 3898
3908// WorldBox Render Data & rendering functions3899// WorldBox Render Data & rendering functions
@@ -3967,7 +3958,7 @@ namespace render { · 58 unmodified lines
3967 auto skybox = skyStage->getSkybox();3958 auto skybox = skyStage->getSkybox();
3968 if (skybox) {3959 if (skybox) {
3969 PerformanceTimer perfTimer("skybox");3960 PerformanceTimer perfTimer("skybox");
3970 skybox->render(batch, *(args->_viewFrustum));3961 skybox->render(batch, args->getViewFrustum());
3971 break;3962 break;
3972 }3963 }
3973 }3964 }
@@ -4079,7 +4070,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 105 unmodified lines
4079 {4070 {
4080 PerformanceTimer perfTimer("EngineRun");4071 PerformanceTimer perfTimer("EngineRun");
4081 4072
4082 renderArgs->_viewFrustum = getDisplayViewFrustum();4073 renderArgs->setViewFrustum(getDisplayViewFrustum());
4083 _renderEngine->getRenderContext()->args = renderArgs;4074 _renderEngine->getRenderContext()->args = renderArgs;
4084 4075
4085 // Before the deferred pass, let's try to use the render engine4076 // Before the deferred pass, let's try to use the render engine