Assimp  v4.1. (December 2018)
Assimp::Q3BSPFileImporter Class Reference

Loader to import BSP-levels from a PK3 archive or from a unpacked BSP-level. 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...
 
 Q3BSPFileImporter ()
 Default constructor. More...
 
 ~Q3BSPFileImporter ()
 Destructor. More...
 
- Public Member Functions inherited from Assimp::BaseImporter
 BaseImporter () AI_NO_EXCEPT
 Constructor to be privately used by Importer. More...
 
virtual const ImporterUnitsGetApplicationUnits ()
 
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...
 
virtual double GetFileScale () const
 
aiSceneReadFile (Importer *pImp, const std::string &pFile, IOSystem *pIOHandler)
 Imports the given file and returns the imported data. More...
 
virtual void SetApplicationUnits (const ImporterUnits &unit)
 
virtual void SetFileScale (double scale)
 Will be called only by scale process when scaling is requested. More...
 
virtual void SetupProperties (const Importer *pImp)
 Called prior to ReadFile(). More...
 
virtual ~BaseImporter ()
 Destructor, private as well. More...
 

Protected Types

typedef std::map< std::string, std::vector< Q3BSP::sQ3BSPFace * > * > FaceMap
 
typedef std::map< std::string, std::vector< Q3BSP::sQ3BSPFace * > * >::const_iterator FaceMapConstIt
 
typedef std::map< std::string, std::vector< Q3BSP::sQ3BSPFace * > * >::iterator FaceMapIt
 

Protected Member Functions

size_t countData (const std::vector< Q3BSP::sQ3BSPFace * > &rArray) const
 
size_t countFaces (const std::vector< Q3BSP::sQ3BSPFace * > &rArray) const
 
size_t countTriangles (const std::vector< Q3BSP::sQ3BSPFace * > &rArray) const
 
void CreateDataFromImport (const Q3BSP::Q3BSPModel *pModel, aiScene *pScene, ZipArchiveIOSystem *pArchive)
 
void createMaterialMap (const Q3BSP::Q3BSPModel *pModel)
 
void createMaterials (const Q3BSP::Q3BSPModel *pModel, aiScene *pScene, ZipArchiveIOSystem *pArchive)
 
void CreateNodes (const Q3BSP::Q3BSPModel *pModel, aiScene *pScene, aiNode *pParent)
 
aiNodeCreateTopology (const Q3BSP::Q3BSPModel *pModel, unsigned int materialIdx, std::vector< Q3BSP::sQ3BSPFace * > &rArray, aiMesh **pMesh)
 
void createTriangleTopology (const Q3BSP::Q3BSPModel *pModel, Q3BSP::sQ3BSPFace *pQ3BSPFace, aiMesh *pMesh, unsigned int &rFaceIdx, unsigned int &rVertIdx)
 
bool expandFile (ZipArchiveIOSystem *pArchive, const std::string &rFilename, const std::vector< std::string > &rExtList, std::string &rFile, std::string &rExt)
 
bool findFirstMapInArchive (ZipArchiveIOSystem &rArchive, std::string &rMapName)
 
const aiImporterDescGetInfo () const
 Called by #Importer::GetImporterInfo to get a description of some loader features. More...
 
aiFacegetNextFace (aiMesh *pMesh, unsigned int &rFaceIdx)
 
bool importEntities (const Q3BSP::Q3BSPModel *pModel, aiScene *pScene)
 
bool importLightmap (const Q3BSP::Q3BSPModel *pModel, aiScene *pScene, aiMaterial *pMatHelper, int lightmapId)
 
bool importTextureFromArchive (const Q3BSP::Q3BSPModel *pModel, ZipArchiveIOSystem *pArchive, aiScene *pScene, aiMaterial *pMatHelper, int textureId)
 
void InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
 Imports the given file into the given scene structure. More...
 
void separateMapName (const std::string &rImportName, std::string &rArchiveName, std::string &rMapName)
 

Additional Inherited Members

- Public Types inherited from Assimp::BaseImporter
enum  ImporterUnits {
  M , MM , CM , INCHES ,
  FEET
}
 
enum  TextFileMode { ALLOW_EMPTY , FORBID_EMPTY }
 Enum to define, if empty files are ok or not. More...
 
- 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, bool noAlphaBeforeTokens=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...
 
- Public Attributes inherited from Assimp::BaseImporter
std::map< ImporterUnits, double > importerUnits
 Assimp Importer unit conversions available if you need another measurment unit add it below. More...
 
- Protected Attributes inherited from Assimp::BaseImporter
ImporterUnits applicationUnits = ImporterUnits::M
 
double fileScale = 1.0
 
double importerScale = 1.0
 
std::string m_ErrorText
 Error description in case there was one. More...
 
ProgressHandlerm_progress
 Currently set progress handler. More...
 

Detailed Description

Loader to import BSP-levels from a PK3 archive or from a unpacked BSP-level.

Member Typedef Documentation

◆ FaceMap

typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*> Assimp::Q3BSPFileImporter::FaceMap
protected

◆ FaceMapConstIt

typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>::const_iterator Assimp::Q3BSPFileImporter::FaceMapConstIt
protected

◆ FaceMapIt

typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>* >::iterator Assimp::Q3BSPFileImporter::FaceMapIt
protected

Constructor & Destructor Documentation

◆ Q3BSPFileImporter()

Assimp::Q3BSPFileImporter::Q3BSPFileImporter ( )

Default constructor.

◆ ~Q3BSPFileImporter()

