diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerdisplay.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llviewerdisplay.cpp')
-rw-r--r-- | linden/indra/newview/llviewerdisplay.cpp | 93 |
1 files changed, 59 insertions, 34 deletions
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp index 9395b97..b4d6f27 100644 --- a/linden/indra/newview/llviewerdisplay.cpp +++ b/linden/indra/newview/llviewerdisplay.cpp | |||
@@ -75,6 +75,7 @@ | |||
75 | #include "llcubemap.h" | 75 | #include "llcubemap.h" |
76 | #include "llviewerregion.h" | 76 | #include "llviewerregion.h" |
77 | #include "lldrawpoolwater.h" | 77 | #include "lldrawpoolwater.h" |
78 | #include "lldrawpoolbump.h" | ||
78 | #include "llwlparammanager.h" | 79 | #include "llwlparammanager.h" |
79 | #include "llwaterparammanager.h" | 80 | #include "llwaterparammanager.h" |
80 | #include "llpostprocess.h" | 81 | #include "llpostprocess.h" |
@@ -82,6 +83,7 @@ | |||
82 | extern LLPointer<LLImageGL> gStartImageGL; | 83 | extern LLPointer<LLImageGL> gStartImageGL; |
83 | extern BOOL gDisplaySwapBuffers; | 84 | extern BOOL gDisplaySwapBuffers; |
84 | 85 | ||
86 | |||
85 | LLPointer<LLImageGL> gDisconnectedImagep = NULL; | 87 | LLPointer<LLImageGL> gDisconnectedImagep = NULL; |
86 | 88 | ||
87 | // used to toggle renderer back on after teleport | 89 | // used to toggle renderer back on after teleport |
@@ -171,18 +173,15 @@ void display_update_camera() | |||
171 | { | 173 | { |
172 | final_far *= 0.5f; | 174 | final_far *= 0.5f; |
173 | } | 175 | } |
174 | gCamera->setFar(final_far); | 176 | LLViewerCamera::getInstance()->setFar(final_far); |
175 | gViewerWindow->setup3DRender(); | 177 | gViewerWindow->setup3DRender(); |
176 | 178 | ||
177 | // update all the sky/atmospheric/water settings | 179 | // update all the sky/atmospheric/water settings |
178 | LLWLParamManager::instance()->update(gCamera); | 180 | LLWLParamManager::instance()->update(LLViewerCamera::getInstance()); |
179 | LLWaterParamManager::instance()->update(gCamera); | 181 | LLWaterParamManager::instance()->update(LLViewerCamera::getInstance()); |
180 | 182 | ||
181 | // Update land visibility too | 183 | // Update land visibility too |
182 | if (gWorldp) | 184 | LLWorld::getInstance()->setLandFarClip(final_far); |
183 | { | ||
184 | gWorldp->setLandFarClip(final_far); | ||
185 | } | ||
186 | } | 185 | } |
187 | 186 | ||
188 | 187 | ||
@@ -284,7 +283,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
284 | LLImageGL::updateStats(gFrameTimeSeconds); | 283 | LLImageGL::updateStats(gFrameTimeSeconds); |
285 | 284 | ||
286 | LLVOAvatar::sRenderName = gSavedSettings.getS32("RenderName"); | 285 | LLVOAvatar::sRenderName = gSavedSettings.getS32("RenderName"); |
287 | LLVOAvatar::sRenderGroupTitles = gSavedSettings.getBOOL("RenderGroupTitleAll"); | 286 | LLVOAvatar::sRenderGroupTitles = !gSavedSettings.getBOOL("RenderHideGroupTitleAll"); |
287 | |||
288 | gPipeline.mBackfaceCull = TRUE; | 288 | gPipeline.mBackfaceCull = TRUE; |
289 | gFrameCount++; | 289 | gFrameCount++; |
290 | if (gFocusMgr.getAppHasFocus()) | 290 | if (gFocusMgr.getAppHasFocus()) |
@@ -422,8 +422,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
422 | // | 422 | // |
423 | // | 423 | // |
424 | 424 | ||
425 | gCamera->setZoomParameters(zoom_factor, subfield); | 425 | LLViewerCamera::getInstance()->setZoomParameters(zoom_factor, subfield); |
426 | gCamera->setNear(MIN_NEAR_PLANE); | 426 | LLViewerCamera::getInstance()->setNear(MIN_NEAR_PLANE); |
427 | 427 | ||
428 | ////////////////////////// | 428 | ////////////////////////// |
429 | // | 429 | // |
@@ -497,7 +497,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
497 | stop_glerror(); | 497 | stop_glerror(); |
498 | 498 | ||
499 | // *TODO: merge these two methods | 499 | // *TODO: merge these two methods |
500 | gHUDManager->updateEffects(); | 500 | LLHUDManager::getInstance()->updateEffects(); |
501 | LLHUDObject::updateAll(); | 501 | LLHUDObject::updateAll(); |
502 | stop_glerror(); | 502 | stop_glerror(); |
503 | 503 | ||
@@ -508,9 +508,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
508 | 508 | ||
509 | gFrameStats.start(LLFrameStats::UPDATE_CULL); | 509 | gFrameStats.start(LLFrameStats::UPDATE_CULL); |
510 | S32 water_clip = 0; | 510 | S32 water_clip = 0; |
511 | if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) | 511 | if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) && |
512 | gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER)) | ||
512 | { | 513 | { |
513 | if (gCamera->cameraUnderWater()) | 514 | if (LLViewerCamera::getInstance()->cameraUnderWater()) |
514 | { | 515 | { |
515 | water_clip = -1; | 516 | water_clip = -1; |
516 | } | 517 | } |
@@ -525,7 +526,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
525 | 526 | ||
526 | LLPipeline::sUseOcclusion = | 527 | LLPipeline::sUseOcclusion = |
527 | (!gUseWireframe | 528 | (!gUseWireframe |
528 | && gFeatureManagerp->isFeatureAvailable("UseOcclusion") | 529 | && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") |
529 | && gSavedSettings.getBOOL("UseOcclusion") | 530 | && gSavedSettings.getBOOL("UseOcclusion") |
530 | && gGLManager.mHasOcclusionQuery) ? 2 : 0; | 531 | && gGLManager.mHasOcclusionQuery) ? 2 : 0; |
531 | LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha"); | 532 | LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha"); |
@@ -539,7 +540,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
539 | } | 540 | } |
540 | 541 | ||
541 | static LLCullResult result; | 542 | static LLCullResult result; |
542 | gPipeline.updateCull(*gCamera, result, water_clip); | 543 | gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); |
543 | stop_glerror(); | 544 | stop_glerror(); |
544 | 545 | ||
545 | BOOL to_texture = !for_snapshot && | 546 | BOOL to_texture = !for_snapshot && |
@@ -570,7 +571,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
570 | 571 | ||
571 | glh::matrix4f proj = glh_get_current_projection(); | 572 | glh::matrix4f proj = glh_get_current_projection(); |
572 | glh::matrix4f mod = glh_get_current_modelview(); | 573 | glh::matrix4f mod = glh_get_current_modelview(); |
573 | glViewport(0,0,128,256); | 574 | glViewport(0,0,512,512); |
575 | LLVOAvatar::updateFreezeCounter() ; | ||
574 | LLVOAvatar::updateImpostors(); | 576 | LLVOAvatar::updateImpostors(); |
575 | glh_set_current_projection(proj); | 577 | glh_set_current_projection(proj); |
576 | glh_set_current_modelview(mod); | 578 | glh_set_current_modelview(mod); |
@@ -585,8 +587,30 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
585 | 587 | ||
586 | if (!for_snapshot) | 588 | if (!for_snapshot) |
587 | { | 589 | { |
588 | gPipeline.processImagery(*gCamera); | 590 | gPipeline.processImagery(*LLViewerCamera::getInstance()); |
589 | gPipeline.generateWaterReflection(*gCamera); | 591 | gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); |
592 | } | ||
593 | |||
594 | ////////////////////////////////////// | ||
595 | // | ||
596 | // Update images, using the image stats generated during object update/culling | ||
597 | // | ||
598 | // Can put objects onto the retextured list. | ||
599 | // | ||
600 | // Doing this here gives hardware occlusion queries extra time to complete | ||
601 | gFrameStats.start(LLFrameStats::IMAGE_UPDATE); | ||
602 | |||
603 | { | ||
604 | LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); | ||
605 | |||
606 | LLViewerImage::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(), | ||
607 | LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean()); | ||
608 | |||
609 | gBumpImageList.updateImages(); // must be called before gImageList version so that it's textures are thrown out first. | ||
610 | |||
611 | const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) | ||
612 | gImageList.updateImages(max_image_decode_time); | ||
613 | stop_glerror(); | ||
590 | } | 614 | } |
591 | 615 | ||
592 | /////////////////////////////////// | 616 | /////////////////////////////////// |
@@ -599,7 +623,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
599 | // | 623 | // |
600 | { | 624 | { |
601 | gFrameStats.start(LLFrameStats::STATE_SORT); | 625 | gFrameStats.start(LLFrameStats::STATE_SORT); |
602 | gPipeline.stateSort(*gCamera, result); | 626 | gPipeline.stateSort(*LLViewerCamera::getInstance(), result); |
603 | stop_glerror(); | 627 | stop_glerror(); |
604 | 628 | ||
605 | if (rebuild) | 629 | if (rebuild) |
@@ -650,8 +674,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
650 | // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(), | 674 | // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(), |
651 | // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight()); | 675 | // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight()); |
652 | // floater_3d_rect.translate(-0.5f, -0.5f); | 676 | // floater_3d_rect.translate(-0.5f, -0.5f); |
653 | // glTranslatef(0.f, 0.f, -gCamera->getNear()); | 677 | // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); |
654 | // glScalef(gCamera->getNear() * gCamera->getAspect() / sinf(gCamera->getView()), gCamera->getNear() / sinf(gCamera->getView()), 1.f); | 678 | // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); |
655 | // gGL.color4fv(LLColor4::white.mV); | 679 | // gGL.color4fv(LLColor4::white.mV); |
656 | // gGL.begin(GL_QUADS); | 680 | // gGL.begin(GL_QUADS); |
657 | // { | 681 | // { |
@@ -678,8 +702,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
678 | && !gRestoreGL) | 702 | && !gRestoreGL) |
679 | { | 703 | { |
680 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); | 704 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); |
681 | LLPipeline::sUnderWaterRender = gCamera->cameraUnderWater() ? TRUE : FALSE; | 705 | LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; |
682 | gPipeline.renderGeom(*gCamera, TRUE); | 706 | gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE); |
683 | LLPipeline::sUnderWaterRender = FALSE; | 707 | LLPipeline::sUnderWaterRender = FALSE; |
684 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 708 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
685 | 709 | ||
@@ -691,8 +715,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
691 | } | 715 | } |
692 | stop_glerror(); | 716 | stop_glerror(); |
693 | } | 717 | } |
694 | |||
695 | render_hud_attachments(); | ||
696 | 718 | ||
697 | if (to_texture) | 719 | if (to_texture) |
698 | { | 720 | { |
@@ -735,7 +757,7 @@ void render_hud_attachments() | |||
735 | 757 | ||
736 | if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices(FALSE)) | 758 | if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices(FALSE)) |
737 | { | 759 | { |
738 | LLCamera hud_cam = *gCamera; | 760 | LLCamera hud_cam = *LLViewerCamera::getInstance(); |
739 | LLVector3 origin = hud_cam.getOrigin(); | 761 | LLVector3 origin = hud_cam.getOrigin(); |
740 | hud_cam.setOrigin(-1.f,0,0); | 762 | hud_cam.setOrigin(-1.f,0,0); |
741 | hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); | 763 | hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); |
@@ -763,13 +785,13 @@ void render_hud_attachments() | |||
763 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP); | 785 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP); |
764 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE); | 786 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE); |
765 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); | 787 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); |
766 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_GLOW); | ||
767 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); | 788 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); |
768 | 789 | ||
769 | gPipeline.stateSort(hud_cam, result); | 790 | gPipeline.stateSort(hud_cam, result); |
770 | 791 | ||
771 | gPipeline.renderGeom(hud_cam); | 792 | gPipeline.renderGeom(hud_cam); |
772 | 793 | ||
794 | render_hud_elements(); | ||
773 | //restore type mask | 795 | //restore type mask |
774 | gPipeline.setRenderTypeMask(mask); | 796 | gPipeline.setRenderTypeMask(mask); |
775 | if (has_ui) | 797 | if (has_ui) |
@@ -818,12 +840,12 @@ BOOL setup_hud_matrices(BOOL for_select) | |||
818 | //RN: reset viewport to window extents so ortho screen is calculated with proper reference frame | 840 | //RN: reset viewport to window extents so ortho screen is calculated with proper reference frame |
819 | gViewerWindow->setupViewport(); | 841 | gViewerWindow->setupViewport(); |
820 | } | 842 | } |
821 | glh::matrix4f proj = gl_ortho(-0.5f * gCamera->getAspect(), 0.5f * gCamera->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); | 843 | glh::matrix4f proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); |
822 | proj.element(2,2) = -0.01f; | 844 | proj.element(2,2) = -0.01f; |
823 | 845 | ||
824 | // apply camera zoom transform (for high res screenshots) | 846 | // apply camera zoom transform (for high res screenshots) |
825 | F32 zoom_factor = gCamera->getZoomFactor(); | 847 | F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); |
826 | S16 sub_region = gCamera->getZoomSubRegion(); | 848 | S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); |
827 | if (zoom_factor > 1.f) | 849 | if (zoom_factor > 1.f) |
828 | { | 850 | { |
829 | float offset = zoom_factor - 1.f; | 851 | float offset = zoom_factor - 1.f; |
@@ -831,7 +853,7 @@ BOOL setup_hud_matrices(BOOL for_select) | |||
831 | int pos_x = sub_region - (pos_y*llceil(zoom_factor)); | 853 | int pos_x = sub_region - (pos_y*llceil(zoom_factor)); |
832 | glh::matrix4f mat; | 854 | glh::matrix4f mat; |
833 | mat.set_scale(glh::vec3f(zoom_factor, zoom_factor, 1.f)); | 855 | mat.set_scale(glh::vec3f(zoom_factor, zoom_factor, 1.f)); |
834 | mat.set_translate(glh::vec3f(gCamera->getAspect() * 0.5f * (offset - (F32)pos_x * 2.f), 0.5f * (offset - (F32)pos_y * 2.f), 0.f)); | 856 | mat.set_translate(glh::vec3f(LLViewerCamera::getInstance()->getAspect() * 0.5f * (offset - (F32)pos_x * 2.f), 0.5f * (offset - (F32)pos_y * 2.f), 0.f)); |
835 | proj *= mat; | 857 | proj *= mat; |
836 | } | 858 | } |
837 | 859 | ||
@@ -873,6 +895,9 @@ void render_ui_and_swap() | |||
873 | { | 895 | { |
874 | gPipeline.renderBloom(gSnapshot); | 896 | gPipeline.renderBloom(gSnapshot); |
875 | } | 897 | } |
898 | |||
899 | render_hud_elements(); | ||
900 | render_hud_attachments(); | ||
876 | } | 901 | } |
877 | 902 | ||
878 | LLGLSDefault gls_default; | 903 | LLGLSDefault gls_default; |
@@ -1049,8 +1074,8 @@ void render_ui_2d() | |||
1049 | // Menu overlays, HUD, etc | 1074 | // Menu overlays, HUD, etc |
1050 | gViewerWindow->setup2DRender(); | 1075 | gViewerWindow->setup2DRender(); |
1051 | 1076 | ||
1052 | F32 zoom_factor = gCamera->getZoomFactor(); | 1077 | F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); |
1053 | S16 sub_region = gCamera->getZoomSubRegion(); | 1078 | S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); |
1054 | 1079 | ||
1055 | if (zoom_factor > 1.f) | 1080 | if (zoom_factor > 1.f) |
1056 | { | 1081 | { |