Ocular Engine
|
#include <TextureResourceLoader.hpp>
Public Member Functions | |
TextureResourceLoader (std::string const &extension) | |
virtual bool | loadResource (Core::Resource *&resource, Core::File const &file, std::string const &mappingName) override |
Public Member Functions inherited from Ocular::Core::AResourceLoader | |
AResourceLoader (std::string const &extension, ResourceType type) | |
virtual std::string | getSupportedFileType () const |
virtual bool | loadSubResource (Resource *&resource, File const &file, std::string const &mappingName) |
virtual bool | exploreResource (File const &file) |
ResourceType | getResourceType () const |
Protected Member Functions | |
virtual bool | readFile (Core::File const &file, std::vector< Core::Color > &pixels, unsigned &width, unsigned &height)=0 |
virtual bool | createResource (Core::Resource *&resource, Core::File const &file, std::vector< Core::Color > const &pixels, unsigned const &width, unsigned const &height) |
virtual void | loadFileIntoBuffer (Core::File const &file, std::vector< unsigned char > &buffer, Endianness fileEndianness) |
Protected Member Functions inherited from Ocular::Core::AResourceLoader | |
bool | isFileValid (Core::File const &file) const |
Additional Inherited Members | |
Protected Attributes inherited from Ocular::Core::AResourceLoader | |
std::string | m_SupportedExtension |
ResourceType | m_Type |
This is a common base implementation for all other ResourceLoaders that deal with creating and loading Texture2D resources. It provides a common base loadResource method as well as multiple utility helper methods.
By inheriting from TextureResourceLoader instead of AResourceLoader, the developer needs to only worry about their specific readFile implementation.
|
protectedvirtual |
Creates the new Texture2D resource from provided pixel data.
[out] | resource | The newly created resource. |
[in] | file | Source file for the resource. |
[in] | pixels | Pixel data for the texture arranged by rows. |
[in] | width | Width of the texture. |
[in] | height | Height of the texture. |
|
protectedvirtual |
Attempts to load the binary contents of the specified file into the provided empty buffer. If the data was properly retrieved, it will then be converted to the current system's native endianness.
[in] | file | Source file of the resource texture. |
[out] | buffer | Raw binary data of the file. |
[in] | fileEndianness | The endianness of the file. |
|
overridevirtual |
[out] | resource | |
[in] | file | |
[in] | mappingName |
Reimplemented from Ocular::Core::AResourceLoader.
|
protectedpure virtual |
Each TextureResourceLoader must provide a custom implementation for it's specific file type.
[in] | file | Source file to read from. |
[out] | pixels | Texture pixel data read in from the file. |
[out] | width | Width of the texture. |
[out] | height | Height of the texture. |
Implemented in Ocular::Graphics::TextureResourceLoader_BMP, Ocular::Graphics::TextureResourceLoader_PNG, and Ocular::Graphics::TextureResourceLoader_TGA.