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
15131513
15141514
15151515 _viewFrustum.calculate();
1516− RenderArgs renderArgs(_gpuContext, getEntities(), getViewFrustum(), lodManager->getOctreeSizeScale(),
1516+ RenderArgs renderArgs(_gpuContext, getEntities(), lodManager->getOctreeSizeScale(),
15171517 lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
15181518 RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
1519+ renderArgs.setViewFrustum(getViewFrustum());
15191520
15201521 PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
15211522 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@@ -1682,7 +1683,7 @@ void Application::paintGL() { · 160 unmodified lines
16821683 renderArgs._context->enableStereo(true);
16831684 mat4 eyeOffsets[2];
16841685 mat4 eyeProjections[2];
1685− auto baseProjection = renderArgs._viewFrustum->getProjection();
1686+ auto baseProjection = renderArgs.getViewFrustum().getProjection();
16861687 auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
16871688 float IPDScale = hmdInterface->getIPDScale();
16881689 mat4 headPose = displayPlugin->getHeadPose();
@@ -3862,7 +3863,7 @@ PickRay Application::computePickRay(float x, float y) const { · 2173 unmodified lines
38623863 getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);
38633864 } else {
38643865 pickPoint /= getCanvasSize();
3865− getViewFrustum()->computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);
3866+ getViewFrustum().computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);
38663867 }
38673868 return result;
38683869 }
@@ -3875,34 +3876,24 @@ glm::vec3 Application::getAvatarPosition() const { · 6 unmodified lines
38753876 return getMyAvatar()->getPosition();
38763877 }
38773878
3878−const ViewFrustum* Application::getViewFrustum() const {
3879+const ViewFrustum& Application::getViewFrustum() const {
38793880 #ifdef DEBUG
38803881 if (QThread::currentThread() == activeRenderingThread) {
38813882 // FIXME, figure out a better way to do this
38823883 //qWarning() << "Calling Application::getViewFrustum() from the active rendering thread, did you mean Application::getDisplayViewFrustum()?";
38833884 }
38843885 #endif
3885− return &_viewFrustum;
3886+ return _viewFrustum;
38863887 }
38873888
3888−ViewFrustum* Application::getDisplayViewFrustum() {
3889+const ViewFrustum& Application::getDisplayViewFrustum() const {
38893890 #ifdef DEBUG
38903891 if (QThread::currentThread() != activeRenderingThread) {
38913892 // FIXME, figure out a better way to do this
38923893 // qWarning() << "Calling Application::getDisplayViewFrustum() from outside the active rendering thread or outside rendering, did you mean Application::getViewFrustum()?";
38933894 }
38943895 #endif
3895− return &_displayViewFrustum;
3896−}
3897−
3898−const 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;
3896+ return _displayViewFrustum;
39063897 }
39073898
39083899 // WorldBox Render Data & rendering functions
@@ -3967,7 +3958,7 @@ namespace render { · 58 unmodified lines
39673958 auto skybox = skyStage->getSkybox();
39683959 if (skybox) {
39693960 PerformanceTimer perfTimer("skybox");
3970− skybox->render(batch, *(args->_viewFrustum));
3961+ skybox->render(batch, args->getViewFrustum());
39713962 break;
39723963 }
39733964 }
@@ -4079,7 +4070,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 105 unmodified lines
40794070 {
40804071 PerformanceTimer perfTimer("EngineRun");
40814072
4082− renderArgs->_viewFrustum = getDisplayViewFrustum();
4073+ renderArgs->setViewFrustum(getDisplayViewFrustum());
40834074 _renderEngine->getRenderContext()->args = renderArgs;
40844075
40854076 // Before the deferred pass, let's try to use the render engine