Assimp  v3.1.1 (June 2014)
Assimp::HMPImporter Class Reference

Used to load 3D GameStudio HMP files (terrains) More...

Inherits Assimp::MDLImporter.

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...
 
 HMPImporter ()
 
 ~HMPImporter ()
 
- Public Member Functions inherited from Assimp::MDLImporter
bool CanRead (const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
 Returns whether the class can handle the format of the given file. More...
 
 MDLImporter ()
 
void SetupProperties (const Importer *pImp)
 Called prior to ReadFile(). More...
 
 ~MDLImporter ()
 
- Public Member Functions inherited from Assimp::BaseImporter
 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...
 
aiSceneReadFile (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

void CreateMaterial (const unsigned char *szCurrent, const unsigned char **szCurrentOut)
 Try to load one material from the file, if this fails create a default material. More...
 
void CreateOutputFaceList (unsigned int width, unsigned int height)
 Build a list of output faces and vertices. More...
 
void GenerateTextureCoords (const unsigned int width, const unsigned int height)
 Generate planar texture coordinates for a terrain. More...
 
const aiImporterDescGetInfo () const
 Return importer meta information. More...
 
void InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
 Imports the given file into the given scene structure. More...
 
void InternReadFile_HMP4 ()
 Import a HMP4 file. More...
 
void InternReadFile_HMP5 ()
 Import a HMP5 file. More...
 
void InternReadFile_HMP7 ()
 Import a HMP7 file. More...
 
void ReadFirstSkin (unsigned int iNumSkins, const unsigned char *szCursor, const unsigned char **szCursorOut)
 Read the first skin from the file and skip all others ... More...
 
void ValidateHeader_HMP457 ()
 Validate a HMP 5,4,7 file header. More...
 
- Protected Member Functions inherited from Assimp::MDLImporter
void AddAnimationBoneTrafoKey_3DGS_MDL7 (unsigned int iTrafo, const MDL::BoneTransform_MDL7 *pcBoneTransforms, MDL::IntBone_MDL7 **apcBonesOut)
 Add a bone transformation key to an animation. More...
 
void AddBonesToNodeGraph_3DGS_MDL7 (const MDL::IntBone_MDL7 **apcBonesOut, aiNode *pcParent, uint16_t iParentIndex)
 Add all bones to the nodegraph (as children of the root node) More...
 
void BuildOutputAnims_3DGS_MDL7 (const MDL::IntBone_MDL7 **apcBonesOut)
 Build output animations. More...
 
void CalcAbsBoneMatrices_3DGS_MDL7 (MDL::IntBone_MDL7 **apcOutBones)
 Calculate absolute bone animation matrices for each bone. More...
 
void CalculateUVCoordinates_MDL5 ()
 Converts the absolute texture coordinates in MDL5 files to relative in a range between 0 and 1. More...
 
void CopyMaterials_3DGS_MDL7 (MDL::IntSharedData_MDL7 &shared)
 Copies only the material that are referenced by at least one mesh to the final output material list. More...
 
void CreateTexture_3DGS_MDL4 (const unsigned char *szData, unsigned int iType, unsigned int *piSkip)
 Used to load textures from MDL3/4. More...
 
void CreateTexture_3DGS_MDL5 (const unsigned char *szData, unsigned int iType, unsigned int *piSkip)
 Used to load textures from MDL5. More...
 
void CreateTextureARGB8_3DGS_MDL3 (const unsigned char *szData)
 Load a paletized texture from the file and convert it to 32bpp. More...
 
void FreePalette (const unsigned char *pszColorMap)
 Free a palette created with a previous call to SearchPalette() More...
 
void GenerateOutputMeshes_3DGS_MDL7 (MDL::IntGroupData_MDL7 &groupData, MDL::IntSplitGroupData_MDL7 &splitGroupData)
 Generate the final output meshes for a7 models. More...
 
const aiImporterDescGetInfo () const
 Return importer meta information. More...
 
void HandleMaterialReferences_3DGS_MDL7 ()
 Handles materials that are just referencing another material There is no test file for this feature, but Conitec's doc say it is used. More...
 
void ImportUVCoordinate_3DGS_MDL345 (aiVector3D &vOut, const MDL::TexCoord_MDL3 *pcSrc, unsigned int iIndex)
 Read an UV coordinate from the file. More...
 
void InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
 Imports the given file into the given scene structure. More...
 
void InternReadFile_3DGS_MDL345 ()
 Import a GameStudio A4/A5 file (MDL 3,4,5) More...
 
void InternReadFile_3DGS_MDL7 ()
 Import a GameStudio A7 file (MDL 7) More...
 
void InternReadFile_HL2 ()
 Import a CS:S/HL2 MDL file (not fully implemented) More...
 
void InternReadFile_Quake1 ()
 Import a quake 1 MDL file (IDPO) More...
 
void JoinSkins_3DGS_MDL7 (aiMaterial *pcMat1, aiMaterial *pcMat2, aiMaterial *pcMatOut)
 Join two materials / skins. More...
 
MDL::IntBone_MDL7 ** LoadBones_3DGS_MDL7 ()
 Load the bone list of a MDL7 file. More...
 
void ParseBoneTrafoKeys_3DGS_MDL7 (const MDL::IntGroupInfo_MDL7 &groupInfo, IntFrameInfo_MDL7 &frame, MDL::IntSharedData_MDL7 &shared)
 Load bone transformation keyframes from a file chunk. More...
 
void ParseSkinLump_3DGS_MDL7 (const unsigned char *szCurrent, const unsigned char **szCurrentOut, std::vector< aiMaterial *> &pcMats)
 Parse a skin lump in a MDL7/HMP7 file with all of its features variant 1: Current cursor position is the beginning of the skin header. More...
 
void ParseSkinLump_3DGS_MDL7 (const unsigned char *szCurrent, const unsigned char **szCurrentOut, aiMaterial *pcMatOut, unsigned int iType, unsigned int iWidth, unsigned int iHeight)
 Parse a skin lump in a MDL7/HMP7 file with all of its features variant 2: Current cursor position is the beginning of the skin data. More...
 
void ParseTextureColorData (const unsigned char *szData, unsigned int iType, unsigned int *piSkip, aiTexture *pcNew)
 Parse texture color data for MDL5, MDL6 and MDL7 formats. More...
 
bool ProcessFrames_3DGS_MDL7 (const MDL::IntGroupInfo_MDL7 &groupInfo, MDL::IntGroupData_MDL7 &groupData, MDL::IntSharedData_MDL7 &shared, const unsigned char *szCurrent, const unsigned char **szCurrentOut)
 Process the frame section at the end of a group. More...
 
void ReadFaces_3DGS_MDL7 (const MDL::IntGroupInfo_MDL7 &groupInfo, MDL::IntGroupData_MDL7 &groupData)
 Read all faces and vertices from a MDL7 group. More...
 
aiColor4D ReplaceTextureWithColor (const aiTexture *pcTexture)
 Checks whether a texture can be replaced with a single color This is useful for all file formats before MDL7 (all those that are not containing material colors separate from textures). More...
 
void SearchPalette (const unsigned char **pszColorMap)
 Try to load a palette from the current directory (colormap.lmp) If it is not found the default palette of Quake1 is returned. More...
 
void SetupMaterialProperties_3DGS_MDL5_Quake1 ()
 Setup the material properties for Quake and MDL<7 models. More...
 
void SizeCheck (const void *szPos)
 Check whether a given position is inside the valid range Throw a DeadlyImportError if it is not. More...
 
void SizeCheck (const void *szPos, const char *szFile, unsigned int iLine)
 
void SkipSkinLump_3DGS_MDL7 (const unsigned char *szCurrent, const unsigned char **szCurrentOut, unsigned int iType, unsigned int iWidth, unsigned int iHeight)
 Skip a skin lump in a MDL7/HMP7 file. More...
 
void SortByMaterials_3DGS_MDL7 (const MDL::IntGroupInfo_MDL7 &groupInfo, MDL::IntGroupData_MDL7 &groupData, MDL::IntSplitGroupData_MDL7 &splitGroupData)
 Sort all faces by their materials. More...
 
void ValidateHeader_3DGS_MDL7 (const MDL::Header_MDL7 *pcHeader)
 Validate the header data structure of a game studio MDL7 file. More...
 
void ValidateHeader_Quake1 (const MDL::Header *pcHeader)
 Validate the header data structure of a Quake 1 model. More...
 

Additional Inherited Members

- Public Types inherited from Assimp::BaseImporter
enum  TextFileMode { ALLOW_EMPTY, FORBID_EMPTY }
 
- Static Public Member Functions inherited from Assimp::BaseImporter
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...
 
- Protected Attributes inherited from Assimp::MDLImporter
unsigned int configFrameID
 Configuration option: frame to be loaded. More...
 
std::string configPalette
 Configuration option: palette to be used to decode palletized images. More...
 
unsigned int iFileSize
 Size of the input file in bytes. More...
 
unsigned int iGSFileVersion
 For GameStudio MDL files: The number in the magic word, either 3,4 or 5 (MDL7 doesn't need this, the format has a separate loader) More...
 
unsigned char * mBuffer
 Buffer to hold the loaded file. More...
 
IOSystempIOHandler
 Output I/O handler. More...
 
aiScenepScene
 Output scene to be filled. More...
 
- Protected Attributes inherited from Assimp::BaseImporter
std::string m_ErrorText
 Error description in case there was one. More...
 
ProgressHandlerm_progress
 Currently set progress handler. More...
 

Detailed Description

Used to load 3D GameStudio HMP files (terrains)

Constructor & Destructor Documentation

◆ HMPImporter()

HMPImporter::HMPImporter ( )

◆ ~HMPImporter()

HMPImporter::~HMPImporter ( )

Member Function Documentation

◆ CanRead()

bool HMPImporter::CanRead ( const std::string &  pFile,
IOSystem pIOHandler,
bool  checkSig 
) const
virtual

Returns whether the class can handle the format of the given file.

See BaseImporter::CanRead() for details.

Implements Assimp::BaseImporter.

◆ CreateMaterial()

void HMPImporter::CreateMaterial ( const unsigned char *  szCurrent,
const unsigned char **  szCurrentOut 
)
protected

Try to load one material from the file, if this fails create a default material.

◆ CreateOutputFaceList()

void HMPImporter::CreateOutputFaceList ( unsigned int  width,
unsigned int  height 
)
protected

Build a list of output faces and vertices.

The function triangulates the height map read from the file

Parameters
widthWidth of the height field
widthHeight of the height field

◆ GenerateTextureCoords()

void HMPImporter::GenerateTextureCoords ( const unsigned int  width,
const unsigned int  height 
)
protected

Generate planar texture coordinates for a terrain.

Parameters
widthWidth of the terrain, in vertices
heightHeight of the terrain, in vertices

◆ GetInfo()

const aiImporterDesc * HMPImporter::GetInfo ( ) const
protectedvirtual

Return importer meta information.

See #BaseImporter::GetInfo for the details

Implements Assimp::BaseImporter.

◆ InternReadFile()

void HMPImporter::InternReadFile ( const std::string &  pFile,
aiScene pScene,
IOSystem pIOHandler 
)
protectedvirtual

Imports the given file into the given scene structure.

See BaseImporter::InternReadFile() for details

Implements Assimp::BaseImporter.

◆ InternReadFile_HMP4()

void HMPImporter::InternReadFile_HMP4 ( )
protected

Import a HMP4 file.

◆ InternReadFile_HMP5()

void HMPImporter::InternReadFile_HMP5 ( )
protected

Import a HMP5 file.

◆ InternReadFile_HMP7()

void HMPImporter::InternReadFile_HMP7 ( )
protected

Import a HMP7 file.

◆ ReadFirstSkin()

void HMPImporter::ReadFirstSkin ( unsigned int  iNumSkins,
const unsigned char *  szCursor,
const unsigned char **  szCursorOut 
)
protected

Read the first skin from the file and skip all others ...

Parameters
iNumSkinsNumber of skins in the file
szCursorPosition of the first skin (offset 84)

◆ ValidateHeader_HMP457()

void HMPImporter::ValidateHeader_HMP457 ( )
protected

Validate a HMP 5,4,7 file header.


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