Add usage of log macros, next files.

This commit is contained in:
kimkulling
2018-04-19 17:21:21 +02:00
parent 066349f36b
commit b6f29bf54f
35 changed files with 128 additions and 129 deletions

View File

@@ -187,37 +187,37 @@ void MDLImporter::InternReadFile( const std::string& pFile,
// Original Quake1 format
if (AI_MDL_MAGIC_NUMBER_BE == iMagicWord || AI_MDL_MAGIC_NUMBER_LE == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: Quake 1, magic word is IDPO");
ASSIMP_LOG_DEBUG("MDL subtype: Quake 1, magic word is IDPO");
iGSFileVersion = 0;
InternReadFile_Quake1();
}
// GameStudio A<old> MDL2 format - used by some test models that come with 3DGS
else if (AI_MDL_MAGIC_NUMBER_BE_GS3 == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS3 == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A2, magic word is MDL2");
ASSIMP_LOG_DEBUG("MDL subtype: 3D GameStudio A2, magic word is MDL2");
iGSFileVersion = 2;
InternReadFile_Quake1();
}
// GameStudio A4 MDL3 format
else if (AI_MDL_MAGIC_NUMBER_BE_GS4 == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS4 == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A4, magic word is MDL3");
ASSIMP_LOG_DEBUG("MDL subtype: 3D GameStudio A4, magic word is MDL3");
iGSFileVersion = 3;
InternReadFile_3DGS_MDL345();
}
// GameStudio A5+ MDL4 format
else if (AI_MDL_MAGIC_NUMBER_BE_GS5a == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS5a == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A4, magic word is MDL4");
ASSIMP_LOG_DEBUG("MDL subtype: 3D GameStudio A4, magic word is MDL4");
iGSFileVersion = 4;
InternReadFile_3DGS_MDL345();
}
// GameStudio A5+ MDL5 format
else if (AI_MDL_MAGIC_NUMBER_BE_GS5b == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS5b == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A5, magic word is MDL5");
ASSIMP_LOG_DEBUG("MDL subtype: 3D GameStudio A5, magic word is MDL5");
iGSFileVersion = 5;
InternReadFile_3DGS_MDL345();
}
// GameStudio A7 MDL7 format
else if (AI_MDL_MAGIC_NUMBER_BE_GS7 == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS7 == iMagicWord) {
DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A7, magic word is MDL7");
ASSIMP_LOG_DEBUG("MDL subtype: 3D GameStudio A7, magic word is MDL7");
iGSFileVersion = 7;
InternReadFile_3DGS_MDL7();
}
@@ -225,7 +225,7 @@ void MDLImporter::InternReadFile( const std::string& pFile,
else if (AI_MDL_MAGIC_NUMBER_BE_HL2a == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2a == iMagicWord ||
AI_MDL_MAGIC_NUMBER_BE_HL2b == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2b == iMagicWord)
{
DefaultLogger::get()->debug("MDL subtype: Source(tm) Engine, magic word is IDST/IDSQ");
ASSIMP_LOG_DEBUG("MDL subtype: Source(tm) Engine, magic word is IDST/IDSQ");
iGSFileVersion = 0;
InternReadFile_HL2();
}
@@ -258,7 +258,7 @@ void MDLImporter::SizeCheck(const void* szPos)
}
// ------------------------------------------------------------------------------------------------
// Just for debgging purposes
// Just for debugging purposes
void MDLImporter::SizeCheck(const void* szPos, const char* szFile, unsigned int iLine)
{
ai_assert(NULL != szFile);
@@ -298,20 +298,20 @@ void MDLImporter::ValidateHeader_Quake1(const MDL::Header* pcHeader)
if (!this->iGSFileVersion)
{
if (pcHeader->num_verts > AI_MDL_MAX_VERTS)
DefaultLogger::get()->warn("Quake 1 MDL model has more than AI_MDL_MAX_VERTS vertices");
ASSIMP_LOG_WARN("Quake 1 MDL model has more than AI_MDL_MAX_VERTS vertices");
if (pcHeader->num_tris > AI_MDL_MAX_TRIANGLES)
DefaultLogger::get()->warn("Quake 1 MDL model has more than AI_MDL_MAX_TRIANGLES triangles");
ASSIMP_LOG_WARN("Quake 1 MDL model has more than AI_MDL_MAX_TRIANGLES triangles");
if (pcHeader->num_frames > AI_MDL_MAX_FRAMES)
DefaultLogger::get()->warn("Quake 1 MDL model has more than AI_MDL_MAX_FRAMES frames");
ASSIMP_LOG_WARN("Quake 1 MDL model has more than AI_MDL_MAX_FRAMES frames");
// (this does not apply for 3DGS MDLs)
if (!this->iGSFileVersion && pcHeader->version != AI_MDL_VERSION)
DefaultLogger::get()->warn("Quake 1 MDL model has an unknown version: AI_MDL_VERSION (=6) is "
ASSIMP_LOG_WARN("Quake 1 MDL model has an unknown version: AI_MDL_VERSION (=6) is "
"the expected file format version");
if(pcHeader->num_skins && (!pcHeader->skinwidth || !pcHeader->skinheight))
DefaultLogger::get()->warn("Skin width or height are 0");
ASSIMP_LOG_WARN("Skin width or height are 0");
}
}
@@ -692,7 +692,7 @@ void MDLImporter::InternReadFile_3DGS_MDL345( )
unsigned int iIndex = pcTriangles->index_xyz[c];
if (iIndex >= (unsigned int)pcHeader->num_verts) {
iIndex = pcHeader->num_verts-1;
DefaultLogger::get()->warn("Index overflow in MDLn vertex list");
ASSIMP_LOG_WARN("Index overflow in MDLn vertex list");
}
aiVector3D& vec = pcMesh->mVertices[iCurrent];
@@ -747,7 +747,7 @@ void MDLImporter::InternReadFile_3DGS_MDL345( )
unsigned int iIndex = pcTriangles->index_xyz[c];
if (iIndex >= (unsigned int)pcHeader->num_verts) {
iIndex = pcHeader->num_verts-1;
DefaultLogger::get()->warn("Index overflow in MDLn vertex list");
ASSIMP_LOG_WARN("Index overflow in MDLn vertex list");
}
aiVector3D& vec = pcMesh->mVertices[iCurrent];
@@ -798,7 +798,7 @@ void MDLImporter::ImportUVCoordinate_3DGS_MDL345(
// validate UV indices
if (iIndex >= (unsigned int) pcHeader->synctype) {
iIndex = pcHeader->synctype-1;
DefaultLogger::get()->warn("Index overflow in MDLn UV coord list");
ASSIMP_LOG_WARN("Index overflow in MDLn UV coord list");
}
float s = (float)pcSrc[iIndex].u;
@@ -835,7 +835,7 @@ void MDLImporter::CalculateUVCoordinates_MDL5()
iWidth = (unsigned int)*piPtr;
if (!iHeight || !iWidth)
{
DefaultLogger::get()->warn("Either the width or the height of the "
ASSIMP_LOG_WARN("Either the width or the height of the "
"embedded DDS texture is zero. Unable to compute final texture "
"coordinates. The texture coordinates remain in their original "
"0-x/0-y (x,y = texture size) range.");
@@ -988,7 +988,7 @@ MDL::IntBone_MDL7** MDLImporter::LoadBones_3DGS_MDL7()
AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_32_CHARS != pcHeader->bone_stc_size &&
AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_NOT_THERE != pcHeader->bone_stc_size)
{
DefaultLogger::get()->warn("Unknown size of bone data structure");
ASSIMP_LOG_WARN("Unknown size of bone data structure");
return NULL;
}
@@ -1026,7 +1026,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) {
// (we might need to read this section a second time - to process frame vertices correctly)
pcGroupTris->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1;
DefaultLogger::get()->warn("Index overflow in MDL7 vertex list");
DASSIMP_LOG_WARN("Index overflow in MDL7 vertex list");
}
// write the output face index
@@ -1071,7 +1071,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
iIndex = pcGroupTris->skinsets[0].st_index[c];
if(iIndex > (unsigned int)groupInfo.pcGroup->num_stpts) {
iIndex = groupInfo.pcGroup->num_stpts-1;
DefaultLogger::get()->warn("Index overflow in MDL7 UV coordinate list (#1)");
ASSIMP_LOG_WARN("Index overflow in MDL7 UV coordinate list (#1)");
}
float u = groupInfo.pcGroupUVs[iIndex].u;
@@ -1098,7 +1098,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
iIndex = pcGroupTris->skinsets[1].st_index[c];
if(iIndex > (unsigned int)groupInfo.pcGroup->num_stpts) {
iIndex = groupInfo.pcGroup->num_stpts-1;
DefaultLogger::get()->warn("Index overflow in MDL7 UV coordinate list (#2)");
ASSIMP_LOG_WARN("Index overflow in MDL7 UV coordinate list (#2)");
}
float u = groupInfo.pcGroupUVs[ iIndex ].u;
@@ -1153,7 +1153,7 @@ bool MDLImporter::ProcessFrames_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInf
frame.pcFrame->transmatrix_count * pcHeader->bonetrans_stc_size;
if (((const char*)szCurrent - (const char*)pcHeader) + iAdd > (unsigned int)pcHeader->data_size) {
DefaultLogger::get()->warn("Index overflow in frame area. "
ASSIMP_LOG_WARN("Index overflow in frame area. "
"Ignoring all frames and all further mesh groups, too.");
// don't parse more groups if we can't even read one
@@ -1171,7 +1171,7 @@ bool MDLImporter::ProcessFrames_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInf
uint16_t iIndex = _AI_MDL7_ACCESS(pcFrameVertices,qq,pcHeader->framevertex_stc_size,MDL::Vertex_MDL7).vertindex;
AI_SWAP2(iIndex);
if (iIndex >= groupInfo.pcGroup->numverts) {
DefaultLogger::get()->warn("Invalid vertex index in frame vertex section");
ASSIMP_LOG_WARN("Invalid vertex index in frame vertex section");
continue;
}
@@ -1257,7 +1257,7 @@ void MDLImporter::SortByMaterials_3DGS_MDL7(
// sometimes MED writes -1, but normally only if there is only
// one skin assigned. No warning in this case
if(0xFFFFFFFF != groupData.pcFaces[iFace].iMatIndex[0])
DefaultLogger::get()->warn("Index overflow in MDL7 material list [#0]");
ASSIMP_LOG_WARN("Index overflow in MDL7 material list [#0]");
}
else splitGroupData.aiSplit[groupData.pcFaces[iFace].
iMatIndex[0]]->push_back(iFace);
@@ -1282,7 +1282,7 @@ void MDLImporter::SortByMaterials_3DGS_MDL7(
// sometimes MED writes -1, but normally only if there is only
// one skin assigned. No warning in this case
if(UINT_MAX != iMatIndex)
DefaultLogger::get()->warn("Index overflow in MDL7 material list [#1]");
ASSIMP_LOG_WARN("Index overflow in MDL7 material list [#1]");
iMatIndex = iNumMaterials-1;
}
unsigned int iMatIndex2 = groupData.pcFaces[iFace].iMatIndex[1];
@@ -1292,7 +1292,7 @@ void MDLImporter::SortByMaterials_3DGS_MDL7(
if (iMatIndex2 >= iNumMaterials) {
// sometimes MED writes -1, but normally only if there is only
// one skin assigned. No warning in this case
DefaultLogger::get()->warn("Index overflow in MDL7 material list [#2]");
ASSIMP_LOG_WARN("Index overflow in MDL7 material list [#2]");
iMatIndex2 = iNumMaterials-1;
}
@@ -1414,7 +1414,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
if (1 != groupInfo.pcGroup->typ) {
// Not a triangle-based mesh
DefaultLogger::get()->warn("[3DGS MDL7] Not a triangle mesh group. Continuing happily");
ASSIMP_LOG_WARN("[3DGS MDL7] Not a triangle mesh group. Continuing happily");
}
// store the name of the group
@@ -1516,7 +1516,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
sharedData.abNeedMaterials[qq] = true;
}
}
else DefaultLogger::get()->warn("[3DGS MDL7] Mesh group consists of 0 "
else ASSIMP_LOG_WARN("[3DGS MDL7] Mesh group consists of 0 "
"vertices or faces. It will be skipped.");
// process all frames and generate output meshes
@@ -1664,7 +1664,7 @@ void MDLImporter::ParseBoneTrafoKeys_3DGS_MDL7(
// read all transformation matrices
for (unsigned int iTrafo = 0; iTrafo < frame.pcFrame->transmatrix_count;++iTrafo) {
if(pcBoneTransforms->bone_index >= pcHeader->bones_num) {
DefaultLogger::get()->warn("Index overflow in frame area. "
ASSIMP_LOG_WARN("Index overflow in frame area. "
"Unable to parse this bone transformation");
}
else {
@@ -1676,7 +1676,7 @@ void MDLImporter::ParseBoneTrafoKeys_3DGS_MDL7(
}
}
else {
DefaultLogger::get()->warn("Ignoring animation keyframes in groups != 0");
ASSIMP_LOG_WARN("Ignoring animation keyframes in groups != 0");
}
}
}