本文整理汇总了C++中LLViewerFetchedTexture类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerFetchedTexture类的具体用法?C++ LLViewerFetchedTexture怎么用?C++ LLViewerFetchedTexture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerFetchedTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_texture_list_name
void LLViewerTextureList::doPrefetchImages()
{
if (LLAppViewer::instance()->getPurgeCache())
{
// cache was purged, no point
return;
}
// Pre-fetch textures from last logout
LLSD imagelist;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
llifstream file;
file.open(filename);
if (file.is_open())
{
LLSDSerialize::fromXML(imagelist, file);
}
for (LLSD::array_iterator iter = imagelist.beginArray();
iter != imagelist.endArray(); ++iter)
{
LLSD imagesd = *iter;
LLUUID uuid = imagesd["uuid"];
S32 pixel_area = imagesd["area"];
S32 texture_type = imagesd["type"];
if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type)
{
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, texture_type);
if (image)
{
image->addTextureStats((F32)pixel_area);
}
}
}
}
示例2: DelBitmap
void LocalAssetBrowser::DelBitmap( std::vector<LLScrollListItem*> delete_vector, S32 column )
{
bool change_happened = false;
for( std::vector<LLScrollListItem*>::iterator list_iter = delete_vector.begin();
list_iter != delete_vector.end(); list_iter++ )
{
LLScrollListItem* list_item = *list_iter;
if ( list_item )
{
LLUUID id = list_item->getColumn(column)->getValue().asUUID();
for (local_list_iter iter = loaded_bitmaps.begin();
iter != loaded_bitmaps.end();)
{
if ((*iter).getID() == id)
{
LLViewerFetchedTexture* image = gTextureList.findImage(id);
gTextureList.deleteImage( image );
image->unref();
iter = loaded_bitmaps.erase(iter);
change_happened = true;
}
else
++iter;
}
}
}
if (change_happened) onChangeHappened();
}
示例3: t
F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
{
if (gNoRender || gGLManager.mIsDisabled) return 0.0f;
//
// Create GL textures for all textures that need them (images which have been
// decoded, but haven't been pushed into GL).
//
LLFastTimer t(LLFastTimer::FTM_IMAGE_CREATE);
LLTimer create_timer;
image_list_t::iterator enditer = mCreateTextureList.begin();
for (image_list_t::iterator iter = mCreateTextureList.begin();
iter != mCreateTextureList.end();)
{
image_list_t::iterator curiter = iter++;
enditer = iter;
LLViewerFetchedTexture *imagep = *curiter;
imagep->createTexture();
if (create_timer.getElapsedTimeF32() > max_time)
{
break;
}
}
mCreateTextureList.erase(mCreateTextureList.begin(), enditer);
return create_timer.getElapsedTimeF32();
}
示例4: asctime
/* [maintenence functions] */
void LocalBitmap::updateSelf()
{
if ( this->linkstatus == LINK_ON || this->linkstatus == LINK_UPDATING )
{
/* making sure file still exists */
if ( !gDirUtilp->fileExists(this->filename) ) { this->linkstatus = LINK_BROKEN; return; }
/* exists, let's check if it's lastmod has changed */
llstat temp_stat;
LLFile::stat(this->filename, &temp_stat);
std::time_t temp_time = temp_stat.st_mtime;
LLSD new_last_modified = asctime( localtime(&temp_time) );
if ( this->last_modified.asString() == new_last_modified.asString() ) { return; }
/* here we update the image */
LLImageRaw* new_imgraw = new LLImageRaw();
if ( !decodeSelf(new_imgraw) ) { this->linkstatus = LINK_UPDATING; return; }
else { this->linkstatus = LINK_ON; }
LLViewerFetchedTexture* image = gTextureList.findImage(this->id);
if (!image->forSculpt())
{ image->createGLTexture( LOCAL_DISCARD_LEVEL, new_imgraw ); }
else
{ image->setCachedRawImage(-1,new_imgraw); }
/* finalizing by updating lastmod to current */
this->last_modified = new_last_modified;
/* setting unit property to reflect that it has been changed */
switch (this->bitmap_type)
{
case TYPE_TEXTURE:
{ break; }
case TYPE_SCULPT:
{
/* sets a bool to run through all visible sculpts in one go, and update the ones necessary. */
this->sculpt_dirty = true;
this->volume_dirty = true;
gLocalBrowser->setSculptUpdated( true );
break;
}
case TYPE_LAYER:
{
/* sets a bool to rebake layers after the iteration is done with */
gLocalBrowser->setLayerUpdated( true );
break;
}
default:
{ break; }
}
}
}
示例5: updateImagesDecodePriorities
void LLViewerTextureList::updateImages(F32 max_time)
{
LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec());
S32 global_raw_memory;
{
global_raw_memory = *AIAccess<S32>(LLImageRaw::sGlobalRawMemory);
}
sNumImagesStat.addValue(sNumImages);
sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
sGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes));
sGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes));
sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(global_raw_memory));
sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory));
updateImagesDecodePriorities();
F32 total_max_time = max_time;
max_time -= updateImagesFetchTextures(max_time);
max_time = llmax(max_time, total_max_time*.50f); // at least 50% of max_time
max_time -= updateImagesCreateTextures(max_time);
if (!mDirtyTextureList.empty())
{
LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY);
gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
mDirtyTextureList.clear();
}
bool didone = false;
for (image_list_t::iterator iter = mCallbackList.begin();
iter != mCallbackList.end(); )
{
//trigger loaded callbacks on local textures immediately
LLViewerFetchedTexture* image = *iter++;
if (!image->getUrl().empty())
{
// Do stuff to handle callbacks, update priorities, etc.
didone = image->doLoadedCallbacks();
}
else if (!didone)
{
// Do stuff to handle callbacks, update priorities, etc.
didone = image->doLoadedCallbacks();
}
}
//Required for old media system
if (!gNoRender && !gGLManager.mIsDisabled)
{
LLViewerMedia::updateMedia();
}
updateImagesUpdateStats();
}
示例6: updateImagesUpdateStats
void LLViewerTextureList::updateImagesUpdateStats()
{
if (mUpdateStats && mForceResetTextureStats)
{
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); )
{
LLViewerFetchedTexture* imagep = *iter++;
imagep->resetTextureStats();
}
mUpdateStats = FALSE;
mForceResetTextureStats = FALSE;
}
}
示例7: stop_bakes
// virtual
LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp )
{
// suppress texlayerset updates while wearables are being imported. Layersets will be updated
// when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed.
LLOverrideBakedTextureUpdate stop_bakes(false);
LLWearable::EImportResult result = LLWearable::importStream(input_stream, avatarp);
if (LLWearable::FAILURE == result) return result;
if (LLWearable::BAD_HEADER == result)
{
// Shouldn't really log the asset id for security reasons, but
// we need it in this case.
llwarns << "Bad Wearable asset header: " << mAssetID << llendl;
//gVFS->dumpMap();
return result;
}
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
te_map_t::const_iterator iter = mTEMap.begin();
te_map_t::const_iterator end = mTEMap.end();
for (; iter != end; ++iter)
{
S32 te = iter->first;
LLLocalTextureObject* lto = iter->second;
LLUUID textureid = LLUUID::null;
if (lto)
{
textureid = lto->getID();
}
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid );
if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
{
image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL);
}
}
return result;
}
示例8: download
// static
void LLInventoryBackup::download(LLInventoryItem* item, LLFloater* floater, loaded_callback_func onImage, LLGetAssetCallback onAsset)
{
LLInventoryBackup::callbackdata* userdata = new LLInventoryBackup::callbackdata();
userdata->floater = floater;
userdata->item = item;
LLViewerFetchedTexture* imagep;
switch(item->getType())
{
case LLAssetType::AT_TEXTURE:
imagep = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID(), MIPMAP_TRUE, LLViewerTexture::BOOST_UI);
imagep->setLoadedCallback( onImage, 0, TRUE, FALSE, userdata, NULL ); // was setLoadedCallbackNoAuth
break;
case LLAssetType::AT_NOTECARD:
case LLAssetType::AT_SCRIPT:
case LLAssetType::AT_LSL_TEXT: // normal script download
case LLAssetType::AT_LSL_BYTECODE:
gAssetStorage->getInvItemAsset(LLHost::invalid,
gAgent.getID(),
gAgent.getSessionID(),
item->getPermissions().getOwner(),
LLUUID::null,
item->getUUID(),
item->getAssetUUID(),
item->getType(),
onAsset,
userdata, // user_data
TRUE);
break;
case LLAssetType::AT_SOUND:
case LLAssetType::AT_CLOTHING:
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_ANIMATION:
case LLAssetType::AT_GESTURE:
default:
gAssetStorage->getAssetData(item->getAssetUUID(), item->getType(), onAsset, userdata, TRUE);
break;
}
}
示例9: LL_DEBUGS
void LLViewerTextureList::doPreloadImages()
{
LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL;
// Set the "missing asset" image
LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
// Set the "white" image
LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
LLUIImageList* image_list = LLUIImageList::getInstance();
image_list->initFromFile();
// turn off clamping and bilinear filtering for uv picking images
//LLViewerFetchedTexture* uv_test = preloadUIImage("uv_test1.tga", LLUUID::null, FALSE);
//uv_test->setClamp(FALSE, FALSE);
//uv_test->setMipFilterNearest(TRUE, TRUE);
//uv_test = preloadUIImage("uv_test2.tga", LLUUID::null, FALSE);
//uv_test->setClamp(FALSE, FALSE);
//uv_test->setMipFilterNearest(TRUE, TRUE);
// prefetch specific UUIDs
LLViewerTextureManager::getFetchedTexture(IMG_SHOT, TRUE);
LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF, TRUE);
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
if (image)
{
image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image);
}
image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
if (image)
{
image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image);
}
image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
if (image)
{
image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image);
}
image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
if (image)
{
image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image);
}
image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"));
if (image)
{
image->setAddressMode(LLTexUnit::TAM_WRAP);
mImagePreloads.insert(image);
}
}
示例10: stretchSnapshot
void LLPanelClassifiedInfo::stretchSnapshot()
{
// *NOTE dzaporozhan
// Could be moved to LLTextureCtrl
LLViewerFetchedTexture* texture = mSnapshotCtrl->getTexture();
if(!texture)
{
return;
}
if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight())
{
// looks like texture is not loaded yet
return;
}
LLRect rc = mSnapshotRect;
// *HACK dzaporozhan
// LLTextureCtrl uses BTN_HEIGHT_SMALL as bottom for texture which causes
// drawn texture to be smaller than expected. (see LLTextureCtrl::draw())
// Lets increase texture height to force texture look as expected.
rc.mBottom -= BTN_HEIGHT_SMALL;
F32 t_width = texture->getFullWidth();
F32 t_height = texture->getFullHeight();
F32 ratio = llmin<F32>( (rc.getWidth() / t_width), (rc.getHeight() / t_height) );
t_width *= ratio;
t_height *= ratio;
rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height));
mSnapshotCtrl->setShape(rc);
mSnapshotStreched = true;
}
示例11: dump
void LLViewerTextureList::dump()
{
llinfos << "LLViewerTextureList::dump()" << llendl;
for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
{
LLViewerFetchedTexture* image = *it;
llinfos << "priority " << image->getDecodePriority()
<< " boost " << image->getBoostLevel()
<< " size " << image->getWidth() << "x" << image->getHeight()
<< " discard " << image->getDiscardLevel()
<< " desired " << image->getDesiredDiscardLevel()
<< " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
<< llendl;
}
}
示例12: delBitmap
void LLLocalBitmapBrowser::delBitmap( std::vector<LLScrollListItem*> delete_vector, S32 column )
{
bool change_happened = false;
for( std::vector<LLScrollListItem*>::iterator list_iter = delete_vector.begin();
list_iter != delete_vector.end(); list_iter++ )
{
LLScrollListItem* list_item = *list_iter;
if ( list_item )
{
LLUUID id = list_item->getColumn(column)->getValue().asUUID();
for (local_list_iter iter = sLoadedBitmaps.begin();
iter != sLoadedBitmaps.end();)
{
LLLocalBitmap* unit = (*iter)->getThis();
if ( unit->getID() == id )
{
LLViewerFetchedTexture* image = gTextureList.findImage(id);
gTextureList.deleteImage( image );
image->unref();
iter = sLoadedBitmaps.erase(iter);
delete unit;
unit = NULL;
change_happened = true;
}
else
{ iter++; }
}
}
}
if ( change_happened )
{ onChangeHappened(); }
}
示例13: while
void LLViewerTextureList::decodeAllImages(F32 max_time)
{
LLTimer timer;
if(gNoRender) return;
// Update texture stats and priorities
std::vector<LLPointer<LLViewerFetchedTexture> > image_list;
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); )
{
LLViewerFetchedTexture* imagep = *iter++;
image_list.push_back(imagep);
imagep->setInImageList(FALSE) ;
}
mImageList.clear();
for (std::vector<LLPointer<LLViewerFetchedTexture> >::iterator iter = image_list.begin();
iter != image_list.end(); ++iter)
{
LLViewerFetchedTexture* imagep = *iter;
imagep->processTextureStats();
F32 decode_priority = imagep->calcDecodePriority();
imagep->setDecodePriority(decode_priority);
mImageList.insert(imagep);
imagep->setInImageList(TRUE) ;
}
image_list.clear();
// Update fetch (decode)
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); )
{
LLViewerFetchedTexture* imagep = *iter++;
imagep->updateFetch();
}
// Run threads
S32 fetch_pending = 0;
while (1)
{
LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread
LLAppViewer::instance()->getImageDecodeThread()->update(1); // unpauses the image thread
fetch_pending = LLAppViewer::instance()->getTextureFetch()->update(1); // unpauses the texture fetch thread
if (fetch_pending == 0 || timer.getElapsedTimeF32() > max_time)
{
break;
}
}
// Update fetch again
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); )
{
LLViewerFetchedTexture* imagep = *iter++;
imagep->updateFetch();
}
max_time -= timer.getElapsedTimeF32();
max_time = llmax(max_time, .001f);
F32 create_time = updateImagesCreateTextures(max_time);
LL_DEBUGS("ViewerImages") << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. "
<< " fetch_pending " << fetch_pending
<< " create_time " << create_time
<< LL_ENDL;
}
示例14: llmin
F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
{
LLTimer image_op_timer;
// Update the decode priority for N images each frame
// Make a list with 32 high priority entries + 256 cycled entries
const size_t max_priority_count = llmin((S32) (256*10.f*gFrameIntervalSeconds)+1, 32);
const size_t max_update_count = llmin((S32) (1024*10.f*gFrameIntervalSeconds)+1, 256);
// 32 high priority entries
typedef std::vector<LLViewerFetchedTexture*> entries_list_t;
entries_list_t entries;
size_t update_counter = llmin(max_priority_count, mImageList.size());
image_priority_list_t::iterator iter1 = mImageList.begin();
while(update_counter > 0)
{
entries.push_back(*iter1);
++iter1;
update_counter--;
}
// 256 cycled entries
update_counter = llmin(max_update_count, mUUIDMap.size());
if(update_counter > 0)
{
uuid_map_t::iterator iter2 = mUUIDMap.upper_bound(mLastFetchUUID);
uuid_map_t::iterator iter2p = iter2;
while(update_counter > 0)
{
if (iter2 == mUUIDMap.end())
{
iter2 = mUUIDMap.begin();
}
entries.push_back(iter2->second);
iter2p = iter2++;
update_counter--;
}
mLastFetchUUID = iter2p->first;
}
S32 fetch_count = 0;
S32 min_count = max_priority_count + max_update_count/4;
for (entries_list_t::iterator iter3 = entries.begin();
iter3 != entries.end(); )
{
LLViewerFetchedTexture* imagep = *iter3++;
bool fetching = imagep->updateFetch();
if (fetching)
{
fetch_count++;
}
if (min_count <= 0 && image_op_timer.getElapsedTimeF32() > max_time)
{
break;
}
min_count--;
}
//if (fetch_count == 0)
//{
// gDebugTimers[0].pause();
//}
//else
//{
// gDebugTimers[0].unpause();
//}
return image_op_timer.getElapsedTimeF32();
}
示例15: while
void LLObjectBackup::exportNextTexture()
{
LLUUID id;
textures_set_t::iterator iter = mTexturesList.begin();
while (true)
{
if (mTexturesList.empty())
{
mCheckNextTexture = true;
LL_INFOS() << "Finished exporting textures." << LL_ENDL;
return;
}
if (iter == mTexturesList.end())
{
// Not yet ready, wait and re-check at next idle callback...
mCheckNextTexture = true;
return;
}
id = *iter++;
if (id.isNull())
{
// NULL texture id: just remove and ignore.
mTexturesList.erase(id);
LL_DEBUGS("ObjectBackup") << "Null texture UUID found, ignoring."
<< LL_ENDL;
continue;
}
LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id);
if (imagep)
{
if (imagep->getDiscardLevel() > 0)
{
// Boost texture loading
imagep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
LL_DEBUGS("ObjectBackup") << "Boosting texture: " << id
<< LL_ENDL;
LLViewerFetchedTexture* tex;
tex = LLViewerTextureManager::staticCastToFetchedTexture(imagep);
if (tex && tex->getDesiredDiscardLevel() > 0)
{
// Set min discard level to 0
tex->setMinDiscardLevel(0);
LL_DEBUGS("ObjectBackup") << "Min discard level set to 0 for texture: "
<< id << LL_ENDL;
}
}
else
{
// Texture is ready !
break;
}
}
else
{
LL_WARNS() << "We *DON'T* have the texture " << id << LL_ENDL;
mNonExportedTextures |= TEXTURE_MISSING;
mTexturesList.erase(id);
}
}
mTexturesList.erase(id);
LL_INFOS() << "Requesting texture " << id << " from cache." << LL_ENDL;
LLImageJ2C* mFormattedImage = new LLImageJ2C;
BackupCacheReadResponder* responder;
responder = new BackupCacheReadResponder(id, mFormattedImage);
LLAppViewer::getTextureCache()->readFromCache(id,
LLWorkerThread::PRIORITY_HIGH,
0, 999999, responder);
}