OGRE 14.6
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::ResourceBackgroundQueue Class Reference

Performs resource operations on the shared background work queue. More...

#include <OgreResourceBackgroundQueue.h>

Inheritance diagram for Ogre::ResourceBackgroundQueue:

Public Member Functions

 ResourceBackgroundQueue ()
virtual ~ResourceBackgroundQueue ()
std::future< void > initialiseAllResourceGroups ()
 Initialise all resource groups which are yet to be initialised in the background.
std::future< void > initialiseResourceGroup (const String &name)
 Initialise a resource group in the background.
std::future< void > load (const ResourcePtr &res)
 Load a single resource in the background.
std::future< void > loadResourceGroup (const String &name)
 Loads a resource group in the background.
std::future< void > prepare (const ResourcePtr &res)
 Prepare a single resource in the background.
std::future< void > prepareResourceGroup (const String &name)
 Prepares a resource group in the background.
std::future< void > unload (const ResourcePtr &res)
 Unload a single resource in the background.
std::future< void > unloadResourceGroup (const String &name)
 Unloads a resource group in the background.
Public Member Functions inherited from Ogre::Singleton< ResourceBackgroundQueue >
 ~Singleton (void)

Static Public Member Functions

static ResourceBackgroundQueue & getSingleton (void)
 Get the singleton instance.
static ResourceBackgroundQueue * getSingletonPtr (void)
 Get the singleton instance.
Static Public Member Functions inherited from Ogre::Singleton< ResourceBackgroundQueue >
static ResourceBackgroundQueue & getSingleton (void)
 Get the singleton instance.
static ResourceBackgroundQueue * getSingletonPtr (void)
 Get the singleton instance.

Detailed Description

Performs resource operations on the shared background work queue.

All operations are queued via Root::getWorkQueue in order to share the thread pool amongst all background tasks. You should therefore refer to Background Resource Loading for configuring the threads and for the lifetime and exception rules of tasks; this class merely provides an interface that is specific to resource handling.

Every call returns a std::future<void> that becomes ready when the background portion of the operation has finished. This may be before the corresponding Resource::Listener callback has run, because those callbacks are dispatched back to the main thread. Use the future to wait for the data to become available, and a listener to observe the completed resource.

Which resource methods can run on a worker thread depends on OGRE_THREAD_SUPPORT. With the default configuration (3), workers cannot access the RenderSystem: prepare() runs Resource::prepare in the background, while load() prepares in the background and performs the actual load on the main thread. With OGRE_THREAD_SUPPORT == 1, resources are fully thread-safe and load() runs entirely in the background.

See also
Background Resource Loading

Constructor & Destructor Documentation

◆ ResourceBackgroundQueue()

Ogre::ResourceBackgroundQueue::ResourceBackgroundQueue ( )

Referenced by getSingleton(), and getSingletonPtr().

◆ ~ResourceBackgroundQueue()

virtual Ogre::ResourceBackgroundQueue::~ResourceBackgroundQueue ( )
virtual

Member Function Documentation

◆ initialiseResourceGroup()

std::future< void > Ogre::ResourceBackgroundQueue::initialiseResourceGroup ( const String & name)

Initialise a resource group in the background.

See also
ResourceGroupManager::initialiseResourceGroup
Parameters
nameThe name of the resource group to initialise

◆ initialiseAllResourceGroups()

std::future< void > Ogre::ResourceBackgroundQueue::initialiseAllResourceGroups ( )

Initialise all resource groups which are yet to be initialised in the background.

See also
ResourceGroupManager::intialiseResourceGroup

◆ prepareResourceGroup()

std::future< void > Ogre::ResourceBackgroundQueue::prepareResourceGroup ( const String & name)

Prepares a resource group in the background.

See also
ResourceGroupManager::prepareResourceGroup
Parameters
nameThe name of the resource group to prepare

◆ loadResourceGroup()

std::future< void > Ogre::ResourceBackgroundQueue::loadResourceGroup ( const String & name)

Loads a resource group in the background.

See also
ResourceGroupManager::loadResourceGroup
Parameters
nameThe name of the resource group to load

◆ unload()

std::future< void > Ogre::ResourceBackgroundQueue::unload ( const ResourcePtr & res)

Unload a single resource in the background.

See also
ResourceManager::unload

◆ unloadResourceGroup()

std::future< void > Ogre::ResourceBackgroundQueue::unloadResourceGroup ( const String & name)

Unloads a resource group in the background.

See also
ResourceGroupManager::unloadResourceGroup
Parameters
nameThe name of the resource group to load

◆ prepare()

std::future< void > Ogre::ResourceBackgroundQueue::prepare ( const ResourcePtr & res)

Prepare a single resource in the background.

See also
ResourceManager::prepare

◆ load()

std::future< void > Ogre::ResourceBackgroundQueue::load ( const ResourcePtr & res)

Load a single resource in the background.

See also
ResourceManager::load

◆ getSingleton()

ResourceBackgroundQueue & Ogre::ResourceBackgroundQueue::getSingleton ( void )
static

Get the singleton instance.

References ResourceBackgroundQueue().

◆ getSingletonPtr()

ResourceBackgroundQueue * Ogre::ResourceBackgroundQueue::getSingletonPtr ( void )
static

Get the singleton instance.

References ResourceBackgroundQueue().


The documentation for this class was generated from the following file: