diff options
8 files changed, 119 insertions, 50 deletions
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<LLVector3>::iterator vert_it; std::vector<LLVector3>::iterator vert_end; std::vector<LLVector3> 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) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7c5b360b92..367c0c8343 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,22 @@ void LLViewerMedia::updateMedia(void *dummy_arg) total_cpu += pimpl->getCPUUsage(); } + + // Re-calculate this every time. + sLowestLoadableImplInterest = 0.0f; + + // Only do this calculation if we've hit the impl count limit -- up until that point we always need to load media data. + if(lowest_interest_loadable && (impl_count_total >= (int)max_instances)) + { + // 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")) { diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 10b72144e7..1239152c32 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -1561,7 +1561,7 @@ Only large parcels can be listed in search. left="10" name="at URL:" width="100"> - Home URL: + Home Page: </text> <line_editor follows="left|top" @@ -1590,7 +1590,7 @@ Only large parcels can be listed in search. left="10" name="CurrentURL:" width="100"> - Current URL: + Current Page: </text> <button follows="top|right" diff --git a/indra/newview/skins/default/xui/en/floater_media_browser.xml b/indra/newview/skins/default/xui/en/floater_media_browser.xml index d6b20c8015..4b280ac59f 100644 --- a/indra/newview/skins/default/xui/en/floater_media_browser.xml +++ b/indra/newview/skins/default/xui/en/floater_media_browser.xml @@ -171,7 +171,7 @@ enabled="false" follows="left|top" height="20" - label="Send Current URL to Parcel" + label="Send Current Page to Parcel" layout="topleft" left="0" name="assign" diff --git a/indra/newview/skins/default/xui/en/panel_media_settings_general.xml b/indra/newview/skins/default/xui/en/panel_media_settings_general.xml index c8ec515e6d..5217ab3571 100644 --- a/indra/newview/skins/default/xui/en/panel_media_settings_general.xml +++ b/indra/newview/skins/default/xui/en/panel_media_settings_general.xml @@ -17,7 +17,7 @@ height="15" left="10" name="home_label"> - Home URL: + Home Page: </text> <text visible="false" @@ -27,7 +27,7 @@ left_delta="64" text_color="red" name="home_fails_whitelist_label"> - (This URL does not pass the specified whitelist) + (This page does not pass the specified whitelist) </text> <line_editor bottom_delta="-24" @@ -37,7 +37,7 @@ height="20" left="10" name="home_url" - tool_tip="The home URL for this media source" + tool_tip="The home page for this media source" width="340"> <!-- <line_editor.commit_callback function="Media.CommitHomeURL"/> --> @@ -69,7 +69,7 @@ height="15" left="10" name="current_url_label"> - Current URL: + Current Page: </text> <text bottom_delta="-20" @@ -79,7 +79,7 @@ height="20" left="10" name="current_url" - tool_tip="The current URL for this media source" + tool_tip="The current page for this media source" value="" width="340" /> <button diff --git a/indra/newview/skins/default/xui/en/panel_media_settings_security.xml b/indra/newview/skins/default/xui/en/panel_media_settings_security.xml index 6e82713f06..1f41a0d284 100644 --- a/indra/newview/skins/default/xui/en/panel_media_settings_security.xml +++ b/indra/newview/skins/default/xui/en/panel_media_settings_security.xml @@ -48,7 +48,7 @@ bottom_delta="0" text_color="0.4 0.4 0.4 1.0" name="home_url_fails_some_items_in_whitelist"> - Entries that the home URL fails against are marked: + Entries that the home page fails against are marked: </text> <button bottom_delta="-36" @@ -82,7 +82,7 @@ left="30" text_color="0.6 0.0 0.0 1.0" name="home_url_fails_whitelist"> -Warning: the home URL specified in the General tab +Warning: the home page specified in the General tab fails to pass this whitelist. It has been disabled until a valid entry has been added. </text> 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..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 @@ -9,7 +9,7 @@ width="800"> <string name="control_background_image_name">Inspector_Background</string> <string name="skip_step">0.2</string> - <string name="min_width">400</string> + <string name="min_width">300</string> <string name="min_height">120</string> <string name="zoom_near_padding">1.0</string> <string name="zoom_medium_padding">1.25</string> @@ -190,7 +190,7 @@ layout="topleft" top="14" min_width="22" - width="22"> + width="24"> <button image_overlay="Play_Off" image_disabled="PushButton_Disabled" @@ -200,6 +200,8 @@ hover_glow_amount="0.15" layout="topleft" tool_tip = "Play media" + left_delta="2" + top="4" height="22" min_width="22" width="22"> @@ -214,7 +216,7 @@ layout="topleft" top="18" min_width="22" - width="22"> + width="24"> <button image_overlay="Pause_Off" image_disabled="PushButton_Disabled" @@ -224,6 +226,9 @@ hover_glow_amount="0.15" layout="topleft" height="22" + width="22" + left_delta="-1" + top="4" tool_tip = "Pause media"> <button.commit_callback function="MediaCtrl.Pause" /> |