本文整理汇总了C++中TileKey::get_tile_x方法的典型用法代码示例。如果您正苦于以下问题:C++ TileKey::get_tile_x方法的具体用法?C++ TileKey::get_tile_x怎么用?C++ TileKey::get_tile_x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileKey
的用法示例。
在下文中一共展示了TileKey::get_tile_x方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
bool TextureStore::TileSwapper::unload(const TileKey& key, TileRecord& record)
{
// Cannot unload tiles that are still in use.
if (boost_atomic::atomic_read32(&record.m_owners) > 0)
return false;
// Track the amount of memory used by the tile cache.
const size_t tile_memory_size = dynamic_sizeof(*record.m_tile);
assert(m_memory_size >= tile_memory_size);
m_memory_size -= tile_memory_size;
// Fetch the texture container.
const TextureContainer& textures =
key.m_assembly_uid == ~0
? m_scene.textures()
: m_scene.assemblies().get_by_uid(key.m_assembly_uid)->textures();
// Fetch the texture.
const size_t texture_index = key.get_texture_index();
assert(texture_index < textures.size());
Texture* texture = textures.get_by_index(texture_index);
#ifdef TRACK_TILE_UNLOADING
RENDERER_LOG_DEBUG(
"unloading tile (" FMT_SIZE_T ", " FMT_SIZE_T ") "
"from texture \"%s\"...",
key.get_tile_x(),
key.get_tile_y(),
texture->get_name());
#endif
// Unload the tile.
texture->unload_tile(key.get_tile_x(), key.get_tile_y(), record.m_tile);
// Successfully unloaded the tile.
return true;
}
示例2: assert
bool TextureStore::TileSwapper::unload(const TileKey& key, TileRecord& record)
{
// Cannot unload tiles that are still in use.
if (atomic_read(&record.m_owners) > 0)
return false;
// Track the amount of memory used by the tile cache.
const size_t tile_memory_size = record.m_tile->get_memory_size();
assert(m_memory_size >= tile_memory_size);
m_memory_size -= tile_memory_size;
// Fetch the texture container.
const TextureContainer& textures =
key.m_assembly_uid == UniqueID(~0)
? m_scene.textures()
: m_assemblies[key.m_assembly_uid]->textures();
// Fetch the texture.
Texture* texture = textures.get_by_uid(key.m_texture_uid);
if (m_params.m_track_tile_unloading)
{
RENDERER_LOG_DEBUG(
"unloading tile (" FMT_SIZE_T ", " FMT_SIZE_T ") "
"from texture \"%s\"...",
key.get_tile_x(),
key.get_tile_y(),
texture->get_name());
}
// Unload the tile.
texture->unload_tile(key.get_tile_x(), key.get_tile_y(), record.m_tile);
// Successfully unloaded the tile.
return true;
}
示例3: UniqueID
void TextureStore::TileSwapper::load(const TileKey& key, TileRecord& record)
{
// Fetch the texture container.
const TextureContainer& textures =
key.m_assembly_uid == UniqueID(~0)
? m_scene.textures()
: m_assemblies[key.m_assembly_uid]->textures();
// Fetch the texture.
Texture* texture = textures.get_by_uid(key.m_texture_uid);
if (m_params.m_track_tile_loading)
{
RENDERER_LOG_DEBUG(
"loading tile (" FMT_SIZE_T ", " FMT_SIZE_T ") "
"from texture \"%s\"...",
key.get_tile_x(),
key.get_tile_y(),
texture->get_name());
}
// Load the tile.
record.m_tile = texture->load_tile(key.get_tile_x(), key.get_tile_y());
record.m_owners = 0;
// Convert the tile to the linear RGB color space.
switch (texture->get_color_space())
{
case ColorSpaceLinearRGB:
break;
case ColorSpaceSRGB:
convert_tile_srgb_to_linear_rgb(*record.m_tile);
break;
case ColorSpaceCIEXYZ:
convert_tile_ciexyz_to_linear_rgb(*record.m_tile);
break;
assert_otherwise;
}
// Track the amount of memory used by the tile cache.
m_memory_size += record.m_tile->get_memory_size();
m_peak_memory_size = max(m_peak_memory_size, m_memory_size);
if (m_params.m_track_store_size)
{
if (m_memory_size > m_params.m_memory_limit)
{
RENDERER_LOG_DEBUG(
"texture store size is %s, exceeding capacity %s by %s",
pretty_size(m_memory_size).c_str(),
pretty_size(m_params.m_memory_limit).c_str(),
pretty_size(m_memory_size - m_params.m_memory_limit).c_str());
}
else
{
RENDERER_LOG_DEBUG(
"texture store size is %s, below capacity %s by %s",
pretty_size(m_memory_size).c_str(),
pretty_size(m_params.m_memory_limit).c_str(),
pretty_size(m_params.m_memory_limit - m_memory_size).c_str());
}
}
}