本文整理汇总了C++中LLPointer::setBoostLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPointer::setBoostLevel方法的具体用法?C++ LLPointer::setBoostLevel怎么用?C++ LLPointer::setBoostLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPointer
的用法示例。
在下文中一共展示了LLPointer::setBoostLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: llformat
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
{
// Get the grid coordinates
// <FS:CR> HG Maps
#ifdef OPENSIM
std::string hg_map;
if (LLGridManager::getInstance()->isInOpenSim())
{
hg_map = LFSimFeatureHandler::instance().mapServerURL();
}
std::string imageurl = hg_map.empty() ? gSavedSettings.getString("CurrentMapServerURL") : hg_map;
imageurl.append(llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y));
#else // !OPENSIM
std::string imageurl = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
#endif // OPENSIM
// </FS:CR>
// DO NOT COMMIT!! DEBUG ONLY!!!
// Use a local jpeg for every tile to test map speed without S3 access
//imageurl = "file://C:\\Develop\\mapserver-distribute-3\\indra\\build-vc80\\mapserver\\relwithdebinfo\\regions\\00995\\01001\\region-995-1001-prims.jpg";
// END DEBUG
//LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
img->setBoostLevel(LLGLTexture::BOOST_MAP);
// Return the smart pointer
return img;
}
示例2: equalizeBoostLevels
// This method should be called before each use of the mipmap (typically, before each draw), so that to let
// the boost level of unused tiles to drop to 0 (BOOST_NONE).
// Tiles that are accessed have had their boost level pushed to BOOST_MAP_VISIBLE so we can identify them.
// The result of this strategy is that if a tile is not used during 2 consecutive loops, its boost level drops to 0.
void LLWorldMipmap::equalizeBoostLevels()
{
#if DEBUG_TILES_STAT
S32 nb_missing = 0;
S32 nb_tiles = 0;
S32 nb_visible = 0;
#endif // DEBUG_TILES_STAT
// For each level
for (S32 level = 0; level < MAP_LEVELS; level++)
{
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
// For each tile
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
{
LLPointer<LLViewerFetchedTexture> img = iter->second;
S32 current_boost_level = img->getBoostLevel();
if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
{
// If level was BOOST_MAP_VISIBLE, the tile has been used in the last draw so keep it high
img->setBoostLevel(LLGLTexture::BOOST_MAP);
}
else
{
// If level was BOOST_MAP only (or anything else...), the tile wasn't used in the last draw
// so we drop its boost level to BOOST_NONE.
img->setBoostLevel(LLGLTexture::BOOST_NONE);
}
#if DEBUG_TILES_STAT
// Increment some stats if compile option on
nb_tiles++;
if (current_boost_level == LLGLTexture::BOOST_MAP_VISIBLE)
{
nb_visible++;
}
if (img->isMissingAsset())
{
nb_missing++;
}
#endif // DEBUG_TILES_STAT
}
}
#if DEBUG_TILES_STAT
LL_INFOS("World Map") << "LLWorldMipmap tile stats : total requested = " << nb_tiles << ", visible = " << nb_visible << ", missing = " << nb_missing << LL_ENDL;
#endif // DEBUG_TILES_STAT
}
示例3: getImageFromUrl
LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url,
BOOL usemipmaps,
LLViewerTexture::EBoostLevel boost_priority,
S8 texture_type,
LLGLint internal_format,
LLGLenum primary_format,
const LLUUID& force_id)
{
// generate UUID based on hash of filename
LLUUID new_id;
if (force_id.notNull())
{
new_id = force_id;
}
else
{
new_id.generate(url);
}
LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id);
if (imagep.isNull())
{
switch(texture_type)
{
case LLViewerTexture::FETCHED_TEXTURE:
imagep = new LLViewerFetchedTexture(url, new_id, usemipmaps);
break ;
case LLViewerTexture::LOD_TEXTURE:
imagep = new LLViewerLODTexture(url, new_id, usemipmaps);
break ;
default:
llerrs << "Invalid texture type " << texture_type << llendl ;
}
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI ||
boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
imagep->dontDiscard();
}
imagep->setBoostLevel(boost_priority);
}
}
imagep->setGLTextureCreated(true);
return imagep;
}
示例4: convertGridToHandle
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load)
{
// Check the input data
llassert(level <= MAP_LEVELS);
llassert(level >= 1);
// If the *loading* level changed, cleared the new level from "missed" tiles
// so that we get a chance to reload them
if (load && (level != mCurrentLevel))
{
cleanMissedTilesFromLevel(level);
mCurrentLevel = level;
}
// Build the region handle
U64 handle = convertGridToHandle(grid_x, grid_y);
// Check if the image is around already
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
sublevel_tiles_t::iterator found = level_mipmap.find(handle);
// If not there and load on, go load it
if (found == level_mipmap.end())
{
if (load)
{
// Load it
LLPointer<LLViewerFetchedTexture> img = loadObjectsTile(grid_x, grid_y, level);
// Insert the image in the map
level_mipmap.insert(sublevel_tiles_t::value_type( handle, img ));
// Find the element again in the map (it's there now...)
found = level_mipmap.find(handle);
}
else
{
// Return with NULL if not found and we're not trying to load
return NULL;
}
}
// Get the image pointer and check if this asset is missing
LLPointer<LLViewerFetchedTexture> img = found->second;
if (img->isMissingAsset())
{
// Return NULL if asset missing
return NULL;
}
else
{
// Boost the tile level so to mark it's in use *if* load on
if (load)
{
img->setBoostLevel(LLGLTexture::BOOST_MAP_VISIBLE);
}
return img;
}
}
示例5: llformat
// public static
LLPointer<LLViewerImage> LLWorldMap::loadObjectsTile(U32 grid_x, U32 grid_y)
{
// Get the grid coordinates
std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", 1, grid_x, grid_y);
LLPointer<LLViewerImage> img = gImageList.getImageFromUrl(imageurl);
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP);
// Return the smart pointer
return img;
}
示例6: getImageFromFile
LLViewerImage* LLViewerImageList::getImageFromFile(const std::string& filename,
BOOL usemipmaps,
BOOL level_immediate,
LLGLint internal_format,
LLGLenum primary_format,
const LLUUID& force_id)
{
if (gNoRender)
{
// Never mind that this ignores image_set_id;
// getImage() will handle that later.
return getImage(IMG_DEFAULT, TRUE, TRUE);
}
std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename);
if (full_path.empty())
{
llwarns << "Failed to find local image file: " << filename << llendl;
return getImage(IMG_DEFAULT, TRUE, TRUE);
}
// generate UUID based on hash of filename
LLUUID new_id;
if (force_id.notNull())
{
new_id = force_id;
}
else
{
new_id.generate(full_path);
}
LLPointer<LLViewerImage> imagep = hasImage(new_id);
if (imagep.isNull())
{
imagep = new LLViewerImage(full_path, new_id, usemipmaps);
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (level_immediate)
{
imagep->dontDiscard();
imagep->setBoostLevel(LLViewerImage::BOOST_UI);
}
}
return imagep;
}
示例7: llformat
// public static
LLPointer<LLViewerFetchedTexture> LLWorldMap::loadObjectsTile(U32 grid_x, U32 grid_y)
{
// Get the grid coordinates
std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", 1, grid_x, grid_y);
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl,TRUE,LLViewerTexture::BOOST_MAP,LLViewerTexture::LOD_TEXTURE);
img->setBoostLevel(LLViewerTexture::BOOST_MAP);
// Return the smart pointer
return img;
}
示例8: dropBoostLevels
// This method should be used when the mipmap is not actively used for a while, e.g., the map UI is hidden
void LLWorldMipmap::dropBoostLevels()
{
// For each level
for (S32 level = 0; level < MAP_LEVELS; level++)
{
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level];
// For each tile
for (sublevel_tiles_t::iterator iter = level_mipmap.begin(); iter != level_mipmap.end(); iter++)
{
LLPointer<LLViewerFetchedTexture> img = iter->second;
img->setBoostLevel(LLGLTexture::BOOST_NONE);
}
}
}
示例9: getImageFromUrl
LLViewerImage* LLViewerImageList::getImageFromUrl(const std::string& url,
BOOL usemipmaps,
BOOL level_immediate,
LLGLint internal_format,
LLGLenum primary_format,
const LLUUID& force_id)
{
if (gNoRender)
{
// Never mind that this ignores image_set_id;
// getImage() will handle that later.
return getImage(IMG_DEFAULT, TRUE, TRUE);
}
// generate UUID based on hash of filename
LLUUID new_id;
if (force_id.notNull())
{
new_id = force_id;
}
else
{
new_id.generate(url);
}
LLPointer<LLViewerImage> imagep = hasImage(new_id);
if (imagep.isNull())
{
imagep = new LLViewerImage(url, new_id, usemipmaps);
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (level_immediate)
{
imagep->dontDiscard();
imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
}
}
imagep->setGLTextureCreated(true);
return imagep;
}
示例10: getImage
LLViewerImage* LLViewerImageList::getImage(const LLUUID &image_id,
BOOL usemipmaps,
BOOL level_immediate,
LLGLint internal_format,
LLGLenum primary_format,
LLHost request_from_host)
{
// Return the image with ID image_id
// If the image is not found, creates new image and
// enqueues a request for transmission
if ((&image_id == NULL) || image_id.isNull())
{
return (getImage(IMG_DEFAULT, TRUE, TRUE));
}
LLPointer<LLViewerImage> imagep = hasImage(image_id);
if (imagep.isNull())
{
imagep = new LLViewerImage(image_id, request_from_host, usemipmaps);
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (level_immediate)
{
imagep->dontDiscard();
imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI);
}
else
{
//by default, the texure can not be removed from memory even if it is not used.
//here turn this off
//if this texture should be set to NO_DELETE, either pass level_immediate == TRUE here, or call setNoDelete() afterwards.
imagep->forceActive() ;
}
}
imagep->setGLTextureCreated(true);
return imagep;
}
示例11: createImage
//when this function is called, there is no such texture in the gTextureList with image_id.
LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id,
BOOL usemipmaps,
LLViewerTexture::EBoostLevel boost_priority,
S8 texture_type,
LLGLint internal_format,
LLGLenum primary_format,
LLHost request_from_host)
{
LLPointer<LLViewerFetchedTexture> imagep ;
switch(texture_type)
{
case LLViewerTexture::FETCHED_TEXTURE:
imagep = new LLViewerFetchedTexture(image_id, request_from_host, usemipmaps);
break ;
case LLViewerTexture::LOD_TEXTURE:
imagep = new LLViewerLODTexture(image_id, request_from_host, usemipmaps);
break ;
default:
llerrs << "Invalid texture type " << texture_type << llendl ;
}
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (boost_priority != 0)
{
if (boost_priority == LLViewerFetchedTexture::BOOST_UI ||
boost_priority == LLViewerFetchedTexture::BOOST_ICON)
{
imagep->dontDiscard();
}
imagep->setBoostLevel(boost_priority);
}
else
{
//by default, the texture can not be removed from memory even if it is not used.
//here turn this off
//if this texture should be set to NO_DELETE, call setNoDelete() afterwards.
imagep->forceActive() ;
}
return imagep ;
}
示例12: llformat
LLPointer<LLViewerFetchedTexture> LLWorldMipmap::loadObjectsTile(U32 grid_x, U32 grid_y, S32 level)
{
// Get the grid coordinates
std::string imageurl = gSavedSettings.getString("MapServerURL") + llformat("map-%d-%d-%d-objects.jpg", level, grid_x, grid_y);
// DO NOT COMMIT!! DEBUG ONLY!!!
// Use a local jpeg for every tile to test map speed without S3 access
//imageurl = "file://C:\\Develop\\mapserver-distribute-3\\indra\\build-vc80\\mapserver\\relwithdebinfo\\regions\\00995\\01001\\region-995-1001-prims.jpg";
// END DEBUG
//LL_INFOS("World Map") << "LLWorldMipmap::loadObjectsTile(), URL = " << imageurl << LL_ENDL;
LLPointer<LLViewerFetchedTexture> img = LLViewerTextureManager::getFetchedTextureFromUrl(imageurl, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
img->setBoostLevel(LLGLTexture::BOOST_MAP);
// Return the smart pointer
return img;
}
示例13: getImage
LLViewerImage* LLViewerImageList::getImage(const LLUUID &image_id,
BOOL usemipmaps,
BOOL level_immediate,
LLGLint internal_format,
LLGLenum primary_format,
LLHost request_from_host)
{
// Return the image with ID image_id
// If the image is not found, creates new image and
// enqueues a request for transmission
if ((&image_id == NULL) || image_id.isNull())
{
return (getImage(IMG_DEFAULT, TRUE, TRUE));
}
LLPointer<LLViewerImage> imagep = hasImage(image_id);
if (imagep.isNull())
{
imagep = new LLViewerImage(image_id, usemipmaps);
// Might want to request from host other than where the agent is. JC
imagep->setTargetHost(request_from_host);
if (internal_format && primary_format)
{
imagep->setExplicitFormat(internal_format, primary_format);
}
addImage(imagep);
if (level_immediate)
{
imagep->dontDiscard();
imagep->setBoostLevel(LLViewerImage::BOOST_UI);
}
}
return imagep;
}
示例14: draw
// virtual
void LLFloaterTexturePicker::draw()
{
if (mOwner)
{
// draw cone of context pointing back to texture swatch
LLRect owner_rect;
mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this);
LLRect local_rect = getLocalRect();
if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f)
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLEnable(GL_CULL_FACE);
gGL.begin(LLRender::QUADS);
{
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
gGL.vertex2i(local_rect.mRight, local_rect.mTop);
gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
gGL.vertex2i(local_rect.mRight, local_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
}
gGL.end();
}
}
if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
}
else
{
mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
}
updateImageStats();
// if we're inactive, gray out "apply immediate" checkbox
childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
childSetEnabled("Select", mActive);
childSetEnabled("Pipette", mActive);
childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
//RN: reset search bar to reflect actual search query (all caps, for example)
mSearchEdit->setText(mInventoryPanel->getFilterSubString());
//BOOL allow_copy = FALSE;
if( mOwner )
{
mTexturep = NULL;
if(mImageAssetID.notNull())
{
mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO);
mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW);
}
else if (!mFallbackImageName.empty())
{
mTexturep = gImageList.getImageFromFile(mFallbackImageName);
mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW);
}
if (mTentativeLabel)
{
mTentativeLabel->setVisible( FALSE );
}
childSetEnabled("Default", mImageAssetID != mOwner->getDefaultImageAssetID());
childSetEnabled("Blank", mImageAssetID != mWhiteImageAssetID );
childSetEnabled("Invisible", mOwner->getAllowInvisibleTexture() && mImageAssetID != mInvisibleImageAssetID );
childSetEnabled("Alpha", mImageAssetID != mAlphaImageAssetID );
childSetEnabled("CpToInv", !mImageAssetID.isNull() );
LLFloater::draw();
if( isMinimized() )
{
return;
}
//.........这里部分代码省略.........
示例15: convertGridToHandle
LLPointer<LLViewerImage> LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load)
{
// Check the input data
llassert(level <= MAP_LEVELS);
llassert(level >= 1);
// If the *loading* level changed, cleared the new level from "missed" tiles
// so that we get a chance to reload them
if (load && (level != mCurrentLevel))
{
cleanMissedTilesFromLevel(level);
mCurrentLevel = level;
}
// Build the region handle
U64 handle = convertGridToHandle(grid_x, grid_y);
// Check if the image is around already
sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
sublevel_tiles_t::iterator found = level_mipmap.find(handle);
// If not there and load on, go load it
if (found == level_mipmap.end())
{
if (load)
{
// Load it
LLPointer<LLViewerImage> img;
// <edit>
//this is a hack for opensims.
if(LLViewerLogin::getInstance()->getGridChoice() < GRID_INFO_OTHER)
img = loadObjectsTile(grid_x, grid_y, level);
else
{
LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromHandle(handle);
if(info)
{
img = gImageList.getImage(info->getMapImageID(), MIPMAP_TRUE, FALSE);
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP);
}
else
return NULL;
}
// </edit>
// Insert the image in the map
level_mipmap.insert(sublevel_tiles_t::value_type( handle, img ));
// Find the element again in the map (it's there now...)
found = level_mipmap.find(handle);
}
else
{
// Return with NULL if not found and we're not trying to load
return NULL;
}
}
// Get the image pointer and check if this asset is missing
LLPointer<LLViewerImage> img = found->second;
if (img->isMissingAsset())
{
// Return NULL if asset missing
return NULL;
}
else
{
// Boost the tile level so to mark it's in use *if* load on
if (load)
{
img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAP_VISIBLE);
}
return img;
}
}