当前位置: 首页>>代码示例>>C++>>正文


C++ LLPointer::isMissingAsset方法代码示例

本文整理汇总了C++中LLPointer::isMissingAsset方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPointer::isMissingAsset方法的具体用法?C++ LLPointer::isMissingAsset怎么用?C++ LLPointer::isMissingAsset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLPointer的用法示例。


在下文中一共展示了LLPointer::isMissingAsset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cleanMissedTilesFromLevel

// This method is used to clean up a level from tiles marked as "missing".
// The idea is to allow tiles that have been improperly marked missing to be reloaded when retraversing the level again.
// When zooming in and out rapidly, some tiles are never properly loaded and, eventually marked missing.
// This creates "blue" areas in a subresolution that never got a chance to reload if we don't clean up the level.
void LLWorldMipmap::cleanMissedTilesFromLevel(S32 level)
{
	// Check the input data
	llassert(level <= MAP_LEVELS);
	llassert(level >= 0);

	// This happens when the object is first initialized
	if (level == 0)
	{
		return;
	}

	// Iterate through the subresolution level and suppress the tiles that are marked as missing
	// Note: erasing in a map while iterating through it is bug prone. Using a postfix increment is mandatory here.
	sublevel_tiles_t& level_mipmap = mWorldObjectsMipMap[level-1];
	sublevel_tiles_t::iterator it = level_mipmap.begin();
	while (it != level_mipmap.end())
	{
		LLPointer<LLViewerFetchedTexture> img = it->second;
		if (img->isMissingAsset())
		{
			level_mipmap.erase(it++);
		}
		else
		{
			++it;
		}
	}
	return;
}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:34,代码来源:llworldmipmap.cpp

示例2: 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;
	}
}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:57,代码来源:llworldmipmap.cpp

示例3: 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
}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:49,代码来源:llworldmipmap.cpp

示例4: draw

void LLTextureView::draw()
{
	if (!mFreezeView)
	{
// 		LLViewerObject *objectp;
// 		S32 te;

		for_each(mTextureBars.begin(), mTextureBars.end(), DeletePointer());
		mTextureBars.clear();
	
		delete mGLTexMemBar;
		mGLTexMemBar = 0;
	
		typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t;
		display_list_t display_image_list;
	
		if (mPrintList)
		{
			llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
		}
	
		for (LLViewerImageList::image_priority_list_t::iterator iter = gImageList.mImageList.begin();
			 iter != gImageList.mImageList.end(); )
		{
			LLPointer<LLViewerImage> imagep = *iter++;

			S32 cur_discard = imagep->getDiscardLevel();
			S32 desired_discard = imagep->mDesiredDiscardLevel;
			
			if (mPrintList)
			{
				llinfos << imagep->getID()
						<< "\t" <<  imagep->mTextureMemory
						<< "\t" << imagep->getBoostLevel()
						<< "\t" << imagep->getDecodePriority()
						<< "\t" << imagep->getWidth()
						<< "\t" << imagep->getHeight()
						<< "\t" << cur_discard
						<< llendl;
			}
		
#if 0
			if (imagep->getDontDiscard())
			{
				continue;
			}

			if (imagep->isMissingAsset())
			{
				continue;
			}
#endif

#define HIGH_PRIORITY 100000000.f
			F32 pri;
			if (mOrderFetch)
			{
				pri = ((F32)imagep->mFetchPriority)/256.f;
			}
			else
			{
				pri = imagep->getDecodePriority();
			}
			
			if (sDebugImages.find(imagep) != sDebugImages.end())
			{
				pri += 4*HIGH_PRIORITY;
			}

			if (!mOrderFetch)
			{
#if 1
			if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance())
			{
				struct f : public LLSelectedTEFunctor
				{
					LLViewerImage* mImage;
					f(LLViewerImage* image) : mImage(image) {}
					virtual bool apply(LLViewerObject* object, S32 te)
					{
						return (mImage == object->getTEImage(te));
					}
				} func(imagep);
				const bool firstonly = true;
				bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly);
				if (match)
				{
					pri += 3*HIGH_PRIORITY;
				}
			}
#endif
#if 1
			if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
			{
				LLViewerObject *objectp = gHoverView->getLastHoverObject();
				if (objectp)
				{
					S32 tex_count = objectp->getNumTEs();
					for (S32 i = 0; i < tex_count; i++)
					{
//.........这里部分代码省略.........
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:101,代码来源:lltextureview.cpp

示例5: 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;
	}
}
开发者ID:CharleyLevenque,项目名称:SingularityViewer,代码行数:73,代码来源:llworldmipmap.cpp


注:本文中的LLPointer::isMissingAsset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。