本文整理汇总了C++中ogre::ResourcePtr::getHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ ResourcePtr::getHandle方法的具体用法?C++ ResourcePtr::getHandle怎么用?C++ ResourcePtr::getHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::ResourcePtr
的用法示例。
在下文中一共展示了ResourcePtr::getHandle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadResource
Ogre::ResourcePtr ResourceManager::loadResource( const ResourceInfo& rResource,
const ResourceCallback& rCallbackSlot )
{
Ogre::ResourcePtr resource = ResourceManager::getResource( rResource, true );
if( !resource.isNull() && resource->isLoaded() )
{
CLOGD << "Resource " << rResource << " already loaded.";
// If the resource is already loaded, callback immediately.
rCallbackSlot( resource );
}
else if( !resource.isNull() && mHandleTickets.count( std::make_pair(
resource->getCreator()->getResourceType(), resource->getHandle() ) ) )
{
// If the resource is loading, add a callback.
HandleTickets::iterator i = mHandleTickets.find( std::make_pair(
resource->getCreator()->getResourceType(), resource->getHandle() ) );
if( i != mHandleTickets.end() )
{
mTicketCallbacks.insert( TicketCallbacks::value_type( i->second, rCallbackSlot ) );
CLOGD << "Resource " << rResource << " is loading, ticket callback: " << i->second;
}
else
{
DIVERSIA_EXCEPT( Exception::ERR_INTERNAL_ERROR,
"Could not find ticket for resource that is loading in the background.",
"ResourceManager::loadResource" );
}
}
else if( !resource.isNull() )
{
// Load the resource in the background and register the callback.
resource = ResourceManager::getResource( rResource, true );
Ogre::BackgroundProcessTicket ticket =
mRBQ.load( ResourceManager::getResourceManagerName( rResource.mType ),
rResource.mFile.string(), mGroup, false, 0, 0, this );
mTicketCallbacks.insert( TicketCallbacks::value_type( ticket, rCallbackSlot ) );
mHandleTickets.insert( std::make_pair( std::make_pair(
resource->getCreator()->getResourceType(), resource->getHandle() ), ticket ) );
mTicketResources.insert( std::make_pair( ticket, resource ) );
CLOGD << "Resource " << rResource << " will be loaded, ticket: " << ticket;
}
else
{
DIVERSIA_EXCEPT( Exception::ERR_FILE_NOT_FOUND, "Cannot load resource " +
rResource.mFile.string() + ", file does not exist.",
"ResourceManager::loadResource" );
}
return resource;
}
示例2: mCompletedSlot
void ResourceManager::ResourcesLoader::loadingComplete( Ogre::ResourcePtr pResource )
{
mResources.erase( std::make_pair( pResource->getCreator()->getResourceType(),
pResource->getHandle() ) );
if( !mResources.size() )
{
mCompletedSlot();
delete this;
}
}
示例3:
void ResourceManager::ResourcesLoader::addResource( Ogre::ResourcePtr pResource )
{
mResources.insert( std::make_pair( pResource->getCreator()->getResourceType(),
pResource->getHandle() ) );
}