Ocular Engine
Ocular::Core::AResourceLoader Class Reference

#include <ResourceLoader.hpp>

Inheritance diagram for Ocular::Core::AResourceLoader:
Ocular::Graphics::D3D11UncompiledShaderResourceLoader Ocular::Graphics::MaterialResourceLoader Ocular::Graphics::MeshResourceLoader Ocular::Graphics::ResourceLoader_OBJ Ocular::Graphics::TextureResourceLoader Ocular::Graphics::MeshResourceLoader_PLY Ocular::Graphics::TextureResourceLoader_BMP Ocular::Graphics::TextureResourceLoader_PNG Ocular::Graphics::TextureResourceLoader_TGA

Public Member Functions

 AResourceLoader (std::string const &extension, ResourceType type)
 
virtual std::string getSupportedFileType () const
 
virtual bool loadResource (Resource *&resource, File const &file, std::string const &mappingName)
 
virtual bool loadSubResource (Resource *&resource, File const &file, std::string const &mappingName)
 
virtual bool exploreResource (File const &file)
 
ResourceType getResourceType () const
 

Protected Member Functions

bool isFileValid (Core::File const &file) const
 

Protected Attributes

std::string m_SupportedExtension
 
ResourceType m_Type
 

Detailed Description

Base interface for all resource loaders.

A resource loader is responsible for reading and loading a specific type of resource file (based on extension) and then creating a Resource implementation from it.

For example, one loader may handle the '.png' extension and create a 2D texture from it.

Another may handle the '.ply' extension and create a model from the data read in.

There may only be one loader per file extension.

Member Function Documentation

bool Ocular::Core::AResourceLoader::exploreResource ( File const &  file)
virtual

For use with MultiResources. When called, the Resource will be explored and all sub-resources should be added to the global resource manager via

ResourceManager::addResource

Parameters
[in]file

Reimplemented in Ocular::Graphics::ResourceLoader_OBJ.

ResourceType Ocular::Core::AResourceLoader::getResourceType ( ) const

Returns the type of resource created by this loader.

std::string Ocular::Core::AResourceLoader::getSupportedFileType ( ) const
virtual
Returns
The file type (as an extension) that this loader can operate on.
bool Ocular::Core::AResourceLoader::isFileValid ( Core::File const &  file) const
protected

Verifies the file on the following conditions:

- File exists
- File is readable
- File extension matches the supported extension of the loader
Parameters
[in]FileThe file to validate.
Returns
TRUE if valid; Else FALSE.
bool Ocular::Core::AResourceLoader::loadResource ( Resource *&  resource,
File const &  file,
std::string const &  mappingName 
)
virtual
bool Ocular::Core::AResourceLoader::loadSubResource ( Resource *&  resource,
File const &  file,
std::string const &  mappingName 
)
virtual
Parameters
[out]resource
[in]file
[in]mappingName

Reimplemented in Ocular::Graphics::ResourceLoader_OBJ.


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