Ocular Engine
Ocular::Graphics::MeshResourceSaver Class Referenceabstract

#include <MeshResourceSaver.hpp>

Inheritance diagram for Ocular::Graphics::MeshResourceSaver:
Ocular::Core::AResourceSaver Ocular::Graphics::MeshResourceSaver_PLY

Public Member Functions

 MeshResourceSaver (std::string const &extension)
virtual bool saveResource (Core::Resource *resource, Core::File const &file)
- Public Member Functions inherited from Ocular::Core::AResourceSaver
 AResourceSaver (std::string const &extension, ResourceType type)
virtual std::string getSupportedFileType () const
ResourceType getResourceType () const

Protected Member Functions

virtual bool saveFile (Core::File const &file, VertexBuffer const *vertexBuffer, IndexBuffer const *indexBuffer)=0
virtual bool isFileValid (Core::File &file)
- Protected Member Functions inherited from Ocular::Core::AResourceSaver
virtual bool writeFile (Core::File const &file, std::vector< unsigned char > buffer, Endianness fileEndianness)

Additional Inherited Members

- Protected Attributes inherited from Ocular::Core::AResourceSaver
std::string m_SupportedExtension
ResourceType m_Type

Detailed Description

This is a common base implementation for all other ResourceSavers that deal with saving Mesh resources to disk. It provides a common base saveResource method as well as multiple utility helper methods.

By inheriting from MeshResourceSaver instead of AResourceSaver, the developer needs to only worry about their specific saveFile implementation.

Member Function Documentation

bool Ocular::Graphics::MeshResourceSaver::isFileValid ( Core::File file)

Checks if the specified file is valid. It can be valid in one of two ways:

  • The file exists and is writeable
  • The file did not previously exist, but it (and potentially it's parent directories) successfully created
TRUE if the file is valid.
virtual bool Ocular::Graphics::MeshResourceSaver::saveFile ( Core::File const &  file,
VertexBuffer const *  vertexBuffer,
IndexBuffer const *  indexBuffer 
protectedpure virtual

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

The input into this method is guaranteed to be valid. This means

  • The source file exists and is writeable
  • The dimensions are valid
  • There is a non-zero number of pixels, and their number is equal to (width * height)
[in]fileFile to write to. This file has already been verified to exist and be writeable.
[in]vertexBufferVertex data to write
[in]indexBufferIndex data to write
TRUE if the file was successfully saved.

Implemented in Ocular::Graphics::MeshResourceSaver_PLY.

bool Ocular::Graphics::MeshResourceSaver::saveResource ( Core::Resource resource,
Core::File const &  file 

Reimplemented from Ocular::Core::AResourceSaver.

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