From 38483348eed5563fde1963575758334567af15e6 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 14 Dec 2009 15:15:08 -0800 Subject: Made LLViewerMedia::isInterestingEnough() take the performance manager's priority list list into account. --- indra/newview/llviewermedia.cpp | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7c5b360b92..1ad19db4d3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -249,6 +249,7 @@ static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap; static LLTimer sMediaCreateTimer; static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f; static F32 sGlobalVolume = 1.0f; +static F64 sLowestLoadableImplInterest = 0.0f; ////////////////////////////////////////////////////////////////////////////////////////// static void add_media_impl(LLViewerMediaImpl* media) @@ -562,14 +563,20 @@ bool LLViewerMedia::getInWorldMediaDisabled() // static bool LLViewerMedia::isInterestingEnough(const LLUUID &object_id, const F64 &object_interest) { + bool result = false; + if (LLViewerMediaFocus::getInstance()->getFocusedObjectID() == object_id) { - return true; + result = true; } - else { - // XXX HACK - return object_interest > 1023;// INTEREST_THRESHHOLD; + else + { + llinfos << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << llendl; + if(object_interest > sLowestLoadableImplInterest) + result = true; } + + return result; } LLViewerMedia::impl_list &LLViewerMedia::getPriorityList() @@ -697,6 +704,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // Setting max_cpu to 0.0 disables CPU usage checking. bool check_cpu_usage = (max_cpu != 0.0f); + LLViewerMediaImpl* lowest_interest_loadable = NULL; + // Notes on tweakable params: // max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded. // If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow. @@ -783,6 +792,9 @@ void LLViewerMedia::updateMedia(void *dummy_arg) if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED)) { + // This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest. + lowest_interest_loadable = pimpl; + impl_count_total++; } @@ -813,6 +825,21 @@ void LLViewerMedia::updateMedia(void *dummy_arg) total_cpu += pimpl->getCPUUsage(); } + + // Re-calculate this every time. + sLowestLoadableImplInterest = 0.0f; + + if(lowest_interest_loadable) + { + // Get the interest value of this impl's object for use by isInterestingEnough + LLVOVolume *object = lowest_interest_loadable->getSomeObject(); + if(object) + { + // NOTE: Don't use getMediaInterest() here. We want the pixel area, not the total media interest, + // so that we match up with the calculation done in LLMediaDataClient. + sLowestLoadableImplInterest = object->getPixelArea(); + } + } if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug")) { -- cgit v1.2.3 From b877ed17e8d1072ca950cffab355ba4b2480cb09 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Mon, 14 Dec 2009 15:41:09 -0800 Subject: DEV-42327: Compute controls position & size for HUD objects Review #62 Added facility to get the HUD projection and modelview matrices by refactoring the calls in llviewerdisplay a bit. --- indra/newview/llpanelprimmediacontrols.cpp | 32 ++++++++++---- indra/newview/llviewerdisplay.cpp | 70 +++++++++++++++++++----------- 2 files changed, 69 insertions(+), 33 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 3fe51106e4..7b2ac38568 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -57,6 +57,7 @@ #include "llsliderctrl.h" #include "llstring.h" #include "llviewercontrol.h" +#include "llviewerdisplay.h" #include "llviewerparcelmgr.h" #include "llviewermedia.h" #include "llviewermediafocus.h" @@ -66,8 +67,11 @@ #include "llfloatertools.h" // to enable hide if build tools are up +// Functions pulled from pipeline.cpp glh::matrix4f glh_get_current_modelview(); glh::matrix4f glh_get_current_projection(); +// Functions pulled from llviewerdisplay.cpp +bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model); // Warning: make sure these two match! const LLPanelPrimMediaControls::EZoomLevel LLPanelPrimMediaControls::kZoomLevels[] = { ZOOM_NONE, ZOOM_MEDIUM }; @@ -564,9 +568,6 @@ void LLPanelPrimMediaControls::updateShape() // // Calculate position and shape of the controls // - LLVector3 min, max; - - glh::matrix4f mat = glh_get_current_projection()*glh_get_current_modelview(); std::vector::iterator vert_it; std::vector::iterator vert_end; std::vector vect_face; @@ -603,8 +604,18 @@ void LLPanelPrimMediaControls::updateShape() vert_it = vect_face.begin(); vert_end = vect_face.end(); - min = LLVector3(1,1,1); - max = LLVector3(-1,-1,-1); + glh::matrix4f mat; + if (!is_hud) + { + mat = glh_get_current_projection() * glh_get_current_modelview(); + } + else { + glh::matrix4f proj, modelview; + if (get_hud_matrices(proj, modelview)) + mat = proj * modelview; + } + LLVector3 min = LLVector3(1,1,1); + LLVector3 max = LLVector3(-1,-1,-1); for(; vert_it != vert_end; ++vert_it) { // project silhouette vertices into screen space @@ -633,10 +644,15 @@ void LLPanelPrimMediaControls::updateShape() media_controls_rect.mRight += getRect().getWidth() - mMediaRegion->getRect().mRight; // keep all parts of HUD on-screen - media_controls_rect.intersectWith(getParent()->getLocalRect()); + LLRect window_rect = getParent()->getLocalRect(); + media_controls_rect.intersectWith(window_rect); - // clamp to minimum size, keeping centered - media_controls_rect.setCenterAndSize(media_controls_rect.getCenterX(), media_controls_rect.getCenterY(), + // clamp to minimum size, keeping rect inside window + S32 centerX = media_controls_rect.getCenterX(); + S32 centerY = media_controls_rect.getCenterY(); + window_rect.stretch(-mMinWidth/2, -mMinHeight/2); + window_rect.clampPointToRect(centerX, centerY); + media_controls_rect.setCenterAndSize(centerX, centerY, llmax(mMinWidth, media_controls_rect.getWidth()), llmax(mMinHeight, media_controls_rect.getHeight())); setShape(media_controls_rect, true); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 5b733ed817..68a5147bc7 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1009,10 +1009,10 @@ void render_hud_attachments() glh_set_current_modelview(current_mod); } -BOOL setup_hud_matrices() +LLRect get_whole_screen_region() { LLRect whole_screen = gViewerWindow->getWindowRectScaled(); - + // apply camera zoom transform (for high res screenshots) F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); @@ -1024,52 +1024,43 @@ BOOL setup_hud_matrices() int tile_y = sub_region / num_horizontal_tiles; int tile_x = sub_region - (tile_y * num_horizontal_tiles); glh::matrix4f mat; - + whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWindowHeightScaled() - (tile_y * tile_height), tile_width, tile_height); } - - return setup_hud_matrices(whole_screen); + return whole_screen; } -BOOL setup_hud_matrices(const LLRect& screen_region) +bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model) { LLVOAvatar* my_avatarp = gAgent.getAvatarObject(); if (my_avatarp && my_avatarp->hasHUDAttachment()) { F32 zoom_level = gAgent.mHUDCurZoom; LLBBox hud_bbox = my_avatarp->getHUDBBox(); - - // set up transform to keep HUD objects in front of camera - glMatrixMode(GL_PROJECTION); + F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); - glh::matrix4f proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); + proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); proj.element(2,2) = -0.01f; - + F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect(); - + glh::matrix4f mat; F32 scale_x = (F32)gViewerWindow->getWindowWidthScaled() / (F32)screen_region.getWidth(); F32 scale_y = (F32)gViewerWindow->getWindowHeightScaled() / (F32)screen_region.getHeight(); mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f)); mat.set_translate( glh::vec3f(clamp_rescale((F32)screen_region.getCenterX(), 0.f, (F32)gViewerWindow->getWindowWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio), - clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeightScaled(), 0.5f * scale_y, -0.5f * scale_y), - 0.f)); + clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeightScaled(), 0.5f * scale_y, -0.5f * scale_y), + 0.f)); proj *= mat; - - glLoadMatrixf(proj.m); - glh_set_current_projection(proj); - - glMatrixMode(GL_MODELVIEW); - glh::matrix4f model((GLfloat*) OGL_TO_CFR_ROTATION); + + glh::matrix4f tmp_model((GLfloat*) OGL_TO_CFR_ROTATION); mat.set_scale(glh::vec3f(zoom_level, zoom_level, zoom_level)); mat.set_translate(glh::vec3f(-hud_bbox.getCenterLocal().mV[VX] + (hud_depth * 0.5f), 0.f, 0.f)); - - model *= mat; - glLoadMatrixf(model.m); - glh_set_current_modelview(model); - + + tmp_model *= mat; + model = tmp_model; return TRUE; } else @@ -1078,6 +1069,35 @@ BOOL setup_hud_matrices(const LLRect& screen_region) } } +bool get_hud_matrices(glh::matrix4f &proj, glh::matrix4f &model) +{ + LLRect whole_screen = get_whole_screen_region(); + return get_hud_matrices(whole_screen, proj, model); +} + +BOOL setup_hud_matrices() +{ + LLRect whole_screen = get_whole_screen_region(); + return setup_hud_matrices(whole_screen); +} + +BOOL setup_hud_matrices(const LLRect& screen_region) +{ + glh::matrix4f proj, model; + bool result = get_hud_matrices(screen_region, proj, model); + if (!result) return result; + + // set up transform to keep HUD objects in front of camera + glMatrixMode(GL_PROJECTION); + glLoadMatrixf(proj.m); + glh_set_current_projection(proj); + + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf(model.m); + glh_set_current_modelview(model); + return TRUE; +} + static LLFastTimer::DeclareTimer FTM_SWAP("Swap"); void render_ui(F32 zoom_factor, int subfield) -- cgit v1.2.3 From 7a7562724d43c235ee0c38534485dd144088ac0b Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Mon, 14 Dec 2009 15:47:57 -0800 Subject: follow-up from my last change --- indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index b4f72a48bc..5a032c6815 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -9,7 +9,7 @@ width="800"> Inspector_Background 0.2 - 400 + 300 120 1.0 1.25 -- cgit v1.2.3 From 909a16e5200462285813abfa293a8001c684093a Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Mon, 14 Dec 2009 16:22:37 -0800 Subject: DEV-43913: tweak positions of play & pause so they look like they are the same button --- indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 5a032c6815..bffb28d16e 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -190,7 +190,7 @@ layout="topleft" top="14" min_width="22" - width="22"> + width="24">