Assimp::Q3BSPFileImporter::~Q3BSPFileImporter ( )

Destructor.

Member Function Documentation

◆ CanRead()

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

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

Remarks
See BaseImporter::CanRead() for details.

Implements Assimp::BaseImporter.

◆ countData()

size_t Assimp::Q3BSPFileImporter::countData ( const std::vector< Q3BSP::sQ3BSPFace * > &  rArray) const
protected

◆ countFaces()

size_t Assimp::Q3BSPFileImporter::countFaces ( const std::vector< Q3BSP::sQ3BSPFace * > &  rArray) const
protected

◆ countTriangles()

size_t Assimp::Q3BSPFileImporter::countTriangles ( const std::vector< Q3BSP::sQ3BSPFace * > &  rArray) const
protected

◆ CreateDataFromImport()

void Assimp::Q3BSPFileImporter::CreateDataFromImport ( const Q3BSP::Q3BSPModel pModel,
aiScene pScene,
ZipArchiveIOSystem pArchive 
)
protected

◆ createMaterialMap()

void Assimp::Q3BSPFileImporter::createMaterialMap ( const Q3BSP::Q3BSPModel pModel)
protected

◆ createMaterials()

void Assimp::Q3BSPFileImporter::createMaterials ( const Q3BSP::Q3BSPModel pModel,
aiScene pScene,
ZipArchiveIOSystem pArchive 
)
protected

◆ CreateNodes()

void Assimp::Q3BSPFileImporter::CreateNodes ( const Q3BSP::Q3BSPModel pModel,
aiScene pScene,
aiNode pParent 
)
protected

◆ CreateTopology()

aiNode * Assimp::Q3BSPFileImporter::CreateTopology ( const Q3BSP::Q3BSPModel pModel,
unsigned int  materialIdx,
std::vector< Q3BSP::sQ3BSPFace * > &  rArray,
aiMesh **  pMesh 
)
protected

◆ createTriangleTopology()

void Assimp::Q3BSPFileImporter::createTriangleTopology ( const Q3BSP::Q3BSPModel pModel,
Q3BSP::sQ3BSPFace pQ3BSPFace,
aiMesh pMesh,
unsigned int &  rFaceIdx,
unsigned int &  rVertIdx 
)
protected

◆ expandFile()

bool Assimp::Q3BSPFileImporter::expandFile ( ZipArchiveIOSystem pArchive,
const std::string &  rFilename,
const std::vector< std::string > &  rExtList,
std::string &  rFile,
std::string &  rExt 
)
protected

◆ findFirstMapInArchive()

bool Assimp::Q3BSPFileImporter::findFirstMapInArchive ( ZipArchiveIOSystem rArchive,
std::string &  rMapName 
)
protected

◆ GetInfo()

const aiImporterDesc * Assimp::Q3BSPFileImporter::GetInfo ( ) const
protectedvirtual

Called by #Importer::GetImporterInfo to get a description of some loader features.

Importers must provide this information.

Implements Assimp::BaseImporter.

◆ getNextFace()

aiFace * Assimp::Q3BSPFileImporter::getNextFace ( aiMesh pMesh,
unsigned int &  rFaceIdx 
)
protected

◆ importEntities()

bool Assimp::Q3BSPFileImporter::importEntities ( const Q3BSP::Q3BSPModel pModel,
aiScene pScene 
)
protected

◆ importLightmap()

bool Assimp::Q3BSPFileImporter::importLightmap ( const Q3BSP::Q3BSPModel pModel,
aiScene pScene,
aiMaterial pMatHelper,
int  lightmapId 
)
protected

◆ importTextureFromArchive()

bool Assimp::Q3BSPFileImporter::importTextureFromArchive ( const Q3BSP::Q3BSPModel pModel,
ZipArchiveIOSystem pArchive,
aiScene pScene,
aiMaterial pMatHelper,
int  textureId 
)
protected

◆ InternReadFile()

void Assimp::Q3BSPFileImporter::InternReadFile ( const std::string &  pFile,
aiScene pScene,
IOSystem pIOHandler 
)
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:

  • At least a root node must be there, even if its only purpose is to reference one mesh.
  • aiMesh::mPrimitiveTypes may be 0. The types of primitives in the mesh are determined automatically in this case.
  • the vertex data is stored in a pseudo-indexed "verbose" format. In fact this means that every vertex that is referenced by a face is unique. Or the other way round: a vertex index may not occur twice in a single aiMesh.
  • aiAnimation::mDuration may be -1. Assimp determines the length of the animation automatically in this case as the length of the longest animation channel.
  • aiMesh::mBitangents may be NULL if tangents and normals are given. In this case bitangents are computed as the cross product between normal and tangent.
  • There needn't be a material. If none is there a default material is generated. However, it is recommended practice for loaders to generate a default material for yourself that matches the default material setting for the file format better than Assimp's generic default material. Note that default materials should be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy) texture.

If the AI_SCENE_FLAGS_INCOMPLETE-Flag is not set:

  • at least one mesh must be there
  • there may be no meshes with 0 vertices or faces

This won't be checked (except by the validation step): Assimp will crash if one of the conditions is not met!

Parameters
pFilePath of the file to be imported.
pSceneThe scene object to hold the imported data. NULL is not a valid parameter.
pIOHandlerThe IO handler to use for any file access. NULL is not a valid parameter.

Implements Assimp::BaseImporter.

◆ separateMapName()

void Assimp::Q3BSPFileImporter::separateMapName ( const std::string &  rImportName,
std::string &  rArchiveName,
std::string &  rMapName 
)
protected

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