Ocular Engine
Ocular::Graphics::MeshResourceLoader Class Referenceabstract

#include <MeshResourceLoader.hpp>

Inheritance diagram for Ocular::Graphics::MeshResourceLoader:
Ocular::Core::AResourceLoader Ocular::Graphics::MeshResourceLoader_PLY

Public Member Functions

 MeshResourceLoader (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< Graphics::Vertex > &vertices, std::vector< uint32_t > &indices, uint32_t &numVertices, uint32_t &numIndices, Math::Vector3f &min, Math::Vector3f &max)=0
 
virtual bool createResource (Core::Resource *&resource, Core::File const &file, std::vector< Graphics::Vertex > const &vertices, std::vector< uint32_t > const &indices, uint32_t numVertices, uint32_t numIndices, Math::Vector3f const &min, Math::Vector3f const &max)
 
- 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
 

Detailed Description

This is a common base implementation for all other ResourceLoaders that deal with creating and loading mesh resources. It provides a common base loadResource method as well as multiple utility helper methods.

By inheriting from MeshResourceLoader instead of AResourceLoader, the developer needs to only worry about their specific readFile implementation.

Member Function Documentation

bool Ocular::Graphics::MeshResourceLoader::createResource ( Core::Resource *&  resource,
Core::File const &  file,
std::vector< Graphics::Vertex > const &  vertices,
std::vector< uint32_t > const &  indices,
uint32_t  numVertices,
uint32_t  numIndices,
Math::Vector3f const &  min,
Math::Vector3f const &  max 
)
protectedvirtual

Creates the new Mesh resource from provided data.

Parameters
[out]resourceThe newly created resource.
[in]fileSource file for the resource.
[in]pixelsPixel data for the texture arranged by rows.
[in]widthWidth of the texture.
[in]heightHeight of the texture.
[in]numVerticesNumber of vertices in the mesh (depending on the loader implementation, this may not equal vertices.size())
[in]numIndicesNumber of indices in the mesh (depending on the loader implementation, this may not equal indices.size())
[in]minThe minimum spatial point along the local axis among all vertices
[in]maxThe maximum spatial point along the local axis among all vertices
Returns
TRUE if creation was successful.
bool Ocular::Graphics::MeshResourceLoader::loadResource ( Core::Resource *&  resource,
Core::File const &  file,
std::string const &  mappingName 
)
overridevirtual
Parameters
[out]resource
[in]file
[in]mappingName

Reimplemented from Ocular::Core::AResourceLoader.

virtual bool Ocular::Graphics::MeshResourceLoader::readFile ( Core::File const &  file,
std::vector< Graphics::Vertex > &  vertices,
std::vector< uint32_t > &  indices,
uint32_t &  numVertices,
uint32_t &  numIndices,
Math::Vector3f min,
Math::Vector3f max 
)
protectedpure virtual

Each MeshResourceLoader must provide a custom implementation for it's specific file type.

Parameters
[in]fileSource file to read from.
[out]verticesTexture pixel data read in from the file.
[out]indicesWidth of the texture.
[out]numVerticesNumber of vertices in the mesh (depending on the loader implementation, this may not equal vertices.size())
[out]numIndicesNumber of indices in the mesh (depending on the loader implementation, this may not equal indices.size())
[out]minThe minimum spatial point along the local axis among all vertices
[out]maxThe maximum spatial point along the local axis among all vertices
Returns
TRUE if file was read in successfully.

Implemented in Ocular::Graphics::MeshResourceLoader_PLY.


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