XII Release 0.1.0
Loading...
Searching...
No Matches
xiiResourceTypeLoader Class Referenceabstract

Base class for all resource loaders. More...

#include <ResourceTypeLoader.h>

Inheritance diagram for xiiResourceTypeLoader:
[legend]

Public Member Functions

virtual xiiResourceLoadData OpenDataStream (const xiiResource *pResource)=0
 Override this function to implement the resource loading.
 
virtual void CloseDataStream (const xiiResource *pResource, const xiiResourceLoadData &loaderData)=0
 This function is called when the resource has been updated with the data from the resource loader and the loader can deallocate any temporary memory.
 
virtual bool IsResourceOutdated (const xiiResource *pResource) const
 If this function returns true, a resource is unloaded and loaded again to update its content.
 

Detailed Description

Base class for all resource loaders.

A resource loader handles preparing the data before the resource is updated with the data. Resource loaders are always executed on a separate thread.

Member Function Documentation

◆ CloseDataStream()

virtual void xiiResourceTypeLoader::CloseDataStream ( const xiiResource * pResource,
const xiiResourceLoadData & loaderData )
pure virtual

This function is called when the resource has been updated with the data from the resource loader and the loader can deallocate any temporary memory.

Implemented in xiiConfigFileResourceLoader, xiiDecalResourceLoader, xiiResourceLoaderFromFile, xiiResourceLoaderFromMemory, xiiShaderPermutationResourceLoader, and xiiTextureResourceLoader.

◆ IsResourceOutdated()

virtual bool xiiResourceTypeLoader::IsResourceOutdated ( const xiiResource * pResource) const
inlinevirtual

If this function returns true, a resource is unloaded and loaded again to update its content.

Call xiiResource::GetLoadedFileModificationTime() to query the file modification time that was returned through xiiResourceLoadData::m_LoadedFileModificationDate.

Reimplemented in xiiConfigFileResourceLoader, xiiDecalResourceLoader, xiiResourceLoaderFromFile, xiiResourceLoaderFromMemory, xiiShaderPermutationResourceLoader, and xiiTextureResourceLoader.

◆ OpenDataStream()

virtual xiiResourceLoadData xiiResourceTypeLoader::OpenDataStream ( const xiiResource * pResource)
pure virtual

Override this function to implement the resource loading.

This function should take the information from pResource, e.g. which file to load, and do the loading work. It should allocate temporary storage for the loaded data and encode it in a memory stream, such that the resource can read all necessary information from the stream.

See also
xiiResourceLoadData

Implemented in xiiConfigFileResourceLoader, xiiDecalResourceLoader, xiiResourceLoaderFromFile, xiiResourceLoaderFromMemory, xiiShaderPermutationResourceLoader, and xiiTextureResourceLoader.


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