Assimp
v3.1.1 (June 2014)
|
Importer class to load Terragen (0.9) terrain files. More...
Inherits Assimp::BaseImporter.
Public Member Functions | |
bool | CanRead (const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const |
Returns whether the class can handle the format of the given file. More... | |
TerragenImporter () | |
~TerragenImporter () | |
![]() | |
BaseImporter () | |
Constructor to be privately used by Importer. More... | |
const std::string & | GetErrorText () const |
Returns the error description of the last error that occurred. More... | |
void | GetExtensionList (std::set< std::string > &extensions) |
Called by #Importer::GetExtensionList for each loaded importer. More... | |
aiScene * | ReadFile (const Importer *pImp, const std::string &pFile, IOSystem *pIOHandler) |
Imports the given file and returns the imported data. More... | |
virtual | ~BaseImporter () |
Destructor, private as well. More... | |
Protected Member Functions | |
const aiImporterDesc * | GetInfo () const |
Called by #Importer::GetImporterInfo to get a description of some loader features. More... | |
void | InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) |
Imports the given file into the given scene structure. More... | |
void | SetupProperties (const Importer *pImp) |
Called prior to ReadFile(). More... | |
Additional Inherited Members | |
![]() | |
enum | TextFileMode { ALLOW_EMPTY, FORBID_EMPTY } |
![]() | |
static bool | CheckMagicToken (IOSystem *pIOHandler, const std::string &pFile, const void *magic, unsigned int num, unsigned int offset=0, unsigned int size=4) |
Check whether a file starts with one or more magic tokens. More... | |
static void | ConvertToUTF8 (std::vector< char > &data) |
An utility for all text file loaders. More... | |
static void | ConvertUTF8toISO8859_1 (std::string &data) |
An utility for all text file loaders. More... | |
template<typename T > | |
static AI_FORCE_INLINE void | CopyVector (std::vector< T > &vec, T *&out, unsigned int &outLength) |
Utility function to move a std::vector into a aiScene array. More... | |
static std::string | GetExtension (const std::string &pFile) |
Extract file extension from a string. More... | |
static bool | SearchFileHeaderForToken (IOSystem *pIOSystem, const std::string &file, const char **tokens, unsigned int numTokens, unsigned int searchBytes=200, bool tokensSol=false) |
A utility for CanRead(). More... | |
static bool | SimpleExtensionCheck (const std::string &pFile, const char *ext0, const char *ext1=NULL, const char *ext2=NULL) |
Check whether a file has a specific file extension. More... | |
static void | TextFileToBuffer (IOStream *stream, std::vector< char > &data, TextFileMode mode=FORBID_EMPTY) |
Utility for text file loaders which copies the contents of the file into a memory buffer and converts it to our UTF8 representation. More... | |
![]() | |
std::string | m_ErrorText |
Error description in case there was one. More... | |
ProgressHandler * | m_progress |
Currently set progress handler. More... | |
Importer class to load Terragen (0.9) terrain files.
The loader is basing on the information found here: http://www.planetside.co.uk/terragen/dev/tgterrain.html#chunks
TerragenImporter::TerragenImporter | ( | ) |
TerragenImporter::~TerragenImporter | ( | ) |
|
virtual |
Returns whether the class can handle the format of the given file.
The implementation should be as quick as possible. A check for the file extension is enough. If no suitable loader is found with this strategy, CanRead() is called again, the 'checkSig' parameter set to true this time. Now the implementation is expected to perform a full check of the file structure, possibly searching the first bytes of the file for magic identifiers or keywords.
pFile | Path and file name of the file to be examined. |
pIOHandler | The IO handler to use for accessing any file. |
checkSig | Set to true if this method is called a second time. This time, the implementation may take more time to examine the contents of the file to be loaded for magic bytes, keywords, etc to be able to load files with unknown/not existent file extensions. |
Implements Assimp::BaseImporter.
|
protectedvirtual |
Called by #Importer::GetImporterInfo to get a description of some loader features.
Importers must provide this information.
Implements Assimp::BaseImporter.
|
protectedvirtual |
Imports the given file into the given scene structure.
The function is expected to throw an ImportErrorException if there is an error. If it terminates normally, the data in aiScene is expected to be correct. Override this function to implement the actual importing.
The output scene must meet the following requirements:
If the AI_SCENE_FLAGS_INCOMPLETE-Flag is not set:
This won't be checked (except by the validation step): Assimp will crash if one of the conditions is not met!
pFile | Path of the file to be imported. |
pScene | The scene object to hold the imported data. NULL is not a valid parameter. |
pIOHandler | The IO handler to use for any file access. NULL is not a valid parameter. |
Implements Assimp::BaseImporter.
|
protectedvirtual |
Called prior to ReadFile().
The function is a request to the importer to update its configuration basing on the Importer's configuration property list.
pImp | Importer instance |
Reimplemented from Assimp::BaseImporter.