Huge renderer update (WIP). Still plenty to do, especially pertaining to UI.

-Nametag bubble visbility is oddly inconsistent. May vanish with future planned UI merges...
-VBOs are PAINFULLY slow on ATI hardware. This repos self-compiled davep/shining-fixes branch, so I'll leave the ball in LL's court for now regarding that.
This commit is contained in:
Shyotl
2011-12-09 14:02:29 -06:00
parent 8e7733b2ce
commit ffb285c6ff
499 changed files with 22321 additions and 12356 deletions

View File

@@ -515,6 +515,7 @@ LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id)
void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
{
llassert_always(mInitialized) ;
llassert(image);
if (image->isInImageList())
{
@@ -530,6 +531,7 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image)
void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)
{
llassert_always(mInitialized) ;
llassert(image);
if (!image->isInImageList())
{
@@ -1366,7 +1368,8 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority)
const BOOL use_mips = FALSE;
const LLRect scale_rect = LLRect::null;
return loadUIImageByID(image_id, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority);
const LLRect clip_rect = LLRect::null;
return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
}
LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority)
@@ -1380,32 +1383,33 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori
const BOOL use_mips = FALSE;
const LLRect scale_rect = LLRect::null;
return loadUIImageByName(image_name, image_name, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority);
const LLRect clip_rect = LLRect::null;
return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
}
LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename,
BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority )
BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority )
{
if (boost_priority == LLViewerTexture::BOOST_NONE)
{
boost_priority = LLViewerTexture::BOOST_UI;
}
LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority);
return loadUIImage(imagep, name, use_mips, scale_rect);
return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect);
}
LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id,
BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority)
BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority)
{
if (boost_priority == LLViewerTexture::BOOST_NONE)
{
boost_priority = LLViewerTexture::BOOST_UI;
}
LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority);
return loadUIImage(imagep, id.asString(), use_mips, scale_rect);
return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect);
}
LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect)
LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect)
{
if (!imagep) return NULL;
@@ -1426,13 +1430,14 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st
LLUIImageLoadData* datap = new LLUIImageLoadData;
datap->mImageName = name;
datap->mImageScaleRegion = scale_rect;
datap->mImageClipRegion = clip_rect;
imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL);
}
return new_imagep;
}
LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect)
LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect)
{
// look for existing image
uuid_ui_image_map_t::iterator found_it = mUIImages.find(name);
@@ -1442,7 +1447,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s
llerrs << "UI Image " << name << " already loaded." << llendl;
}
return loadUIImageByName(name, filename, use_mips, scale_rect);
return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect);
}
//static
@@ -1456,6 +1461,7 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v
LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data;
std::string ui_image_name = image_datap->mImageName;
LLRect scale_rect = image_datap->mImageScaleRegion;
LLRect clip_rect = image_datap->mImageClipRegion;
if (final)
{
delete image_datap;
@@ -1472,9 +1478,21 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v
// from power-of-2 gl image
if (success && imagep.notNull() && src_vi && (src_vi->getUrl().compare(0, 7, "file://")==0))
{
F32 clip_x = (F32)src_vi->getOriginalWidth() / (F32)src_vi->getFullWidth();
F32 clip_y = (F32)src_vi->getOriginalHeight() / (F32)src_vi->getFullHeight();
imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
F32 full_width = (F32)src_vi->getFullWidth();
F32 full_height = (F32)src_vi->getFullHeight();
F32 clip_x = (F32)src_vi->getOriginalWidth() / full_width;
F32 clip_y = (F32)src_vi->getOriginalHeight() / full_height;
if (clip_rect != LLRect::null)
{
imagep->setClipRegion(LLRectf(llclamp((F32)clip_rect.mLeft / full_width, 0.f, 1.f),
llclamp((F32)clip_rect.mTop / full_height, 0.f, 1.f),
llclamp((F32)clip_rect.mRight / full_width, 0.f, 1.f),
llclamp((F32)clip_rect.mBottom / full_height, 0.f, 1.f)));
}
else
{
imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
}
if (scale_rect != LLRect::null)
{
imagep->setScaleRegion(
@@ -1484,7 +1502,7 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v
llclamp((F32)scale_rect.mBottom / (F32)imagep->getHeight(), 0.f, 1.f)));
}
//imagep->onImageLoaded();
imagep->onImageLoaded();
}
}
}
@@ -1703,7 +1721,7 @@ bool LLUIImageList::initFromFile()
child_nodep->getAttributeS32("scale_bottom", scale_rect.mBottom);
child_nodep->getAttributeS32("scale_top", scale_rect.mTop);
preloadUIImage(image_name, file_name, use_mip_maps, scale_rect);
preloadUIImage(image_name, file_name, use_mip_maps, scale_rect, LLRectBase<S32>::null);
child_nodep = child_nodep->getNextSibling();
}