Drag[en]gine Game Engine  1.21
deResourceLoader Class Reference

Resource Loader. More...

#include <deResourceLoader.h>

Public Types

enum  eResourceType {
  ertAnimation , ertFont , ertImage , ertLanguagePack ,
  ertModel , ertOcclusionMesh , ertRig , ertSkin ,
  ertSound , ertVideo
}
 Resource types. More...
 

Public Member Functions

Constructors and Destructors
 deResourceLoader (deEngine &engine)
 Create resource loader. More...
 
 ~deResourceLoader ()
 Clean up resource loader. More...
 
Management
bool GetOutputDebugMessages () const
 Debug messages are logger. More...
 
void SetOutputDebugMessages (bool outputDebugMessages)
 Set if debug messages are logged. More...
 
deResourceLoaderTaskAddLoadRequest (deVirtualFileSystem *vfs, const char *path, eResourceType resourceType)
 Add request for loading a resource. More...
 
deResourceLoaderTaskAddSaveRequest (deVirtualFileSystem *vfs, const char *path, deFileResource *resource)
 Add request for saving a resource. More...
 
bool NextFinishedRequest (deResourceLoaderInfo &info)
 Information about next finished request. More...
 
void RemoveAllTasks ()
 Stop loading and remove all tasks. More...
 

Internal use only

Warning
Do not call directly.
void FinishTask (deResourceLoaderTask *task)
 

Detailed Description

Resource Loader.

Loads resources asynchronously. To load a resource a scripting module places a load request. Requests are processed using Parallel Processing system of the game engine. The scripting module has to query the resource loader during each frame update for new entries in the retrieval queue. Once there are no more entries in the queue the scripting module can carry on with the fram update.

Requests for the same resource are grouped together and placed in the retrieval queue only once. The scripting module is responsible to track multiple requests for the same resource. A resource is uniquely identified by the path and resource type. This information are also returned in retrieval queries and can be used to match up with one or more requests made by the game scripts.

Loading certain resources can add internal loading requests not started by the scripting module. The scripting module has to deal with resources finished loading which have not been requested.

Resource loading is supported for the following resource types:

  • Animation
  • Font
  • Image
  • LanguagePack
  • Model
  • OcclusionMesh
  • Rig
  • Skin
  • Sound
  • Video

Member Enumeration Documentation

◆ eResourceType

Resource types.

Enumerator
ertAnimation 

Animation.

ertFont 

Font.

ertImage 

Image.

ertLanguagePack 

LanguagePack.

ertModel 

Model.

ertOcclusionMesh 

Occlusion Mesh.

ertRig 

Rig.

ertSkin 

Skin.

ertSound 

Sound.

ertVideo 

Video.

Constructor & Destructor Documentation

◆ deResourceLoader()

deResourceLoader::deResourceLoader ( deEngine engine)

Create resource loader.

◆ ~deResourceLoader()

deResourceLoader::~deResourceLoader ( )

Clean up resource loader.

Member Function Documentation

◆ AddLoadRequest()

deResourceLoaderTask* deResourceLoader::AddLoadRequest ( deVirtualFileSystem vfs,
const char *  path,
eResourceType  resourceType 
)

Add request for loading a resource.

Parameters
[in]vfsVirtual file system to use.
[in]pathPath to use.
[in]resourceTypeType of resource to load
Returns
parallel task processing the request to use as parellel task dependency. If the resource is already loaded the task is marked finished. Do not add the task to the parallel processor. This has been done already if required.
Warning
The returned task is not held by the caller. The resource loader holds references to the task as long as it is pending, being process or finished waiting to be collected. Once the task has been collected the resource loader holds no references anymore. If you need to work with the task any time later you have to add a reference yourself.
Exceptions
deeInvalidParamvfs is NULL.
deeInvalidParampath is NULL.

◆ AddSaveRequest()

deResourceLoaderTask* deResourceLoader::AddSaveRequest ( deVirtualFileSystem vfs,
const char *  path,
deFileResource resource 
)

Add request for saving a resource.

Returns
parallel task processing the request to use as parellel task dependency. If the resource is already loaded the task is marked finished.
Warning
The returned task is not held by the caller. The resource loader holds references to the task as long as it is pending, being process or finished waiting to be collected. Once the task has been collected the resource loader holds no references anymore. If you need to work with the task any time later you have to add a reference yourself.

◆ FinishTask()

void deResourceLoader::FinishTask ( deResourceLoaderTask task)

◆ GetOutputDebugMessages()

bool deResourceLoader::GetOutputDebugMessages ( ) const
inline

Debug messages are logger.

◆ NextFinishedRequest()

bool deResourceLoader::NextFinishedRequest ( deResourceLoaderInfo info)

Information about next finished request.

Return values
trueA request finished. Information have been written to info.
falseNo request finished. info is unchanged.

◆ RemoveAllTasks()

void deResourceLoader::RemoveAllTasks ( )

Stop loading and remove all tasks.

Used by the game engine to clear pending tasks upon cleanup avoiding problems.

◆ SetOutputDebugMessages()

void deResourceLoader::SetOutputDebugMessages ( bool  outputDebugMessages)

Set if debug messages are logged.


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