本文整理汇总了C++中LLViewerImage类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerImage类的具体用法?C++ LLViewerImage怎么用?C++ LLViewerImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPositionAgent
void LLVOTextBubble::updateTextures(LLAgent &agent)
{
// Update the image levels of all textures...
// First we do some quick checks.
U32 i;
// This doesn't take into account whether the object is in front
// or behind...
LLVector3 position_local = getPositionAgent() - agent.getCameraPositionAgent();
F32 dot_product = position_local * agent.getFrameAgent().getAtAxis();
F32 cos_angle = dot_product / position_local.magVec();
if (cos_angle > 1.f)
{
cos_angle = 1.f;
}
for (i = 0; i < getNumTEs(); i++)
{
const LLTextureEntry *te = getTE(i);
F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
LLViewerImage *imagep = getTEImage(i);
if (imagep)
{
imagep->addTextureStats(mPixelArea, texel_area_ratio, cos_angle);
}
}
}
示例2: get_texture_list_name
void LLViewerImageList::doPrefetchImages()
{
#if 1
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"];
LLViewerImage* image = getImage(uuid, MIPMAP_TRUE, FALSE);
if (image)
{
image->addTextureStats((F32)pixel_area);
}
}
#endif
}
示例3: t
F32 LLViewerImageList::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;
LLViewerImage *imagep = *curiter;
imagep->createTexture();
if (create_timer.getElapsedTimeF32() > max_time)
{
break;
}
}
mCreateTextureList.erase(mCreateTextureList.begin(), enditer);
return create_timer.getElapsedTimeF32();
}
示例4: updateMovieImage
void LLViewerMediaImpl::updateMovieImage(const LLUUID& uuid, BOOL active)
{
// IF the media image hasn't changed, do nothing
if (mTextureId == uuid)
{
return;
}
// If we have changed media uuid, restore the old one
if (!mTextureId.isNull())
{
LLViewerImage* oldImage = LLViewerImage::getImage( mTextureId );
if (oldImage)
{
oldImage->reinit(mMovieImageHasMips);
oldImage->mIsMediaTexture = FALSE;
}
}
// If the movie is playing, set the new media image
if (active && !uuid.isNull())
{
LLViewerImage* viewerImage = LLViewerImage::getImage( uuid );
if( viewerImage )
{
mTextureId = uuid;
// Can't use mipmaps for movies because they don't update the full image
mMovieImageHasMips = viewerImage->getUseMipMaps();
viewerImage->reinit(FALSE);
viewerImage->mIsMediaTexture = TRUE;
}
}
}
示例5: updateImagesDecodePriorities
void LLViewerImageList::updateImages(F32 max_time)
{
llpushcallstacks ;
LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec());
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(LLImageRaw::sGlobalRawMemory));
sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory));
llpushcallstacks ;
updateImagesDecodePriorities();
llpushcallstacks ;
F32 total_max_time = max_time;
max_time -= updateImagesFetchTextures(max_time);
llpushcallstacks ;
max_time = llmax(max_time, total_max_time*.25f); // at least 25% of max_time
max_time -= updateImagesCreateTextures(max_time);
llpushcallstacks ;
if (!mDirtyTextureList.empty())
{
LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY);
gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
mDirtyTextureList.clear();
}
llpushcallstacks ;
bool didone = false;
for (image_list_t::iterator iter = mCallbackList.begin();
iter != mCallbackList.end(); )
{
//trigger loaded callbacks on local textures immediately
LLViewerImage* image = *iter++;
if (!image->mUrl.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();
}
}
llpushcallstacks ;
if (!gNoRender && !gGLManager.mIsDisabled)
{
LLViewerMedia::updateMedia();
}
llpushcallstacks ;
updateImagesUpdateStats();
llpushcallstacks ;
}
示例6: 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 */
const std::time_t temp_time = boost::filesystem::last_write_time( boost::filesystem::path( this->filename ) );
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; }
LLViewerImage* image = gImageList.hasImage(this->id);
if (!image->mForSculpt)
{ image->createGLTexture( LOCAL_DISCARD_LEVEL, new_imgraw ); }
else
{ image->mCachedRawImage = 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; }
}
}
}
示例7: getImageUUID
LLUUID LLViewerPartSource::getImageUUID() const
{
LLViewerImage* imagep = mImagep;
if(imagep)
{
return imagep->getID();
}
return LLUUID::null;
}
示例8: LLAlphaObject
LLVOClouds::LLVOClouds(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
: LLAlphaObject(id, LL_VO_CLOUDS, regionp)
{
mCloudGroupp = NULL;
mbCanSelect = FALSE;
setNumTEs(1);
LLViewerImage* image = gImageList.getImage(gCloudTextureID);
image->setBoostLevel(LLViewerImage::BOOST_CLOUDS);
setTEImage(0, image);
}
示例9: shutdown
void LLViewerImageList::shutdown()
{
// clear out preloads
mImagePreloads.clear();
// Write out list of currently loaded textures for precaching on startup
typedef std::set<std::pair<S32,LLViewerImage*> > image_area_list_t;
image_area_list_t image_area_list;
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); ++iter)
{
LLViewerImage* image = *iter;
if (!image->getUseDiscard() ||
image->needsAux() ||
image->getTargetHost() != LLHost::invalid)
{
continue; // avoid UI, baked, and other special images
}
S32 desired = image->getDesiredDiscardLevel();
if (desired >= 0 && desired < MAX_DISCARD_LEVEL)
{
S32 pixel_area = image->getWidth(desired) * image->getHeight(desired);
image_area_list.insert(std::make_pair(pixel_area, image));
}
}
LLSD imagelist;
const S32 max_count = 1000;
S32 count = 0;
for (image_area_list_t::reverse_iterator riter = image_area_list.rbegin();
riter != image_area_list.rend(); ++riter)
{
LLViewerImage* image = riter->second;
imagelist[count]["area"] = riter->first;
imagelist[count]["uuid"] = image->getID();
if (++count >= max_count)
break;
}
if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty())
{
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
llofstream file;
file.open(filename);
LLSDSerialize::toPrettyXML(imagelist, file);
}
//
// Clean up "loaded" callbacks.
//
mCallbackList.clear();
// Flush all of the references
mLoadingStreamList.clear();
mCreateTextureList.clear();
mUUIDMap.clear();
mImageList.clear();
}
示例10: llassert
// Updates asset from the user's avatar
void LLWearable::readFromAvatar()
{
LLVOAvatar* avatar = gAgent.getAvatarObject();
llassert( avatar );
if( !avatar )
{
return;
}
mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
mVisualParamMap.clear();
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
{
if (((LLViewerVisualParam*)param)->getWearableType() == mType && param->isTweakable())
{
//pretty sure is right
if(param->getID() == 507)
avatar->setActualBoobGrav(param->getWeight());
if(param->getID() == 151)
avatar->setActualButtGrav(param->getWeight());
if(param->getID() == 157)
avatar->setActualFatGrav(param->getWeight());
//if(param->getID() == 507)
//{
// llwarns << "current = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "param weight = " << param->getWeight() << llendl;
//}
mVisualParamMap[param->getID()] = param->getWeight();
}
}
mTEMap.clear();
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
{
LLViewerImage* image = avatar->getTEImage( te );
if( image )
{
mTEMap[te] = image->getID();
}
}
}
//if( gFloaterCustomize )
//{
// mDescription = gFloaterCustomize->getWearableDescription( mType );
//}
}
示例11: t
// We've been that the asset server does not contain the requested image id.
// static
void LLViewerImageList::processImageNotInDatabase(LLMessageSystem *msg,void **user_data)
{
LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES);
LLUUID image_id;
msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
LLViewerImage* image = gImageList.hasImage( image_id );
if( image )
{
image->setIsMissingAsset();
}
}
示例12: bindBumpMap
// static
BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
{
LLImageGL* bump = NULL;
U8 bump_code = params.mBump;
LLViewerImage* tex = params.mTexture;
switch( bump_code )
{
case BE_NO_BUMP:
bump = NULL;
break;
case BE_BRIGHTNESS:
case BE_DARKNESS:
if( tex )
{
if(tex->getID()== IMG_DEFAULT)
{
return TRUE;
}
bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
}
break;
default:
if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
{
bump = gStandardBumpmapList[bump_code].mImage;
gBumpImageList.addTextureStats(bump_code, tex->getID(), params.mVSize);
}
break;
}
if (bump)
{
if (channel == -2)
{
gGL.getTexUnit(1)->bind(bump);
gGL.getTexUnit(0)->bind(bump);
}
else
{
gGL.getTexUnit(channel)->bind(bump);
}
return TRUE;
}
return FALSE;
}
示例13: while
void primbackup::export_next_texture()
{
if(textures.empty())
{
llinfos << "Finished exporting textures "<<llendl;
return;
}
std::list<LLUUID>::iterator iter;
iter = textures.begin();
LLUUID id;
while(1)
{
if(iter==textures.end())
{
m_nexttextureready=true;
return;
}
id=(*iter);
LLViewerImage * imagep = gImageList.hasImage(id);
if(imagep!=NULL)
{
S32 cur_discard = imagep->getDiscardLevel();
if(cur_discard>0)
{
if(imagep->getBoostLevel()!=LLViewerImageBoostLevel::BOOST_PREVIEW)
imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); //we want to force discard 0 this one does this.
}
else
{
break;
}
}
else
{
llwarns<<" We *DONT* have the texture "<<llendl;
}
iter++;
}
textures.remove(id);
llinfos<<"Requesting texture "<<id<<llendl;
LLImageJ2C * mFormattedImage = new LLImageJ2C;
CacheReadResponder* responder = new CacheReadResponder(id, mFormattedImage);
LLAppViewer::getTextureCache()->readFromCache(id,LLWorkerThread::PRIORITY_HIGH,0,999999,responder);
}
示例14: updateImagesUpdateStats
void LLViewerImageList::updateImagesUpdateStats()
{
if (mUpdateStats && mForceResetTextureStats)
{
for (image_priority_list_t::iterator iter = mImageList.begin();
iter != mImageList.end(); )
{
LLViewerImage* imagep = *iter++;
imagep->resetTextureStats();
}
mUpdateStats = FALSE;
mForceResetTextureStats = FALSE;
}
}
示例15: getTE
void LLVOTextBubble::updateTextures()
{
// Update the image levels of all textures...
for (U32 i = 0; i < getNumTEs(); i++)
{
const LLTextureEntry *te = getTE(i);
F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
texel_area_ratio = llclamp(texel_area_ratio, .125f, 16.f);
LLViewerImage *imagep = getTEImage(i);
if (imagep)
{
imagep->addTextureStats(mPixelArea / texel_area_ratio);
}
}
}