INtroduce new log macros.

pull/1918/head
kimkulling 2018-04-26 14:10:18 +02:00
parent 0e15b25cd1
commit 30c20eb5fc
65 changed files with 413 additions and 531 deletions

View File

@ -146,7 +146,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ReportSceneNotFoundError() { void ReportSceneNotFoundError() {
DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. " ASSIMP_LOG_ERROR("Unable to find the Assimp::Importer for this aiScene. "
"The C-API does not accept scenes produced by the C++ API and vice versa"); "The C-API does not accept scenes produced by the C++ API and vice versa");
ai_assert(false); ai_assert(false);

View File

@ -210,7 +210,7 @@ void DNAParser::Parse ()
s.size = offset; s.size = offset;
} }
ASSIMP_LOG_DEBUG( "BlenderDNA: Got ", dna.structures.size()," structures with totally ",fields," fields"); ASSIMP_LOG_DEBUG_F( "BlenderDNA: Got ", dna.structures.size()," structures with totally ",fields," fields");
#ifdef ASSIMP_BUILD_BLENDER_DEBUG #ifdef ASSIMP_BUILD_BLENDER_DEBUG
dna.DumpToFile(); dna.DumpToFile();

View File

@ -468,7 +468,7 @@ template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>(std::shar
// this might happen if DNA::RegisterConverters hasn't been called so far // this might happen if DNA::RegisterConverters hasn't been called so far
// or if the target type is not contained in `our` DNA. // or if the target type is not contained in `our` DNA.
out.reset(); out.reset();
ASSIMP_LOG_WARN( "Failed to find a converter for the `",s.name,"` structure" ); ASSIMP_LOG_WARN_F( "Failed to find a converter for the `",s.name,"` structure" );
return false; return false;
} }

View File

@ -86,7 +86,7 @@ public:
const Scene& /*in*/, const Scene& /*in*/,
const Object& /*orig_object*/ const Object& /*orig_object*/
) { ) {
ASSIMP_LOG_INFO_F("This modifier is not supported, skipping: "),orig_modifier.dna_type); ASSIMP_LOG_INFO_F("This modifier is not supported, skipping: ",orig_modifier.dna_type );
return; return;
} }
}; };

View File

@ -487,46 +487,6 @@ void COBImporter::UnsupportedChunk_Ascii(LineSplitter& splitter, const ChunkInfo
else ThrowException(error); else ThrowException(error);
} }
// ------------------------------------------------------------------------------------------------
void COBImporter::LogWarn_Ascii(const LineSplitter& splitter, const format& message) {
LogWarn_Ascii(message << " [at line "<< splitter.get_index()<<"]");
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogError_Ascii(const LineSplitter& splitter, const format& message) {
LogError_Ascii(message << " [at line "<< splitter.get_index()<<"]");
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogInfo_Ascii(const LineSplitter& splitter, const format& message) {
LogInfo_Ascii(message << " [at line "<< splitter.get_index()<<"]");
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogDebug_Ascii(const LineSplitter& splitter, const format& message) {
LogDebug_Ascii(message << " [at line "<< splitter.get_index()<<"]");
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogWarn_Ascii(const Formatter::format& message) {
ASSIMP_LOG_WARN_F( "COB: ", message );
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogError_Ascii(const Formatter::format& message) {
ASSIMP_LOG_ERROR_F( "COB: ", message);
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogInfo_Ascii(const Formatter::format& message) {
ASSIMP_LOG_INFO_F("COB: ", message);
}
// ------------------------------------------------------------------------------------------------
void COBImporter::LogDebug_Ascii(const Formatter::format& message) {
ASSIMP_LOG_DEBUG_F("COB: ", message);
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void COBImporter::ReadBasicNodeInfo_Ascii(Node& msh, LineSplitter& splitter, const ChunkInfo& /*nfo*/) void COBImporter::ReadBasicNodeInfo_Ascii(Node& msh, LineSplitter& splitter, const ChunkInfo& /*nfo*/)
{ {
@ -576,8 +536,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter; ++splitter;
if (!splitter.match_start("mat# ")) { if (!splitter.match_start("mat# ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id );
"Expected `mat#` line in `Mat1` chunk "<<nfo.id);
return; return;
} }
@ -589,8 +548,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter; ++splitter;
if (!splitter.match_start("shader: ")) { if (!splitter.match_start("shader: ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id);
"Expected `mat#` line in `Mat1` chunk "<<nfo.id);
return; return;
} }
std::string shader = std::string(splitter[1]); std::string shader = std::string(splitter[1]);
@ -603,14 +561,12 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
mat.shader = Material::PHONG; mat.shader = Material::PHONG;
} }
else if (shader != "flat") { else if (shader != "flat") {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Unknown value for `shader` in `Mat1` chunk ", nfo.id );
"Unknown value for `shader` in `Mat1` chunk "<<nfo.id);
} }
++splitter; ++splitter;
if (!splitter.match_start("rgb ")) { if (!splitter.match_start("rgb ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `rgb` line in `Mat1` chunk ", nfo.id);
"Expected `rgb` line in `Mat1` chunk "<<nfo.id);
} }
const char* rgb = splitter[1]; const char* rgb = splitter[1];
@ -618,8 +574,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter; ++splitter;
if (!splitter.match_start("alpha ")) { if (!splitter.match_start("alpha ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `alpha` line in `Mat1` chunk ", nfo.id);
"Expected `alpha` line in `Mat1` chunk "<<nfo.id);
} }
const char* tokens[10]; const char* tokens[10];
@ -640,8 +595,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
} }
++splitter; ++splitter;
if (!splitter.match_start("Units ")) { if (!splitter.match_start("Units ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `Units` line in `Unit` chunk ", nfo.id);
"Expected `Units` line in `Unit` chunk "<<nfo.id);
return; return;
} }
@ -652,13 +606,12 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
const unsigned int t=strtoul10(splitter[1]); const unsigned int t=strtoul10(splitter[1]);
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?( nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(
LogWarn_Ascii(splitter,format()<<t<<" is not a valid value for `Units` attribute in `Unit chunk` "<<nfo.id) ASSIMP_LOG_WARN_F(t, " is not a valid value for `Units` attribute in `Unit chunk` ", nfo.id)
,1.f):units[t]; ,1.f):units[t];
return; return;
} }
} }
LogWarn_Ascii(splitter,format()<<"`Unit` chunk "<<nfo.id<<" is a child of " ASSIMP_LOG_WARN_F( "`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
<<nfo.parent_id<<" which does not exist");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -692,15 +645,13 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
msh.ltype = Light::SPOT; msh.ltype = Light::SPOT;
} }
else { else {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Unknown kind of light source in `Lght` chunk ", nfo.id, " : ", *splitter );
"Unknown kind of light source in `Lght` chunk "<<nfo.id<<" : "<<*splitter);
msh.ltype = Light::SPOT; msh.ltype = Light::SPOT;
} }
++splitter; ++splitter;
if (!splitter.match_start("color ")) { if (!splitter.match_start("color ")) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `color` line in `Lght` chunk ", nfo.id );
"Expected `color` line in `Lght` chunk "<<nfo.id);
} }
const char* rgb = splitter[1]; const char* rgb = splitter[1];
@ -708,16 +659,14 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
SkipSpaces(&rgb); SkipSpaces(&rgb);
if (strncmp(rgb,"cone angle",10)) { if (strncmp(rgb,"cone angle",10)) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id );
"Expected `cone angle` entity in `color` line in `Lght` chunk "<<nfo.id);
} }
SkipSpaces(rgb+10,&rgb); SkipSpaces(rgb+10,&rgb);
msh.angle = fast_atof(&rgb); msh.angle = fast_atof(&rgb);
SkipSpaces(&rgb); SkipSpaces(&rgb);
if (strncmp(rgb,"inner angle",11)) { if (strncmp(rgb,"inner angle",11)) {
LogWarn_Ascii(splitter,format()<< ASSIMP_LOG_WARN_F( "Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id);
"Expected `inner angle` entity in `color` line in `Lght` chunk "<<nfo.id);
} }
SkipSpaces(rgb+11,&rgb); SkipSpaces(rgb+11,&rgb);
msh.inner_angle = fast_atof(&rgb); msh.inner_angle = fast_atof(&rgb);
@ -828,7 +777,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk
for(unsigned int cur = 0; cur < cnt && ++splitter ;++cur) { for(unsigned int cur = 0; cur < cnt && ++splitter ;++cur) {
if (splitter.match_start("Hole")) { if (splitter.match_start("Hole")) {
LogWarn_Ascii(splitter,"Skipping unsupported `Hole` line"); ASSIMP_LOG_WARN_F( "Skipping unsupported `Hole` line" );
continue; continue;
} }
@ -888,7 +837,7 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
const unsigned int head = strtoul10((++splitter)[1]); const unsigned int head = strtoul10((++splitter)[1]);
if (head != sizeof(Bitmap::BitmapHeader)) { if (head != sizeof(Bitmap::BitmapHeader)) {
LogWarn_Ascii(splitter,"Unexpected ThumbNailHdrSize, skipping this chunk"); ASSIMP_LOG_WARN_F("Unexpected ThumbNailHdrSize, skipping this chunk");
return; return;
} }
@ -1142,7 +1091,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene& out, StreamReaderLE& reader, const
mat.type = Material::METAL; mat.type = Material::METAL;
break; break;
default: default:
LogError_Ascii(format("Unrecognized shader type in `Mat1` chunk with id ")<<nfo.id); ASSIMP_LOG_ERROR_F( "Unrecognized shader type in `Mat1` chunk with id ", nfo.id );
mat.type = Material::FLAT; mat.type = Material::FLAT;
} }
@ -1157,7 +1106,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene& out, StreamReaderLE& reader, const
mat.autofacet = Material::SMOOTH; mat.autofacet = Material::SMOOTH;
break; break;
default: default:
LogError_Ascii(format("Unrecognized faceting mode in `Mat1` chunk with id ")<<nfo.id); ASSIMP_LOG_ERROR_F( "Unrecognized faceting mode in `Mat1` chunk with id ", nfo.id );
mat.autofacet = Material::FACETED; mat.autofacet = Material::FACETED;
} }
mat.autofacet_angle = static_cast<float>(reader.GetI1()); mat.autofacet_angle = static_cast<float>(reader.GetI1());
@ -1289,16 +1238,13 @@ void COBImporter::ReadUnit_Binary(COB::Scene& out, StreamReaderLE& reader, const
if (nd->id == nfo.parent_id) { if (nd->id == nfo.parent_id) {
const unsigned int t=reader.GetI2(); const unsigned int t=reader.GetI2();
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?( nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(
LogWarn_Ascii(format()<<t<<" is not a valid value for `Units` attribute in `Unit chunk` "<<nfo.id) ASSIMP_LOG_WARN_F(t," is not a valid value for `Units` attribute in `Unit chunk` ", nfo.id)
,1.f):units[t]; ,1.f):units[t];
return; return;
} }
} }
LogWarn_Ascii(format()<<"`Unit` chunk "<<nfo.id<<" is a child of " ASSIMP_LOG_WARN_F( "`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
<<nfo.parent_id<<" which does not exist");
} }
#endif // ASSIMP_BUILD_NO_COB_IMPORTER
#endif

View File

@ -77,10 +77,7 @@ class COBImporter : public BaseImporter
public: public:
COBImporter(); COBImporter();
~COBImporter(); ~COBImporter();
public:
// -------------------- // --------------------
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const; bool checkSig) const;
@ -115,15 +112,11 @@ private:
* @param stream Stream to read from. */ * @param stream Stream to read from. */
void ReadBinaryFile(COB::Scene& out, StreamReaderLE* stream); void ReadBinaryFile(COB::Scene& out, StreamReaderLE* stream);
private:
// Conversion to Assimp output format // Conversion to Assimp output format
aiNode* BuildNodes(const COB::Node& root,const COB::Scene& scin,aiScene* fill); aiNode* BuildNodes(const COB::Node& root,const COB::Scene& scin,aiScene* fill);
private: private:
// ASCII file support // ASCII file support
void UnsupportedChunk_Ascii(LineSplitter& splitter, const COB::ChunkInfo& nfo, const char* name); void UnsupportedChunk_Ascii(LineSplitter& splitter, const COB::ChunkInfo& nfo, const char* name);
@ -142,19 +135,6 @@ private:
void ReadChan_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo); void ReadChan_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
// ASCII file logging stuff to add proper line numbers to messages
static void LogWarn_Ascii (const LineSplitter& splitter, const Formatter::format& message);
static void LogError_Ascii(const LineSplitter& splitter, const Formatter::format& message);
static void LogInfo_Ascii (const LineSplitter& splitter, const Formatter::format& message);
static void LogDebug_Ascii(const LineSplitter& splitter, const Formatter::format& message);
static void LogWarn_Ascii (const Formatter::format& message);
static void LogError_Ascii (const Formatter::format& message);
static void LogInfo_Ascii (const Formatter::format& message);
static void LogDebug_Ascii (const Formatter::format& message);
// Binary file support // Binary file support
void UnsupportedChunk_Binary(StreamReaderLE& reader, const COB::ChunkInfo& nfo, const char* name); void UnsupportedChunk_Binary(StreamReaderLE& reader, const COB::ChunkInfo& nfo, const char* name);

View File

@ -95,7 +95,7 @@ void CalcTangentsProcess::Execute( aiScene* pScene)
{ {
ai_assert( NULL != pScene ); ai_assert( NULL != pScene );
DefaultLogger::get()->debug("CalcTangentsProcess begin"); ASSIMP_LOG_DEBUG("CalcTangentsProcess begin");
bool bHas = false; bool bHas = false;
for ( unsigned int a = 0; a < pScene->mNumMeshes; a++ ) { for ( unsigned int a = 0; a < pScene->mNumMeshes; a++ ) {
@ -103,9 +103,9 @@ void CalcTangentsProcess::Execute( aiScene* pScene)
} }
if ( bHas ) { if ( bHas ) {
DefaultLogger::get()->info("CalcTangentsProcess finished. Tangents have been calculated"); ASSIMP_LOG_INFO("CalcTangentsProcess finished. Tangents have been calculated");
} else { } else {
DefaultLogger::get()->debug("CalcTangentsProcess finished"); ASSIMP_LOG_DEBUG("CalcTangentsProcess finished");
} }
} }
@ -126,19 +126,19 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
// are undefined. // are undefined.
if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON))) if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON)))
{ {
DefaultLogger::get()->info("Tangents are undefined for line and point meshes"); ASSIMP_LOG_INFO("Tangents are undefined for line and point meshes");
return false; return false;
} }
// what we can check, though, is if the mesh has normals and texture coordinates. That's a requirement // what we can check, though, is if the mesh has normals and texture coordinates. That's a requirement
if( pMesh->mNormals == NULL) if( pMesh->mNormals == NULL)
{ {
DefaultLogger::get()->error("Failed to compute tangents; need normals"); ASSIMP_LOG_ERROR("Failed to compute tangents; need normals");
return false; return false;
} }
if( configSourceUV >= AI_MAX_NUMBER_OF_TEXTURECOORDS || !pMesh->mTextureCoords[configSourceUV] ) if( configSourceUV >= AI_MAX_NUMBER_OF_TEXTURECOORDS || !pMesh->mTextureCoords[configSourceUV] )
{ {
DefaultLogger::get()->error((Formatter::format("Failed to compute tangents; need UV data in channel"),configSourceUV)); ASSIMP_LOG_ERROR((Formatter::format("Failed to compute tangents; need UV data in channel"),configSourceUV));
return false; return false;
} }

View File

@ -99,7 +99,7 @@ inline unsigned int FindEmptyUVChannel (aiMesh* mesh)
for (unsigned int m = 0; m < AI_MAX_NUMBER_OF_TEXTURECOORDS;++m) for (unsigned int m = 0; m < AI_MAX_NUMBER_OF_TEXTURECOORDS;++m)
if (!mesh->mTextureCoords[m])return m; if (!mesh->mTextureCoords[m])return m;
DefaultLogger::get()->error("Unable to compute UV coordinates, no free UV slot found"); ASSIMP_LOG_ERROR("Unable to compute UV coordinates, no free UV slot found");
return UINT_MAX; return UINT_MAX;
} }
@ -384,13 +384,13 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ComputeUVMappingProcess::ComputeBoxMapping( aiMesh*, aiVector3D* ) void ComputeUVMappingProcess::ComputeBoxMapping( aiMesh*, aiVector3D* )
{ {
DefaultLogger::get()->error("Mapping type currently not implemented"); ASSIMP_LOG_ERROR("Mapping type currently not implemented");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ComputeUVMappingProcess::Execute( aiScene* pScene) void ComputeUVMappingProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("GenUVCoordsProcess begin"); ASSIMP_LOG_DEBUG("GenUVCoordsProcess begin");
char buffer[1024]; char buffer[1024];
if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT)
@ -418,7 +418,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex,
MappingTypeToString(mapping)); MappingTypeToString(mapping));
DefaultLogger::get()->info(buffer); ASSIMP_LOG_INFO(buffer);
} }
if (aiTextureMapping_OTHER == mapping) if (aiTextureMapping_OTHER == mapping)
@ -485,7 +485,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
} }
if (m && idx != outIdx) if (m && idx != outIdx)
{ {
DefaultLogger::get()->warn("UV index mismatch. Not all meshes assigned to " ASSIMP_LOG_WARN("UV index mismatch. Not all meshes assigned to "
"this material have equal numbers of UV channels. The UV index stored in " "this material have equal numbers of UV channels. The UV index stored in "
"the material structure does therefore not apply for all meshes. "); "the material structure does therefore not apply for all meshes. ");
} }
@ -502,5 +502,5 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
} }
} }
} }
DefaultLogger::get()->debug("GenUVCoordsProcess finished"); ASSIMP_LOG_DEBUG("GenUVCoordsProcess finished");
} }

View File

@ -85,7 +85,7 @@ void MakeLeftHandedProcess::Execute( aiScene* pScene)
{ {
// Check for an existent root node to proceed // Check for an existent root node to proceed
ai_assert(pScene->mRootNode != NULL); ai_assert(pScene->mRootNode != NULL);
DefaultLogger::get()->debug("MakeLeftHandedProcess begin"); ASSIMP_LOG_DEBUG("MakeLeftHandedProcess begin");
// recursively convert all the nodes // recursively convert all the nodes
ProcessNode( pScene->mRootNode, aiMatrix4x4()); ProcessNode( pScene->mRootNode, aiMatrix4x4());
@ -110,7 +110,7 @@ void MakeLeftHandedProcess::Execute( aiScene* pScene)
ProcessAnimation( nodeAnim); ProcessAnimation( nodeAnim);
} }
} }
DefaultLogger::get()->debug("MakeLeftHandedProcess finished"); ASSIMP_LOG_DEBUG("MakeLeftHandedProcess finished");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -140,7 +140,7 @@ void MakeLeftHandedProcess::ProcessNode( aiNode* pNode, const aiMatrix4x4& pPare
// Converts a single mesh to left handed coordinates. // Converts a single mesh to left handed coordinates.
void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh) { void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh) {
if ( nullptr == pMesh ) { if ( nullptr == pMesh ) {
DefaultLogger::get()->error( "Nullptr to mesh found." ); ASSIMP_LOG_ERROR( "Nullptr to mesh found." );
return; return;
} }
// mirror positions, normals and stuff along the Z axis // mirror positions, normals and stuff along the Z axis
@ -180,7 +180,7 @@ void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh) {
// Converts a single material to left handed coordinates. // Converts a single material to left handed coordinates.
void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat) { void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat) {
if ( nullptr == _mat ) { if ( nullptr == _mat ) {
DefaultLogger::get()->error( "Nullptr to aiMaterial found." ); ASSIMP_LOG_ERROR( "Nullptr to aiMaterial found." );
return; return;
} }
@ -245,13 +245,13 @@ bool FlipUVsProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FlipUVsProcess::Execute( aiScene* pScene) void FlipUVsProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("FlipUVsProcess begin"); ASSIMP_LOG_DEBUG("FlipUVsProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++i) for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
ProcessMesh(pScene->mMeshes[i]); ProcessMesh(pScene->mMeshes[i]);
for (unsigned int i = 0; i < pScene->mNumMaterials;++i) for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
ProcessMaterial(pScene->mMaterials[i]); ProcessMaterial(pScene->mMaterials[i]);
DefaultLogger::get()->debug("FlipUVsProcess finished"); ASSIMP_LOG_DEBUG("FlipUVsProcess finished");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -262,7 +262,7 @@ void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat)
for (unsigned int a = 0; a < mat->mNumProperties;++a) { for (unsigned int a = 0; a < mat->mNumProperties;++a) {
aiMaterialProperty* prop = mat->mProperties[a]; aiMaterialProperty* prop = mat->mProperties[a];
if( !prop ) { if( !prop ) {
DefaultLogger::get()->debug( "Property is null" ); ASSIMP_LOG_DEBUG( "Property is null" );
continue; continue;
} }
@ -319,10 +319,10 @@ bool FlipWindingOrderProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FlipWindingOrderProcess::Execute( aiScene* pScene) void FlipWindingOrderProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("FlipWindingOrderProcess begin"); ASSIMP_LOG_DEBUG("FlipWindingOrderProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++i) for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
ProcessMesh(pScene->mMeshes[i]); ProcessMesh(pScene->mMeshes[i]);
DefaultLogger::get()->debug("FlipWindingOrderProcess finished"); ASSIMP_LOG_DEBUG("FlipWindingOrderProcess finished");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -91,7 +91,7 @@ void DeboneProcess::SetupProperties(const Importer* pImp)
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void DeboneProcess::Execute( aiScene* pScene) void DeboneProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("DeboneProcess begin"); ASSIMP_LOG_DEBUG("DeboneProcess begin");
if(!pScene->mNumMeshes) { if(!pScene->mNumMeshes) {
return; return;
@ -148,9 +148,7 @@ void DeboneProcess::Execute( aiScene* pScene)
} }
if(!DefaultLogger::isNullLogger()) { if(!DefaultLogger::isNullLogger()) {
char buffer[1024]; ASSIMP_LOG_INFO_F("Removed %u bones. Input bones:", in - out, ". Output bones: ", out);
::ai_snprintf(buffer,1024,"Removed %u bones. Input bones: %u. Output bones: %u",in-out,in,out);
DefaultLogger::get()->info(buffer);
} }
// and destroy the source mesh. It should be completely contained inside the new submeshes // and destroy the source mesh. It should be completely contained inside the new submeshes
@ -173,7 +171,7 @@ void DeboneProcess::Execute( aiScene* pScene)
UpdateNode( pScene->mRootNode); UpdateNode( pScene->mRootNode);
} }
DefaultLogger::get()->debug("DeboneProcess end"); ASSIMP_LOG_DEBUG("DeboneProcess end");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -93,9 +93,7 @@ void EmbedTexturesProcess::Execute(aiScene* pScene) {
} }
} }
char stringBuffer[128]; ASSIMP_LOG_INFO_F("EmbedTexturesProcess finished. Embedded ", embeddedTexturesCount, " textures." );
::ai_snprintf(stringBuffer, 128, "EmbedTexturesProcess finished. Embedded %u textures.", embeddedTexturesCount);
DefaultLogger::get()->info(stringBuffer);
} }
bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const { bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
@ -105,7 +103,7 @@ bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
// Test path directly // Test path directly
std::ifstream file(imagePath, std::ios::binary | std::ios::ate); std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
if ((imageSize = file.tellg()) == std::streampos(-1)) { if ((imageSize = file.tellg()) == std::streampos(-1)) {
DefaultLogger::get()->warn("EmbedTexturesProcess: Cannot find image: " + imagePath + ". Will try to find it in root folder."); ASSIMP_LOG_WARN_F("EmbedTexturesProcess: Cannot find image: ", imagePath, ". Will try to find it in root folder.");
// Test path in root path // Test path in root path
imagePath = mRootPath + path; imagePath = mRootPath + path;
@ -115,7 +113,7 @@ bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
imagePath = mRootPath + path.substr(path.find_last_of("\\/") + 1u); imagePath = mRootPath + path.substr(path.find_last_of("\\/") + 1u);
file.open(imagePath, std::ios::binary | std::ios::ate); file.open(imagePath, std::ios::binary | std::ios::ate);
if ((imageSize = file.tellg()) == std::streampos(-1)) { if ((imageSize = file.tellg()) == std::streampos(-1)) {
DefaultLogger::get()->error("EmbedTexturesProcess: Unable to embed texture: " + path + "."); ASSIMP_LOG_ERROR_F("EmbedTexturesProcess: Unable to embed texture: ", path, ".");
return false; return false;
} }
} }

View File

@ -91,7 +91,7 @@ void DOMWarning(const std::string& message, const Element* element /*= NULL*/)
return; return;
} }
if(DefaultLogger::get()) { if(DefaultLogger::get()) {
DefaultLogger::get()->warn("FBX-DOM: " + message); ASSIMP_LOG_WARN("FBX-DOM: " + message);
} }
} }

View File

@ -85,11 +85,11 @@ void FindDegeneratesProcess::SetupProperties(const Importer* pImp) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FindDegeneratesProcess::Execute( aiScene* pScene) { void FindDegeneratesProcess::Execute( aiScene* pScene) {
DefaultLogger::get()->debug("FindDegeneratesProcess begin"); ASSIMP_LOG_DEBUG("FindDegeneratesProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++i){ for (unsigned int i = 0; i < pScene->mNumMeshes;++i){
ExecuteOnMesh( pScene->mMeshes[ i ] ); ExecuteOnMesh( pScene->mMeshes[ i ] );
} }
DefaultLogger::get()->debug("FindDegeneratesProcess finished"); ASSIMP_LOG_DEBUG("FindDegeneratesProcess finished");
} }
static ai_real heron( ai_real a, ai_real b, ai_real c ) { static ai_real heron( ai_real a, ai_real b, ai_real c ) {
@ -242,7 +242,7 @@ evil_jump_outside:
if (!mesh->mNumFaces) { if (!mesh->mNumFaces) {
// WTF!? // WTF!?
// OK ... for completeness and because I'm not yet tired, // OK ... for completeness and because I'm not yet tired,
// let's write code that willl hopefully never be called // let's write code that will hopefully never be called
// (famous last words) // (famous last words)
// OK ... bad idea. // OK ... bad idea.
@ -250,10 +250,7 @@ evil_jump_outside:
} }
} }
if (deg && !DefaultLogger::isNullLogger()) if (deg && !DefaultLogger::isNullLogger()) {
{ ASSIMP_LOG_WARN_F( "Found ", deg, " degenerated primitives");
char s[64];
ASSIMP_itoa10(s,deg);
DefaultLogger::get()->warn(std::string("Found ") + s + " degenerated primitives");
} }
} }

View File

@ -119,7 +119,7 @@ void UpdateMeshIndices(aiNode* node, unsigned int* lookup)
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FindInstancesProcess::Execute( aiScene* pScene) void FindInstancesProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("FindInstancesProcess begin"); ASSIMP_LOG_DEBUG("FindInstancesProcess begin");
if (pScene->mNumMeshes) { if (pScene->mNumMeshes) {
// use a pseudo hash for all meshes in the scene to quickly find // use a pseudo hash for all meshes in the scene to quickly find
@ -267,13 +267,11 @@ void FindInstancesProcess::Execute( aiScene* pScene)
// write to log // write to log
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_INFO_F( "FindInstancesProcess finished. Found ", (pScene->mNumMeshes - numMeshesOut), " instances" );
char buffer[512];
::ai_snprintf(buffer,512,"FindInstancesProcess finished. Found %i instances",pScene->mNumMeshes-numMeshesOut);
DefaultLogger::get()->info(buffer);
} }
pScene->mNumMeshes = numMeshesOut; pScene->mNumMeshes = numMeshesOut;
} else {
ASSIMP_LOG_DEBUG("FindInstancesProcess finished. No instanced meshes found");
} }
else DefaultLogger::get()->debug("FindInstancesProcess finished. No instanced meshes found");
} }
} }

View File

@ -118,7 +118,7 @@ void UpdateMeshReferences(aiNode* node, const std::vector<unsigned int>& meshMap
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FindInvalidDataProcess::Execute( aiScene* pScene) void FindInvalidDataProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("FindInvalidDataProcess begin"); ASSIMP_LOG_DEBUG("FindInvalidDataProcess begin");
bool out = false; bool out = false;
std::vector<unsigned int> meshMapping(pScene->mNumMeshes); std::vector<unsigned int> meshMapping(pScene->mNumMeshes);
@ -163,9 +163,10 @@ void FindInvalidDataProcess::Execute( aiScene* pScene)
pScene->mNumMeshes = real; pScene->mNumMeshes = real;
} }
DefaultLogger::get()->info("FindInvalidDataProcess finished. Found issues ..."); ASSIMP_LOG_INFO("FindInvalidDataProcess finished. Found issues ...");
} else {
ASSIMP_LOG_DEBUG("FindInvalidDataProcess finished. Everything seems to be OK.");
} }
else DefaultLogger::get()->debug("FindInvalidDataProcess finished. Everything seems to be OK.");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -212,8 +213,7 @@ inline bool ProcessArray(T*& in, unsigned int num,const char* name,
{ {
const char* err = ValidateArrayContents(in,num,dirtyMask,mayBeIdentical,mayBeZero); const char* err = ValidateArrayContents(in,num,dirtyMask,mayBeIdentical,mayBeZero);
if (err) { if (err) {
DefaultLogger::get()->error(std::string("FindInvalidDataProcess fails on mesh ") + name + ": " + err); ASSIMP_LOG_ERROR_F( "FindInvalidDataProcess fails on mesh ", name, ": ", err);
delete[] in; delete[] in;
in = NULL; in = NULL;
return true; return true;
@ -354,7 +354,7 @@ int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
// Process vertex positions // Process vertex positions
if (pMesh->mVertices && ProcessArray(pMesh->mVertices, pMesh->mNumVertices, "positions", dirtyMask)) { if (pMesh->mVertices && ProcessArray(pMesh->mVertices, pMesh->mNumVertices, "positions", dirtyMask)) {
DefaultLogger::get()->error("Deleting mesh: Unable to continue without vertex positions"); ASSIMP_LOG_ERROR("Deleting mesh: Unable to continue without vertex positions");
return 2; return 2;
} }

View File

@ -82,28 +82,35 @@ bool FixInfacingNormalsProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void FixInfacingNormalsProcess::Execute( aiScene* pScene) void FixInfacingNormalsProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("FixInfacingNormalsProcess begin"); ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess begin");
bool bHas = false; bool bHas( false );
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
if(ProcessMesh( pScene->mMeshes[a],a))bHas = true; if (ProcessMesh(pScene->mMeshes[a], a)) {
bHas = true;
}
}
if (bHas) if (bHas) {
DefaultLogger::get()->debug("FixInfacingNormalsProcess finished. Found issues."); ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess finished. Found issues.");
else DefaultLogger::get()->debug("FixInfacingNormalsProcess finished. No changes to the scene."); } else {
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess finished. No changes to the scene.");
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Apply the step to the mesh // Apply the step to the mesh
bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index) bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index)
{ {
ai_assert(NULL != pcMesh); ai_assert(nullptr != pcMesh);
// Nothing to do if there are no model normals // Nothing to do if there are no model normals
if (!pcMesh->HasNormals())return false; if (!pcMesh->HasNormals()) {
return false;
}
// Compute the bounding box of both the model vertices + normals and // Compute the bounding box of both the model vertices + normals and
// the umodified model vertices. Then check whether the first BB // the unmodified model vertices. Then check whether the first BB
// is smaller than the second. In this case we can assume that the // is smaller than the second. In this case we can assume that the
// normals need to be flipped, although there are a few special cases .. // normals need to be flipped, although there are a few special cases ..
// convex, concave, planar models ... // convex, concave, planar models ...
@ -155,14 +162,9 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index)
if (fDelta1_z < 0.05f * std::sqrt( fDelta1_y * fDelta1_x ))return false; if (fDelta1_z < 0.05f * std::sqrt( fDelta1_y * fDelta1_x ))return false;
// now compare the volumes of the bounding boxes // now compare the volumes of the bounding boxes
if (std::fabs(fDelta0_x * fDelta0_y * fDelta0_z) < if (std::fabs(fDelta0_x * fDelta0_y * fDelta0_z) < std::fabs(fDelta1_x * fDelta1_yz)) {
std::fabs(fDelta1_x * fDelta1_yz)) if (!DefaultLogger::isNullLogger()) {
{ ASSIMP_LOG_INFO_F("Mesh ", index, ": Normals are facing inwards (or the mesh is planar)", index);
if (!DefaultLogger::isNullLogger())
{
char buffer[128]; // should be sufficiently large
ai_snprintf(buffer,128,"Mesh %u: Normals are facing inwards (or the mesh is planar)",index);
DefaultLogger::get()->info(buffer);
} }
// Invert normals // Invert normals

View File

@ -72,16 +72,14 @@ GenFaceNormalsProcess::~GenFaceNormalsProcess()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the processing step is present in the given flag field. // Returns whether the processing step is present in the given flag field.
bool GenFaceNormalsProcess::IsActive( unsigned int pFlags) const bool GenFaceNormalsProcess::IsActive( unsigned int pFlags) const {
{
return (pFlags & aiProcess_GenNormals) != 0; return (pFlags & aiProcess_GenNormals) != 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void GenFaceNormalsProcess::Execute( aiScene* pScene) void GenFaceNormalsProcess::Execute( aiScene* pScene) {
{ ASSIMP_LOG_DEBUG("GenFaceNormalsProcess begin");
DefaultLogger::get()->debug("GenFaceNormalsProcess begin");
if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) { if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) {
throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here"); throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here");
@ -94,11 +92,12 @@ void GenFaceNormalsProcess::Execute( aiScene* pScene)
} }
} }
if (bHas) { if (bHas) {
DefaultLogger::get()->info("GenFaceNormalsProcess finished. " ASSIMP_LOG_INFO("GenFaceNormalsProcess finished. "
"Face normals have been calculated"); "Face normals have been calculated");
} else {
ASSIMP_LOG_DEBUG("GenFaceNormalsProcess finished. "
"Normals are already there");
} }
else DefaultLogger::get()->debug("GenFaceNormalsProcess finished. "
"Normals are already there");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -113,7 +112,7 @@ bool GenFaceNormalsProcess::GenMeshFaceNormals (aiMesh* pMesh)
// triangles or higher-order polygons the normal vectors // triangles or higher-order polygons the normal vectors
// are undefined. // are undefined.
if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON))) { if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON))) {
DefaultLogger::get()->info("Normal vectors are undefined for line and point meshes"); ASSIMP_LOG_INFO("Normal vectors are undefined for line and point meshes");
return false; return false;
} }

View File

@ -88,24 +88,25 @@ void GenVertexNormalsProcess::SetupProperties(const Importer* pImp)
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void GenVertexNormalsProcess::Execute( aiScene* pScene) void GenVertexNormalsProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("GenVertexNormalsProcess begin"); ASSIMP_LOG_DEBUG("GenVertexNormalsProcess begin");
if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) {
throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here"); throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here");
}
bool bHas = false; bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for( unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
{
if(GenMeshVertexNormals( pScene->mMeshes[a],a)) if(GenMeshVertexNormals( pScene->mMeshes[a],a))
bHas = true; bHas = true;
} }
if (bHas) { if (bHas) {
DefaultLogger::get()->info("GenVertexNormalsProcess finished. " ASSIMP_LOG_INFO("GenVertexNormalsProcess finished. "
"Vertex normals have been calculated"); "Vertex normals have been calculated");
} else {
ASSIMP_LOG_DEBUG("GenVertexNormalsProcess finished. "
"Normals are already there");
} }
else DefaultLogger::get()->debug("GenVertexNormalsProcess finished. "
"Normals are already there");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -120,7 +121,7 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
// are undefined. // are undefined.
if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON))) if (!(pMesh->mPrimitiveTypes & (aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON)))
{ {
DefaultLogger::get()->info("Normal vectors are undefined for line and point meshes"); ASSIMP_LOG_INFO("Normal vectors are undefined for line and point meshes");
return false; return false;
} }

View File

@ -470,7 +470,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
} }
if (curFace != faceEnd) if (curFace != faceEnd)
DefaultLogger::get()->error("IRRMESH: Not enough indices"); ASSIMP_LOG_ERROR("IRRMESH: Not enough indices");
// Finish processing the mesh - do some small material workarounds // Finish processing the mesh - do some small material workarounds
if (curMatFlags & AI_IRRMESH_MAT_trans_vertex_alpha && !useColors) { if (curMatFlags & AI_IRRMESH_MAT_trans_vertex_alpha && !useColors) {

View File

@ -510,45 +510,46 @@ void WriteLogOpening(const std::string& file)
// need to ask the authors of incoming bug reports for // need to ask the authors of incoming bug reports for
// the library version they're using - a log dump is // the library version they're using - a log dump is
// sufficient. // sufficient.
const unsigned int flags = aiGetCompileFlags(); const unsigned int flags( aiGetCompileFlags() );
ASSIMP_LOG_DEBUG_F( "Assimp ", aiGetVersionMajor(), ".", aiGetVersionMinor(), ".", aiGetVersionRevision(), " " std::stringstream stream;
stream << "Assimp " << aiGetVersionMajor() << "." << aiGetVersionMinor() << "." << aiGetVersionRevision() << " "
#if defined(ASSIMP_BUILD_ARCHITECTURE) #if defined(ASSIMP_BUILD_ARCHITECTURE)
,ASSIMP_BUILD_ARCHITECTURE << ASSIMP_BUILD_ARCHITECTURE
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__) #elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
, "x86" << "x86"
#elif defined(_M_X64) || defined(__x86_64__) #elif defined(_M_X64) || defined(__x86_64__)
, "amd64" << "amd64"
#elif defined(_M_IA64) || defined(__ia64__) #elif defined(_M_IA64) || defined(__ia64__)
, "itanium" << "itanium"
#elif defined(__ppc__) || defined(__powerpc__) #elif defined(__ppc__) || defined(__powerpc__)
, "ppc32" << "ppc32"
#elif defined(__powerpc64__) #elif defined(__powerpc64__)
, "ppc64" << "ppc64"
#elif defined(__arm__) #elif defined(__arm__)
, "arm" << "arm"
#else #else
, "<unknown architecture>" << "<unknown architecture>"
#endif #endif
<< " "
, " "
#if defined(ASSIMP_BUILD_COMPILER) #if defined(ASSIMP_BUILD_COMPILER)
, ASSIMP_BUILD_COMPILER << ( ASSIMP_BUILD_COMPILER )
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
, "msvc" << "msvc"
#elif defined(__GNUC__) #elif defined(__GNUC__)
, "gcc" << "gcc"
#else #else
, "<unknown compiler>" << "<unknown compiler>"
#endif #endif
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
, " debug" << " debug"
#endif #endif
, (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "") << (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
, (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "") << (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
, (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "") << (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "");
);
ASSIMP_LOG_DEBUG(stream.str());
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -95,11 +95,11 @@ void ImproveCacheLocalityProcess::SetupProperties(const Importer* pImp)
void ImproveCacheLocalityProcess::Execute( aiScene* pScene) void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
{ {
if (!pScene->mNumMeshes) { if (!pScene->mNumMeshes) {
DefaultLogger::get()->debug("ImproveCacheLocalityProcess skipped; there are no meshes"); ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess skipped; there are no meshes");
return; return;
} }
DefaultLogger::get()->debug("ImproveCacheLocalityProcess begin"); ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess begin");
float out = 0.f; float out = 0.f;
unsigned int numf = 0, numm = 0; unsigned int numf = 0, numm = 0;
@ -112,12 +112,8 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
} }
} }
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
char szBuff[128]; // should be sufficiently large in every case ASSIMP_LOG_INFO_F("Cache relevant are ", numm, " meshes (", numf," faces). Average output ACMR is ", out / numf );
ai_snprintf(szBuff,128,"Cache relevant are %u meshes (%u faces). Average output ACMR is %f", ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess finished. ");
numm,numf,out/numf);
DefaultLogger::get()->info(szBuff);
DefaultLogger::get()->debug("ImproveCacheLocalityProcess finished. ");
} }
} }
@ -135,7 +131,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
return 0.f; return 0.f;
if (pMesh->mPrimitiveTypes != aiPrimitiveType_TRIANGLE) { if (pMesh->mPrimitiveTypes != aiPrimitiveType_TRIANGLE) {
DefaultLogger::get()->error("This algorithm works on triangle meshes only"); ASSIMP_LOG_ERROR("This algorithm works on triangle meshes only");
return 0.f; return 0.f;
} }
@ -363,11 +359,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
// very intense verbose logging ... prepare for much text if there are many meshes // very intense verbose logging ... prepare for much text if there are many meshes
if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) { if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
char szBuff[128]; // should be sufficiently large in every case ASSIMP_LOG_DEBUG_F("Mesh %u | ACMR in: ", meshNum, " out: ", fACMR, " | ~", fACMR2, ((fACMR - fACMR2) / fACMR) * 100.f);
ai_snprintf(szBuff,128,"Mesh %u | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2,
((fACMR - fACMR2) / fACMR) * 100.f);
DefaultLogger::get()->debug(szBuff);
} }
fACMR2 *= pMesh->mNumFaces; fACMR2 *= pMesh->mNumFaces;

View File

@ -79,7 +79,7 @@ bool JoinVerticesProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void JoinVerticesProcess::Execute( aiScene* pScene) void JoinVerticesProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("JoinVerticesProcess begin"); ASSIMP_LOG_DEBUG("JoinVerticesProcess begin");
// get the total number of vertices BEFORE the step is executed // get the total number of vertices BEFORE the step is executed
int iNumOldVertices = 0; int iNumOldVertices = 0;
@ -95,19 +95,13 @@ void JoinVerticesProcess::Execute( aiScene* pScene)
iNumVertices += ProcessMesh( pScene->mMeshes[a],a); iNumVertices += ProcessMesh( pScene->mMeshes[a],a);
// if logging is active, print detailed statistics // if logging is active, print detailed statistics
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger()) {
{ if (iNumOldVertices == iNumVertices) {
if (iNumOldVertices == iNumVertices) ASSIMP_LOG_DEBUG("JoinVerticesProcess finished ");
{ } else {
DefaultLogger::get()->debug("JoinVerticesProcess finished "); ASSIMP_LOG_INFO_F("JoinVerticesProcess finished | Verts in: ", iNumOldVertices,
} else " out: ", iNumVertices, " | ~",
{ ((iNumOldVertices - iNumVertices) / (float)iNumOldVertices) * 100.f );
char szBuff[128]; // should be sufficiently large in every case
::ai_snprintf(szBuff,128,"JoinVerticesProcess finished | Verts in: %i out: %i | ~%.1f%%",
iNumOldVertices,
iNumVertices,
((iNumOldVertices - iNumVertices) / (float)iNumOldVertices) * 100.f);
DefaultLogger::get()->info(szBuff);
} }
} }
@ -274,7 +268,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
} }
if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) { if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
DefaultLogger::get()->debug((Formatter::format(), ASSIMP_LOG_DEBUG_F(
"Mesh ",meshIndex, "Mesh ",meshIndex,
" (", " (",
(pMesh->mName.length ? pMesh->mName.data : "unnamed"), (pMesh->mName.length ? pMesh->mName.data : "unnamed"),
@ -284,7 +278,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
" | ~", " | ~",
((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f, ((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f,
"%" "%"
)); );
} }
// replace vertex data with the unique data sets // replace vertex data with the unique data sets
@ -375,7 +369,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
} }
} }
} else { } else {
DefaultLogger::get()->error( "X-Export: aiBone shall contain weights, but pointer to them is NULL." ); ASSIMP_LOG_ERROR( "X-Export: aiBone shall contain weights, but pointer to them is NULL." );
} }
if (newWeights.size() > 0) { if (newWeights.size() > 0) {

View File

@ -1080,7 +1080,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
// we have already a VMAP entry for this vertex - thus // we have already a VMAP entry for this vertex - thus
// we need to duplicate the corresponding polygon. // we need to duplicate the corresponding polygon.
if (polyIdx >= numFaces) { if (polyIdx >= numFaces) {
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAD entry \'" + name + "\', polygon index is out of range"); ASSIMP_LOG_WARN_F("LWO2: Failure evaluating VMAD entry \'", name, "\', polygon index is out of range");
mFileBuffer += base->dims<<2u; mFileBuffer += base->dims<<2u;
continue; continue;
} }
@ -1442,17 +1442,21 @@ void LWOImporter::LoadLWO2File()
if (skip) if (skip)
break; break;
if (mCurLayer->mFaces.empty()) if (mCurLayer->mFaces.empty()) {
DefaultLogger::get()->warn("LWO2: Unexpected PTAG"); ASSIMP_LOG_WARN("LWO2: Unexpected PTAG");
else LoadLWO2PolygonTags(head.length); } else {
LoadLWO2PolygonTags(head.length);
}
break; break;
} }
// list of tags // list of tags
case AI_LWO_TAGS: case AI_LWO_TAGS:
{ {
if (!mTags->empty()) if (!mTags->empty()) {
ASSIMP_LOG_WARN("LWO2: SRFS chunk encountered twice"); ASSIMP_LOG_WARN("LWO2: SRFS chunk encountered twice");
else LoadLWOTags(head.length); } else {
LoadLWOTags(head.length);
}
break; break;
} }

View File

@ -684,7 +684,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
(*it).tokens[0] == "LightMotion")) { (*it).tokens[0] == "LightMotion")) {
if (nodes.empty()) if (nodes.empty())
DASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'");
else { else {
ReadEnvelope_Old(it,root.children.end(),nodes.back(),version); ReadEnvelope_Old(it,root.children.end(),nodes.back(),version);
} }
@ -773,7 +773,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightType': set type of currently active light // 'LightType': set type of currently active light
else if ((*it).tokens[0] == "LightType") { else if ((*it).tokens[0] == "LightType") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightType\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightType\'");
else nodes.back().lightType = strtoul10(c); else nodes.back().lightType = strtoul10(c);

View File

@ -76,13 +76,13 @@ bool LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void LimitBoneWeightsProcess::Execute( aiScene* pScene) void LimitBoneWeightsProcess::Execute( aiScene* pScene) {
{ ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin");
DefaultLogger::get()->debug("LimitBoneWeightsProcess begin"); for (unsigned int a = 0; a < pScene->mNumMeshes; ++a ) {
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) ProcessMesh(pScene->mMeshes[a]);
ProcessMesh( pScene->mMeshes[a]); }
DefaultLogger::get()->debug("LimitBoneWeightsProcess end"); ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess end");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -195,9 +195,7 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh)
} }
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
char buffer[1024]; ASSIMP_LOG_INFO_F("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones );
ai_snprintf(buffer,1024,"Removed %u weights. Input bones: %u. Output bones: %u",removed,old_bones,pMesh->mNumBones);
DefaultLogger::get()->info(buffer);
} }
} }
} }

View File

@ -130,7 +130,7 @@ void MD5Parser::ParseHeader()
// FIX: can break the log length limit, so we need to be careful // FIX: can break the log length limit, so we need to be careful
char* sz = buffer; char* sz = buffer;
while (!IsLineEnd( *buffer++)); while (!IsLineEnd( *buffer++));
DefaultLogger::get()->info(std::string(sz,std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer-sz)))); ASSIMP_LOG_INFO(std::string(sz,std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer-sz))));
SkipSpacesAndLineEnd(); SkipSpacesAndLineEnd();
} }
@ -483,6 +483,6 @@ MD5CameraParser::MD5CameraParser(SectionList& mSections)
} }
} }
} }
DefaultLogger::get()->debug("MD5CameraParser end"); ASSIMP_LOG_DEBUG("MD5CameraParser end");
} }

View File

@ -159,8 +159,9 @@ void MDCImporter::ValidateHeader()
"magic word found is " + std::string( szBuffer )); "magic word found is " + std::string( szBuffer ));
} }
if (pcHeader->ulVersion != AI_MDC_VERSION) if (pcHeader->ulVersion != AI_MDC_VERSION) {
DefaultLogger::get()->warn("Unsupported MDC file version (2 (AI_MDC_VERSION) was expected)"); ASSIMP_LOG_WARN("Unsupported MDC file version (2 (AI_MDC_VERSION) was expected)");
}
if (pcHeader->ulOffsetBorderFrames + pcHeader->ulNumFrames * sizeof(MDC::Frame) > this->fileSize || if (pcHeader->ulOffsetBorderFrames + pcHeader->ulNumFrames * sizeof(MDC::Frame) > this->fileSize ||
pcHeader->ulOffsetSurfaces + pcHeader->ulNumSurfaces * sizeof(MDC::Surface) > this->fileSize) pcHeader->ulOffsetSurfaces + pcHeader->ulNumSurfaces * sizeof(MDC::Surface) > this->fileSize)
@ -169,8 +170,9 @@ void MDCImporter::ValidateHeader()
"and point to something behind the file."); "and point to something behind the file.");
} }
if (this->configFrameID >= this->pcHeader->ulNumFrames) if (this->configFrameID >= this->pcHeader->ulNumFrames) {
throw DeadlyImportError("The requested frame is not available"); throw DeadlyImportError("The requested frame is not available");
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -388,7 +390,7 @@ void MDCImporter::InternReadFile(
uint32_t quak = pcTriangle->aiIndices[iIndex]; uint32_t quak = pcTriangle->aiIndices[iIndex];
if (quak >= pcSurface->ulNumVertices) if (quak >= pcSurface->ulNumVertices)
{ {
DefaultLogger::get()->error("MDC vertex index is out of range"); ASSIMP_LOG_ERROR("MDC vertex index is out of range");
quak = pcSurface->ulNumVertices-1; quak = pcSurface->ulNumVertices-1;
} }

View File

@ -481,7 +481,7 @@ void MDLImporter::InternReadFile_Quake1() {
if (iIndex >= (unsigned int)pcHeader->num_verts) if (iIndex >= (unsigned int)pcHeader->num_verts)
{ {
iIndex = pcHeader->num_verts-1; iIndex = pcHeader->num_verts-1;
DefaultLogger::get()->warn("Index overflow in Q1-MDL vertex list."); ASSIMP_LOG_WARN("Index overflow in Q1-MDL vertex list.");
} }
aiVector3D& vec = pcMesh->mVertices[iCurrent]; aiVector3D& vec = pcMesh->mVertices[iCurrent];
@ -1026,7 +1026,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) { if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) {
// (we might need to read this section a second time - to process frame vertices correctly) // (we might need to read this section a second time - to process frame vertices correctly)
pcGroupTris->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1; pcGroupTris->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1;
DASSIMP_LOG_WARN("Index overflow in MDL7 vertex list"); ASSIMP_LOG_WARN("Index overflow in MDL7 vertex list");
} }
// write the output face index // write the output face index
@ -1894,7 +1894,7 @@ void MDLImporter::GenerateOutputMeshes_3DGS_MDL7(
unsigned int iBone = groupData.aiBones[ oldFace.mIndices[c] ]; unsigned int iBone = groupData.aiBones[ oldFace.mIndices[c] ];
if (UINT_MAX != iBone) { if (UINT_MAX != iBone) {
if (iBone >= iNumOutBones) { if (iBone >= iNumOutBones) {
DefaultLogger::get()->error("Bone index overflow. " ASSIMP_LOG_ERROR("Bone index overflow. "
"The bone index of a vertex exceeds the allowed range. "); "The bone index of a vertex exceeds the allowed range. ");
iBone = iNumOutBones-1; iBone = iNumOutBones-1;
} }

View File

@ -64,7 +64,7 @@ using namespace Assimp;
static aiTexel* const bad_texel = reinterpret_cast<aiTexel*>(SIZE_MAX); static aiTexel* const bad_texel = reinterpret_cast<aiTexel*>(SIZE_MAX);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Find a suitable pallette file or take the default one // Find a suitable palette file or take the default one
void MDLImporter::SearchPalette(const unsigned char** pszColorMap) void MDLImporter::SearchPalette(const unsigned char** pszColorMap)
{ {
// now try to find the color map in the current directory // now try to find the color map in the current directory
@ -75,10 +75,11 @@ void MDLImporter::SearchPalette(const unsigned char** pszColorMap)
{ {
if (pcStream->FileSize() >= 768) if (pcStream->FileSize() >= 768)
{ {
unsigned char* colorMap = new unsigned char[256*3]; constexpr size_t len = 256 * 3;
unsigned char* colorMap = new unsigned char[len];
szColorMap = colorMap; szColorMap = colorMap;
pcStream->Read(colorMap,256*3,1); pcStream->Read(colorMap, len,1);
DefaultLogger::get()->info("Found valid colormap.lmp in directory. " ASSIMP_LOG_INFO("Found valid colormap.lmp in directory. "
"It will be used to decode embedded textures in palletized formats."); "It will be used to decode embedded textures in palletized formats.");
} }
delete pcStream; delete pcStream;
@ -186,7 +187,7 @@ void MDLImporter::CreateTexture_3DGS_MDL4(const unsigned char* szData,
if (iType == 1 || iType > 3) if (iType == 1 || iType > 3)
{ {
DefaultLogger::get()->error("Unsupported texture file format"); ASSIMP_LOG_ERROR("Unsupported texture file format");
return; return;
} }
@ -508,7 +509,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
// ***** EMBEDDED DDS FILE ***** // ***** EMBEDDED DDS FILE *****
if (1 != iHeight) if (1 != iHeight)
{ {
DefaultLogger::get()->warn("Found a reference to an embedded DDS texture, " ASSIMP_LOG_WARN("Found a reference to an embedded DDS texture, "
"but texture height is not equal to 1, which is not supported by MED"); "but texture height is not equal to 1, which is not supported by MED");
} }

View File

@ -349,9 +349,6 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
stream.CopyAndAdvance(j.parentName,32); stream.CopyAndAdvance(j.parentName,32);
j.parentName[32] = '\0'; j.parentName[32] = '\0';
// DefaultLogger::get()->debug(j.name);
// DefaultLogger::get()->debug(j.parentName);
ReadVector(stream,j.rotation); ReadVector(stream,j.rotation);
ReadVector(stream,j.position); ReadVector(stream,j.position);
@ -386,7 +383,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
} }
const std::string& s = std::string(reinterpret_cast<char*>(stream.GetPtr()),len); const std::string& s = std::string(reinterpret_cast<char*>(stream.GetPtr()),len);
DefaultLogger::get()->debug("MS3D: Model comment: " + s); ASSIMP_LOG_DEBUG_F("MS3D: Model comment: ", s);
} }
if(stream.GetRemainingSize() > 4 && inrange((stream >> subversion,subversion),1u,3u)) { if(stream.GetRemainingSize() > 4 && inrange((stream >> subversion,subversion),1u,3u)) {

View File

@ -65,7 +65,7 @@ MakeVerboseFormatProcess::~MakeVerboseFormatProcess()
void MakeVerboseFormatProcess::Execute( aiScene* pScene) void MakeVerboseFormatProcess::Execute( aiScene* pScene)
{ {
ai_assert(NULL != pScene); ai_assert(NULL != pScene);
DefaultLogger::get()->debug("MakeVerboseFormatProcess begin"); ASSIMP_LOG_DEBUG("MakeVerboseFormatProcess begin");
bool bHas = false; bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
@ -73,12 +73,15 @@ void MakeVerboseFormatProcess::Execute( aiScene* pScene)
if( MakeVerboseFormat( pScene->mMeshes[a])) if( MakeVerboseFormat( pScene->mMeshes[a]))
bHas = true; bHas = true;
} }
if (bHas) DefaultLogger::get()->info("MakeVerboseFormatProcess finished. There was much work to do ..."); if (bHas) {
else DefaultLogger::get()->debug("MakeVerboseFormatProcess. There was nothing to do."); ASSIMP_LOG_INFO("MakeVerboseFormatProcess finished. There was much work to do ...");
} else {
ASSIMP_LOG_DEBUG("MakeVerboseFormatProcess. There was nothing to do.");
}
pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT; pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh) bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)

View File

@ -130,18 +130,18 @@ void NDOImporter::InternReadFile( const std::string& pFile,
unsigned int file_format = 12; unsigned int file_format = 12;
if (!strncmp("1.0",head+6,3)) { if (!strncmp("1.0",head+6,3)) {
file_format = 10; file_format = 10;
DefaultLogger::get()->info("NDO file format is 1.0"); ASSIMP_LOG_INFO("NDO file format is 1.0");
} }
else if (!strncmp("1.1",head+6,3)) { else if (!strncmp("1.1",head+6,3)) {
file_format = 11; file_format = 11;
DefaultLogger::get()->info("NDO file format is 1.1"); ASSIMP_LOG_INFO("NDO file format is 1.1");
} }
else if (!strncmp("1.2",head+6,3)) { else if (!strncmp("1.2",head+6,3)) {
file_format = 12; file_format = 12;
DefaultLogger::get()->info("NDO file format is 1.2"); ASSIMP_LOG_INFO("NDO file format is 1.2");
} }
else { else {
ASSIMP_LOG_WARN(std::string("Unrecognized nendo file format version, continuing happily ... :") + (head+6)); ASSIMP_LOG_WARN_F( "Unrecognized nendo file format version, continuing happily ... :", (head+6));
} }
reader.IncPtr(2); /* skip flags */ reader.IncPtr(2); /* skip flags */

View File

@ -132,7 +132,7 @@ const aiImporterDesc* NFFImporter::GetInfo () const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Loads the materail table for the NFF2 file format from an external file // Loads the material table for the NFF2 file format from an external file
void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output, void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
const std::string& path, IOSystem* pIOHandler) const std::string& path, IOSystem* pIOHandler)
{ {
@ -140,7 +140,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
// Check whether we can read from the file // Check whether we can read from the file
if( !file.get()) { if( !file.get()) {
DefaultLogger::get()->error("NFF2: Unable to open material library " + path + "."); ASSIMP_LOG_ERROR("NFF2: Unable to open material library " + path + ".");
return; return;
} }
@ -158,7 +158,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
// The file should start with the magic sequence "mat" // The file should start with the magic sequence "mat"
if (!TokenMatch(buffer,"mat",3)) { if (!TokenMatch(buffer,"mat",3)) {
DefaultLogger::get()->error("NFF2: Not a valid material library " + path + "."); ASSIMP_LOG_ERROR_F("NFF2: Not a valid material library ", path, ".");
return; return;
} }
@ -174,7 +174,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
// 'version' defines the version of the file format // 'version' defines the version of the file format
if (TokenMatch(sz,"version",7)) if (TokenMatch(sz,"version",7))
{ {
DefaultLogger::get()->info("NFF (Sense8) material library file format: " + std::string(sz)); ASSIMP_LOG_INFO_F("NFF (Sense8) material library file format: ", std::string(sz));
} }
// 'matdef' starts a new material in the file // 'matdef' starts a new material in the file
else if (TokenMatch(sz,"matdef",6)) else if (TokenMatch(sz,"matdef",6))
@ -192,8 +192,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
{ {
if (!curShader) if (!curShader)
{ {
DefaultLogger::get()->error(std::string("NFF2 material library: Found element ") + ASSIMP_LOG_ERROR_F("NFF2 material library: Found element ", sz, "but there is no active material");
sz + "but there is no active material");
continue; continue;
} }
} }
@ -308,7 +307,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
SkipSpaces(line,&sz); SkipSpaces(line,&sz);
if (TokenMatch(sz,"version",7)) if (TokenMatch(sz,"version",7))
{ {
DefaultLogger::get()->info("NFF (Sense8) file format: " + std::string(sz)); ASSIMP_LOG_INFO_F("NFF (Sense8) file format: ", sz );
} }
else if (TokenMatch(sz,"viewpos",7)) else if (TokenMatch(sz,"viewpos",7))
{ {
@ -471,7 +470,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
unsigned int m = ::strtoul10(sz,&sz); unsigned int m = ::strtoul10(sz,&sz);
if (m >= (unsigned int)tempPositions.size()) if (m >= (unsigned int)tempPositions.size())
{ {
DefaultLogger::get()->error("NFF2: Vertex index overflow"); ASSIMP_LOG_ERROR("NFF2: Vertex index overflow");
m= 0; m= 0;
} }
// mesh.vertices.push_back (tempPositions[idx]); // mesh.vertices.push_back (tempPositions[idx]);
@ -577,7 +576,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
matIdx = ::strtoul10(sz,&sz); matIdx = ::strtoul10(sz,&sz);
if (matIdx >= materialTable.size()) if (matIdx >= materialTable.size())
{ {
DefaultLogger::get()->error("NFF2: Material index overflow."); ASSIMP_LOG_ERROR("NFF2: Material index overflow.");
matIdx = 0; matIdx = 0;
} }
@ -750,7 +749,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
{ {
if(!GetNextLine(buffer,line)) if(!GetNextLine(buffer,line))
{ {
DefaultLogger::get()->error("NFF: Unexpected EOF was encountered. Patch definition incomplete"); ASSIMP_LOG_ERROR("NFF: Unexpected EOF was encountered. Patch definition incomplete");
continue; continue;
} }
@ -943,7 +942,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
if(!GetNextLine(buffer,line)) if(!GetNextLine(buffer,line))
{ {
DefaultLogger::get()->error("NFF: Unexpected end of file (cone definition not complete)"); ASSIMP_LOG_ERROR("NFF: Unexpected end of file (cone definition not complete)");
break; break;
} }
sz = line; sz = line;
@ -955,7 +954,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
if(!GetNextLine(buffer,line)) if(!GetNextLine(buffer,line))
{ {
DefaultLogger::get()->error("NFF: Unexpected end of file (cone definition not complete)"); ASSIMP_LOG_ERROR("NFF: Unexpected end of file (cone definition not complete)");
break; break;
} }
sz = line; sz = line;
@ -971,7 +970,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
float f; float f;
if (( f = currentMesh.dir.Length()) < 10e-3f ) if (( f = currentMesh.dir.Length()) < 10e-3f )
{ {
DefaultLogger::get()->error("NFF: Cone height is close to zero"); ASSIMP_LOG_ERROR("NFF: Cone height is close to zero");
continue; continue;
} }
currentMesh.dir /= f; // normalize currentMesh.dir /= f; // normalize
@ -1029,18 +1028,20 @@ void NFFImporter::InternReadFile( const std::string& pFile,
// 'pb' - bezier patch. Not supported yet // 'pb' - bezier patch. Not supported yet
else if (TokenMatch(sz,"pb",2)) else if (TokenMatch(sz,"pb",2))
{ {
DefaultLogger::get()->error("NFF: Encountered unsupported ID: bezier patch"); ASSIMP_LOG_ERROR("NFF: Encountered unsupported ID: bezier patch");
} }
// 'pn' - NURBS. Not supported yet // 'pn' - NURBS. Not supported yet
else if (TokenMatch(sz,"pn",2) || TokenMatch(sz,"pnn",3)) else if (TokenMatch(sz,"pn",2) || TokenMatch(sz,"pnn",3))
{ {
DefaultLogger::get()->error("NFF: Encountered unsupported ID: NURBS"); ASSIMP_LOG_ERROR("NFF: Encountered unsupported ID: NURBS");
} }
// '' - comment // '' - comment
else if ('#' == line[0]) else if ('#' == line[0])
{ {
const char* sz;SkipSpaces(&line[1],&sz); const char* sz;SkipSpaces(&line[1],&sz);
if (!IsLineEnd(*sz))DefaultLogger::get()->info(sz); if (!IsLineEnd(*sz)) {
ASSIMP_LOG_INFO(sz);
}
} }
} }
} }

View File

@ -157,7 +157,7 @@ void OFFImporter::InternReadFile( const std::string& pFile,
{ {
if(!GetNextLine(buffer,line)) if(!GetNextLine(buffer,line))
{ {
DefaultLogger::get()->error("OFF: The number of verts in the header is incorrect"); ASSIMP_LOG_ERROR("OFF: The number of verts in the header is incorrect");
break; break;
} }
aiVector3D& v = tempPositions[i]; aiVector3D& v = tempPositions[i];
@ -175,14 +175,14 @@ void OFFImporter::InternReadFile( const std::string& pFile,
{ {
if(!GetNextLine(buffer,line)) if(!GetNextLine(buffer,line))
{ {
DefaultLogger::get()->error("OFF: The number of faces in the header is incorrect"); ASSIMP_LOG_ERROR("OFF: The number of faces in the header is incorrect");
break; break;
} }
sz = line;SkipSpaces(&sz); sz = line;SkipSpaces(&sz);
faces->mNumIndices = strtoul10(sz,&sz); faces->mNumIndices = strtoul10(sz,&sz);
if(!(faces->mNumIndices) || faces->mNumIndices > 9) if(!(faces->mNumIndices) || faces->mNumIndices > 9)
{ {
DefaultLogger::get()->error("OFF: Faces with zero indices aren't allowed"); ASSIMP_LOG_ERROR("OFF: Faces with zero indices aren't allowed");
--mesh->mNumFaces; --mesh->mNumFaces;
continue; continue;
} }
@ -217,7 +217,7 @@ void OFFImporter::InternReadFile( const std::string& pFile,
idx = strtoul10(sz,&sz); idx = strtoul10(sz,&sz);
if ((idx) >= numVertices) if ((idx) >= numVertices)
{ {
DefaultLogger::get()->error("OFF: Vertex index is out of range"); ASSIMP_LOG_ERROR("OFF: Vertex index is out of range");
idx = numVertices-1; idx = numVertices-1;
} }
faces->mIndices[m] = p++; faces->mIndices[m] = p++;

View File

@ -557,7 +557,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
const unsigned int numMaterials = (unsigned int) pModel->m_MaterialLib.size(); const unsigned int numMaterials = (unsigned int) pModel->m_MaterialLib.size();
pScene->mNumMaterials = 0; pScene->mNumMaterials = 0;
if ( pModel->m_MaterialLib.empty() ) { if ( pModel->m_MaterialLib.empty() ) {
DefaultLogger::get()->debug("OBJ: no materials specified"); ASSIMP_LOG_DEBUG("OBJ: no materials specified");
return; return;
} }
@ -591,7 +591,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
break; break;
default: default:
sm = aiShadingMode_Gouraud; sm = aiShadingMode_Gouraud;
DefaultLogger::get()->error("OBJ: unexpected illumination model (0-2 recognized)"); ASSIMP_LOG_ERROR("OBJ: unexpected illumination model (0-2 recognized)");
} }
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL); mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);

View File

@ -366,7 +366,7 @@ void ObjFileMtlImporter::getTexture() {
out = & m_pModel->m_pCurrentMaterial->textureSpecularity; out = & m_pModel->m_pCurrentMaterial->textureSpecularity;
clampIndex = ObjFile::Material::TextureSpecularityType; clampIndex = ObjFile::Material::TextureSpecularityType;
} else { } else {
DefaultLogger::get()->error("OBJ/MTL: Encountered unknown texture type"); ASSIMP_LOG_ERROR("OBJ/MTL: Encountered unknown texture type");
return; return;
} }

View File

@ -426,7 +426,7 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
if ( *m_DataIt =='/' ) { if ( *m_DataIt =='/' ) {
if (type == aiPrimitiveType_POINT) { if (type == aiPrimitiveType_POINT) {
DefaultLogger::get()->error("Obj: Separator unexpected in point statement"); ASSIMP_LOG_ERROR("Obj: Separator unexpected in point statement");
} }
if (iPos == 0) { if (iPos == 0) {
//if there are no texture coordinates in the file, but normals //if there are no texture coordinates in the file, but normals
@ -486,7 +486,7 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
} }
if ( face->m_vertices.empty() ) { if ( face->m_vertices.empty() ) {
DefaultLogger::get()->error("Obj: Ignoring empty face"); ASSIMP_LOG_ERROR("Obj: Ignoring empty face");
// skip line and clean up // skip line and clean up
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine ); m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
delete face; delete face;
@ -556,7 +556,7 @@ void ObjFileParser::getMaterialDesc() {
// This may be the case if the material library is missing. We don't want to lose all // This may be the case if the material library is missing. We don't want to lose all
// materials if that happens, so create a new named material instead of discarding it // materials if that happens, so create a new named material instead of discarding it
// completely. // completely.
DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", creating new material"); ASSIMP_LOG_ERROR("OBJ: failed to locate material " + strName + ", creating new material");
m_pModel->m_pCurrentMaterial = new ObjFile::Material(); m_pModel->m_pCurrentMaterial = new ObjFile::Material();
m_pModel->m_pCurrentMaterial->MaterialName.Set(strName); m_pModel->m_pCurrentMaterial->MaterialName.Set(strName);
m_pModel->m_MaterialLib.push_back(strName); m_pModel->m_MaterialLib.push_back(strName);
@ -620,12 +620,12 @@ void ObjFileParser::getMaterialLib() {
IOStream *pFile = m_pIO->Open( absName ); IOStream *pFile = m_pIO->Open( absName );
if ( nullptr == pFile ) { if ( nullptr == pFile ) {
DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName); ASSIMP_LOG_ERROR("OBJ: Unable to locate material file " + strMatName);
std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl"; std::string strMatFallbackName = m_originalObjFileName.substr(0, m_originalObjFileName.length() - 3) + "mtl";
DefaultLogger::get()->info("OBJ: Opening fallback material file " + strMatFallbackName); ASSIMP_LOG_INFO("OBJ: Opening fallback material file " + strMatFallbackName);
pFile = m_pIO->Open(strMatFallbackName); pFile = m_pIO->Open(strMatFallbackName);
if (!pFile) { if (!pFile) {
DefaultLogger::get()->error("OBJ: Unable to locate fallback material file " + strMatFallbackName); ASSIMP_LOG_ERROR("OBJ: Unable to locate fallback material file " + strMatFallbackName);
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine); m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
return; return;
} }
@ -817,7 +817,7 @@ void ObjFileParser::createMesh( const std::string &meshName )
} }
else else
{ {
DefaultLogger::get()->error("OBJ: No object detected to attach a new mesh instance."); ASSIMP_LOG_ERROR("OBJ: No object detected to attach a new mesh instance.");
} }
} }
@ -851,7 +851,7 @@ bool ObjFileParser::needsNewMesh( const std::string &materialName )
void ObjFileParser::reportErrorTokenInFace() void ObjFileParser::reportErrorTokenInFace()
{ {
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine ); m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
DefaultLogger::get()->error("OBJ: Not supported token in face description detected"); ASSIMP_LOG_ERROR("OBJ: Not supported token in face description detected");
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -176,7 +176,7 @@ uint16_t OgreBinarySerializer::ReadHeader(bool readLen)
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1) #if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
if (id != HEADER_CHUNK_ID) if (id != HEADER_CHUNK_ID)
{ {
DefaultLogger::get()->debug(Formatter::format() << (assetMode == AM_Mesh ASSIMP_LOG_DEBUG(Formatter::format() << (assetMode == AM_Mesh
? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id)))); ? MeshHeaderToString(static_cast<MeshChunkId>(id)) : SkeletonHeaderToString(static_cast<SkeletonChunkId>(id))));
} }
#endif #endif
@ -192,7 +192,7 @@ void OgreBinarySerializer::RollbackHeader()
void OgreBinarySerializer::SkipBytes(size_t numBytes) void OgreBinarySerializer::SkipBytes(size_t numBytes)
{ {
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1) #if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug(Formatter::format() << "Skipping " << numBytes << " bytes"); ASSIMP_LOG_DEBUG_F( "Skipping ", numBytes, " bytes");
#endif #endif
m_reader->IncPtr(numBytes); m_reader->IncPtr(numBytes);
@ -237,8 +237,8 @@ void OgreBinarySerializer::ReadMesh(Mesh *mesh)
{ {
mesh->hasSkeletalAnimations = Read<bool>(); mesh->hasSkeletalAnimations = Read<bool>();
DefaultLogger::get()->debug("Reading Mesh"); ASSIMP_LOG_DEBUG("Reading Mesh");
DefaultLogger::get()->debug(Formatter::format() << " - Skeletal animations: " << (mesh->hasSkeletalAnimations ? "true" : "false")); ASSIMP_LOG_DEBUG_F( " - Skeletal animations: ", mesh->hasSkeletalAnimations ? "true" : "false" );
if (!AtEnd()) if (!AtEnd())
{ {
@ -420,9 +420,9 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
submesh->indexData->faceCount = static_cast<uint32_t>(submesh->indexData->count / 3); submesh->indexData->faceCount = static_cast<uint32_t>(submesh->indexData->count / 3);
submesh->indexData->is32bit = Read<bool>(); submesh->indexData->is32bit = Read<bool>();
DefaultLogger::get()->debug(Formatter::format() << "Reading SubMesh " << mesh->subMeshes.size()); ASSIMP_LOG_DEBUG_F( "Reading SubMesh ", mesh->subMeshes.size());
DefaultLogger::get()->debug(Formatter::format() << " - Material: '" << submesh->materialRef << "'"); ASSIMP_LOG_DEBUG_F( " - Material: '", submesh->materialRef, "'");
DefaultLogger::get()->debug(Formatter::format() << " - Uses shared geometry: " << (submesh->usesSharedVertexData ? "true" : "false")); ASSIMP_LOG_DEBUG_F( " - Uses shared geometry: ", submesh->usesSharedVertexData ? "true" : "false" );
// Index buffer // Index buffer
if (submesh->indexData->count > 0) if (submesh->indexData->count > 0)
@ -431,9 +431,9 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
uint8_t *indexBuffer = ReadBytes(numBytes); uint8_t *indexBuffer = ReadBytes(numBytes);
submesh->indexData->buffer = MemoryStreamPtr(new Assimp::MemoryIOStream(indexBuffer, numBytes, true)); submesh->indexData->buffer = MemoryStreamPtr(new Assimp::MemoryIOStream(indexBuffer, numBytes, true));
DefaultLogger::get()->debug(Formatter::format() << " - " << submesh->indexData->faceCount ASSIMP_LOG_DEBUG_F( " - ", submesh->indexData->faceCount,
<< " faces from " << submesh->indexData->count << (submesh->indexData->is32bit ? " 32bit" : " 16bit") " faces from ", submesh->indexData->count, (submesh->indexData->is32bit ? " 32bit" : " 16bit"),
<< " indexes of " << numBytes << " bytes"); " indexes of ", numBytes, " bytes");
} }
// Vertex buffer if not referencing the shared geometry // Vertex buffer if not referencing the shared geometry
@ -549,7 +549,7 @@ void OgreBinarySerializer::ReadSubMeshNames(Mesh *mesh)
} }
submesh->name = ReadLine(); submesh->name = ReadLine();
DefaultLogger::get()->debug(Formatter::format() << " - SubMesh " << submesh->index << " name '" << submesh->name << "'"); ASSIMP_LOG_DEBUG_F( " - SubMesh ", submesh->index, " name '", submesh->name, "'");
if (!AtEnd()) if (!AtEnd())
id = ReadHeader(); id = ReadHeader();
@ -563,7 +563,7 @@ void OgreBinarySerializer::ReadGeometry(VertexData *dest)
{ {
dest->count = Read<uint32_t>(); dest->count = Read<uint32_t>();
DefaultLogger::get()->debug(Formatter::format() << " - Reading geometry of " << dest->count << " vertices"); ASSIMP_LOG_DEBUG_F( " - Reading geometry of ", dest->count, " vertices");
if (!AtEnd()) if (!AtEnd())
{ {
@ -620,8 +620,8 @@ void OgreBinarySerializer::ReadGeometryVertexElement(VertexData *dest)
element.offset = Read<uint16_t>(); element.offset = Read<uint16_t>();
element.index = Read<uint16_t>(); element.index = Read<uint16_t>();
DefaultLogger::get()->debug(Formatter::format() << " - Vertex element " << element.SemanticToString() << " of type " ASSIMP_LOG_DEBUG_F( " - Vertex element ", element.SemanticToString(), " of type ",
<< element.TypeToString() << " index=" << element.index << " source=" << element.source); element.TypeToString(), " index=", element.index, " source=", element.source);
dest->vertexElements.push_back(element); dest->vertexElements.push_back(element);
} }
@ -642,7 +642,7 @@ void OgreBinarySerializer::ReadGeometryVertexBuffer(VertexData *dest)
uint8_t *vertexBuffer = ReadBytes(numBytes); uint8_t *vertexBuffer = ReadBytes(numBytes);
dest->vertexBindings[bindIndex] = MemoryStreamPtr(new Assimp::MemoryIOStream(vertexBuffer, numBytes, true)); dest->vertexBindings[bindIndex] = MemoryStreamPtr(new Assimp::MemoryIOStream(vertexBuffer, numBytes, true));
DefaultLogger::get()->debug(Formatter::format() << " - Read vertex buffer for source " << bindIndex << " of " << numBytes << " bytes"); ASSIMP_LOG_DEBUG_F( " - Read vertex buffer for source ", bindIndex, " of ", numBytes, " bytes");
} }
void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/) void OgreBinarySerializer::ReadEdgeList(Mesh * /*mesh*/)
@ -892,13 +892,13 @@ MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHand
{ {
if (!EndsWith(filename, ".skeleton", false)) if (!EndsWith(filename, ".skeleton", false))
{ {
DefaultLogger::get()->error("Imported Mesh is referencing to unsupported '" + filename + "' skeleton file."); ASSIMP_LOG_ERROR_F("Imported Mesh is referencing to unsupported '", filename, "' skeleton file.");
return MemoryStreamReaderPtr(); return MemoryStreamReaderPtr();
} }
if (!pIOHandler->Exists(filename)) if (!pIOHandler->Exists(filename))
{ {
DefaultLogger::get()->error("Failed to find skeleton file '" + filename + "' that is referenced by imported Mesh."); ASSIMP_LOG_ERROR_F("Failed to find skeleton file '", filename, "' that is referenced by imported Mesh.");
return MemoryStreamReaderPtr(); return MemoryStreamReaderPtr();
} }
@ -925,7 +925,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
<< " Supported versions: " << SKELETON_VERSION_1_8 << " and " << SKELETON_VERSION_1_1); << " Supported versions: " << SKELETON_VERSION_1_8 << " and " << SKELETON_VERSION_1_1);
} }
DefaultLogger::get()->debug("Reading Skeleton"); ASSIMP_LOG_DEBUG("Reading Skeleton");
bool firstBone = true; bool firstBone = true;
bool firstAnim = true; bool firstAnim = true;
@ -944,7 +944,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
{ {
if (firstBone) if (firstBone)
{ {
DefaultLogger::get()->debug(" - Bones"); ASSIMP_LOG_DEBUG(" - Bones");
firstBone = false; firstBone = false;
} }
@ -960,7 +960,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
{ {
if (firstAnim) if (firstAnim)
{ {
DefaultLogger::get()->debug(" - Animations"); ASSIMP_LOG_DEBUG(" - Animations");
firstAnim = false; firstAnim = false;
} }
@ -1003,7 +1003,7 @@ void OgreBinarySerializer::ReadBone(Skeleton *skeleton)
throw DeadlyImportError(Formatter::format() << "Ogre Skeleton bone indexes not contiguous. Error at bone index " << bone->id); throw DeadlyImportError(Formatter::format() << "Ogre Skeleton bone indexes not contiguous. Error at bone index " << bone->id);
} }
DefaultLogger::get()->debug(Formatter::format() << " " << bone->id << " " << bone->name); ASSIMP_LOG_DEBUG_F( " ", bone->id, " ", bone->name);
skeleton->bones.push_back(bone); skeleton->bones.push_back(bone);
} }
@ -1053,7 +1053,7 @@ void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton)
skeleton->animations.push_back(anim); skeleton->animations.push_back(anim);
DefaultLogger::get()->debug(Formatter::format() << " " << anim->name << " (" << anim->length << " sec, " << anim->tracks.size() << " tracks)"); ASSIMP_LOG_DEBUG_F( " ", anim->name, " (", anim->length, " sec, ", anim->tracks.size(), " tracks)");
} }
void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, Animation *dest) void OgreBinarySerializer::ReadSkeletonAnimationTrack(Skeleton * /*skeleton*/, Animation *dest)

View File

@ -175,18 +175,18 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
if (materialFile) { if (materialFile) {
break; break;
} }
DefaultLogger::get()->debug(Formatter::format() << "Source file for material '" << materialName << "' " << potentialFiles[i] << " does not exist"); ASSIMP_LOG_DEBUG_F( "Source file for material '", materialName, "' ", potentialFiles[i], " does not exist");
} }
if (!materialFile) if (!materialFile)
{ {
DefaultLogger::get()->error(Formatter::format() << "Failed to find source file for material '" << materialName << "'"); ASSIMP_LOG_ERROR_F( "Failed to find source file for material '", materialName, "'");
return 0; return 0;
} }
std::unique_ptr<IOStream> stream(materialFile); std::unique_ptr<IOStream> stream(materialFile);
if (stream->FileSize() == 0) if (stream->FileSize() == 0)
{ {
ASSIMP_LOG_WARN(Formatter::format() << "Source file for material '" << materialName << "' is empty (size is 0 bytes)"); ASSIMP_LOG_WARN_F( "Source file for material '", materialName, "' is empty (size is 0 bytes)");
return 0; return 0;
} }
@ -201,7 +201,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
ss << &data[0]; ss << &data[0];
} }
DefaultLogger::get()->debug("Reading material '" + materialName + "'"); ASSIMP_LOG_DEBUG_F("Reading material '", materialName, "'");
aiMaterial *material = new aiMaterial(); aiMaterial *material = new aiMaterial();
m_textures.clear(); m_textures.clear();
@ -234,7 +234,6 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
ss >> linePart; ss >> linePart;
if (linePart != materialName) if (linePart != materialName)
{ {
//DefaultLogger::get()->debug(Formatter::format() << "Found material '" << linePart << "' that does not match at index " << ss.tellg());
ss >> linePart; ss >> linePart;
continue; continue;
} }
@ -242,11 +241,11 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
NextAfterNewLine(ss, linePart); NextAfterNewLine(ss, linePart);
if (linePart != partBlockStart) if (linePart != partBlockStart)
{ {
DefaultLogger::get()->error(Formatter::format() << "Invalid material: block start missing near index " << ss.tellg()); ASSIMP_LOG_ERROR_F( "Invalid material: block start missing near index ", ss.tellg());
return material; return material;
} }
DefaultLogger::get()->debug("material '" + materialName + "'"); ASSIMP_LOG_DEBUG_F("material '", materialName, "'");
while(linePart != partBlockEnd) while(linePart != partBlockEnd)
{ {
@ -350,11 +349,11 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream
if (linePart != partBlockStart) if (linePart != partBlockStart)
{ {
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Technique block start missing near index " << ss.tellg()); ASSIMP_LOG_ERROR_F( "Invalid material: Technique block start missing near index ", ss.tellg());
return false; return false;
} }
DefaultLogger::get()->debug(" technique '" + techniqueName + "'"); ASSIMP_LOG_DEBUG_F(" technique '", techniqueName, "'");
const string partPass = "pass"; const string partPass = "pass";
@ -386,11 +385,11 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
if (linePart != partBlockStart) if (linePart != partBlockStart)
{ {
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Pass block start missing near index " << ss.tellg()); ASSIMP_LOG_ERROR_F( "Invalid material: Pass block start missing near index ", ss.tellg());
return false; return false;
} }
DefaultLogger::get()->debug(" pass '" + passName + "'"); ASSIMP_LOG_DEBUG_F(" pass '", passName, "'");
const string partAmbient = "ambient"; const string partAmbient = "ambient";
const string partDiffuse = "diffuse"; const string partDiffuse = "diffuse";
@ -417,7 +416,7 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
ss >> r >> g >> b; ss >> r >> g >> b;
const aiColor3D color(r, g, b); const aiColor3D color(r, g, b);
DefaultLogger::get()->debug(Formatter::format() << " " << linePart << " " << r << " " << g << " " << b); ASSIMP_LOG_DEBUG_F( " ", linePart, " ", r, " ", g, " ", b);
if (linePart == partAmbient) if (linePart == partAmbient)
{ {
@ -452,11 +451,11 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
if (linePart != partBlockStart) if (linePart != partBlockStart)
{ {
DefaultLogger::get()->error(Formatter::format() << "Invalid material: Texture unit block start missing near index " << ss.tellg()); ASSIMP_LOG_ERROR_F( "Invalid material: Texture unit block start missing near index ", ss.tellg());
return false; return false;
} }
DefaultLogger::get()->debug(" texture_unit '" + textureUnitName + "'"); ASSIMP_LOG_DEBUG_F(" texture_unit '", textureUnitName, "'");
const string partTexture = "texture"; const string partTexture = "texture";
const string partTextCoordSet = "tex_coord_set"; const string partTextCoordSet = "tex_coord_set";
@ -491,7 +490,7 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
if (posSuffix != string::npos && posUnderscore != string::npos && posSuffix > posUnderscore) if (posSuffix != string::npos && posUnderscore != string::npos && posSuffix > posUnderscore)
{ {
string identifier = Ogre::ToLower(textureRef.substr(posUnderscore, posSuffix - posUnderscore)); string identifier = Ogre::ToLower(textureRef.substr(posUnderscore, posSuffix - posUnderscore));
DefaultLogger::get()->debug(Formatter::format() << "Detecting texture type from filename postfix '" << identifier << "'"); ASSIMP_LOG_DEBUG_F( "Detecting texture type from filename postfix '", identifier, "'");
if (identifier == "_n" || identifier == "_nrm" || identifier == "_nrml" || identifier == "_normal" || identifier == "_normals" || identifier == "_normalmap") if (identifier == "_n" || identifier == "_nrm" || identifier == "_nrml" || identifier == "_normal" || identifier == "_normals" || identifier == "_normalmap")
{ {
@ -581,8 +580,8 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
unsigned int textureTypeIndex = m_textures[textureType]; unsigned int textureTypeIndex = m_textures[textureType];
m_textures[textureType]++; m_textures[textureType]++;
DefaultLogger::get()->debug(Formatter::format() << " texture '" << textureRef << "' type " << textureType ASSIMP_LOG_DEBUG_F( " texture '", textureRef, "' type ", textureType,
<< " index " << textureTypeIndex << " UV " << uvCoord); " index ", textureTypeIndex, " UV ", uvCoord);
aiString assimpTextureRef(textureRef); aiString assimpTextureRef(textureRef);
material->AddProperty(&assimpTextureRef, AI_MATKEY_TEXTURE(textureType, textureTypeIndex)); material->AddProperty(&assimpTextureRef, AI_MATKEY_TEXTURE(textureType, textureTypeIndex));

View File

@ -190,7 +190,7 @@ std::string &OgreXmlSerializer::NextNode()
CurrentNodeName(true); CurrentNodeName(true);
#if (OGRE_XML_SERIALIZER_DEBUG == 1) #if (OGRE_XML_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug("<" + m_currentNodeName + ">"); ASSIMP_LOG_DEBUG"<" + m_currentNodeName + ">");
#endif #endif
return m_currentNodeName; return m_currentNodeName;
} }
@ -210,7 +210,7 @@ std::string OgreXmlSerializer::CurrentNodeName(bool forceRead)
std::string &OgreXmlSerializer::SkipCurrentNode() std::string &OgreXmlSerializer::SkipCurrentNode()
{ {
#if (OGRE_XML_SERIALIZER_DEBUG == 1) #if (OGRE_XML_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug("Skipping node <" + m_currentNodeName + ">"); ASSIMP_LOG_DEBUG("Skipping node <" + m_currentNodeName + ">");
#endif #endif
for(;;) { for(;;) {
@ -317,7 +317,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <mesh>"); throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <mesh>");
} }
DefaultLogger::get()->debug("Reading Mesh"); ASSIMP_LOG_DEBUG("Reading Mesh");
NextNode(); NextNode();
@ -351,7 +351,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
else if (m_currentNodeName == nnSkeletonLink) else if (m_currentNodeName == nnSkeletonLink)
{ {
mesh->skeletonRef = ReadAttribute<std::string>("name"); mesh->skeletonRef = ReadAttribute<std::string>("name");
DefaultLogger::get()->debug("Read skeleton link " + mesh->skeletonRef); ASSIMP_LOG_DEBUG_F("Read skeleton link ", mesh->skeletonRef);
NextNode(); NextNode();
} }
// Assimp incompatible/ignored nodes // Assimp incompatible/ignored nodes
@ -363,7 +363,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
void OgreXmlSerializer::ReadGeometry(VertexDataXml *dest) void OgreXmlSerializer::ReadGeometry(VertexDataXml *dest)
{ {
dest->count = ReadAttribute<uint32_t>("vertexcount"); dest->count = ReadAttribute<uint32_t>("vertexcount");
DefaultLogger::get()->debug(Formatter::format() << " - Reading geometry of " << dest->count << " vertices"); ASSIMP_LOG_DEBUG_F( " - Reading geometry of ", dest->count, " vertices");
NextNode(); NextNode();
while(m_currentNodeName == nnVertexBuffer) { while(m_currentNodeName == nnVertexBuffer) {
@ -385,22 +385,22 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest)
if (positions) if (positions)
{ {
DefaultLogger::get()->debug(" - Contains positions"); ASSIMP_LOG_DEBUG(" - Contains positions");
dest->positions.reserve(dest->count); dest->positions.reserve(dest->count);
} }
if (normals) if (normals)
{ {
DefaultLogger::get()->debug(" - Contains normals"); ASSIMP_LOG_DEBUG(" - Contains normals");
dest->normals.reserve(dest->count); dest->normals.reserve(dest->count);
} }
if (tangents) if (tangents)
{ {
DefaultLogger::get()->debug(" - Contains tangents"); ASSIMP_LOG_DEBUG(" - Contains tangents");
dest->tangents.reserve(dest->count); dest->tangents.reserve(dest->count);
} }
if (uvs > 0) if (uvs > 0)
{ {
DefaultLogger::get()->debug(Formatter::format() << " - Contains " << uvs << " texture coords"); ASSIMP_LOG_DEBUG_F( " - Contains ", uvs, " texture coords");
dest->uvs.resize(uvs); dest->uvs.resize(uvs);
for(size_t i=0, len=dest->uvs.size(); i<len; ++i) { for(size_t i=0, len=dest->uvs.size(); i<len; ++i) {
dest->uvs[i].reserve(dest->count); dest->uvs[i].reserve(dest->count);
@ -508,7 +508,7 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest)
} }
} }
if (warn) { if (warn) {
DefaultLogger::get()->warn("Vertex buffer attribute read not implemented for element: " + m_currentNodeName); ASSIMP_LOG_WARN_F("Vertex buffer attribute read not implemented for element: ", m_currentNodeName);
} }
} }
@ -554,9 +554,9 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh)
submesh->usesSharedVertexData = ReadAttribute<bool>(anUseSharedVertices); submesh->usesSharedVertexData = ReadAttribute<bool>(anUseSharedVertices);
} }
DefaultLogger::get()->debug(Formatter::format() << "Reading SubMesh " << mesh->subMeshes.size()); ASSIMP_LOG_DEBUG_F( "Reading SubMesh ", mesh->subMeshes.size());
DefaultLogger::get()->debug(Formatter::format() << " - Material: '" << submesh->materialRef << "'"); ASSIMP_LOG_DEBUG_F( " - Material: '", submesh->materialRef, "'");
DefaultLogger::get()->debug(Formatter::format() << " - Uses shared geometry: " << (submesh->usesSharedVertexData ? "true" : "false")); ASSIMP_LOG_DEBUG_F( " - Uses shared geometry: ", (submesh->usesSharedVertexData ? "true" : "false"));
// TODO: maybe we have always just 1 faces and 1 geometry and always in this order. this loop will only work correct, when the order // TODO: maybe we have always just 1 faces and 1 geometry and always in this order. this loop will only work correct, when the order
// of faces and geometry changed, and not if we have more than one of one // of faces and geometry changed, and not if we have more than one of one
@ -587,7 +587,7 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh)
/// @todo Support quads if Ogre even supports them in XML (I'm not sure but I doubt it) /// @todo Support quads if Ogre even supports them in XML (I'm not sure but I doubt it)
if (!quadWarned && HasAttribute(anV4)) { if (!quadWarned && HasAttribute(anV4)) {
DefaultLogger::get()->warn("Submesh <face> has quads with <v4>, only triangles are supported at the moment!"); ASSIMP_LOG_WARN("Submesh <face> has quads with <v4>, only triangles are supported at the moment!");
quadWarned = true; quadWarned = true;
} }
@ -597,31 +597,25 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh)
NextNode(); NextNode();
} }
if (submesh->indexData->faces.size() == submesh->indexData->faceCount) if (submesh->indexData->faces.size() == submesh->indexData->faceCount) {
{ ASSIMP_LOG_DEBUG_F( " - Faces ", submesh->indexData->faceCount);
DefaultLogger::get()->debug(Formatter::format() << " - Faces " << submesh->indexData->faceCount); } else {
}
else
{
throw DeadlyImportError(Formatter::format() << "Read only " << submesh->indexData->faces.size() << " faces when should have read " << submesh->indexData->faceCount); throw DeadlyImportError(Formatter::format() << "Read only " << submesh->indexData->faces.size() << " faces when should have read " << submesh->indexData->faceCount);
} }
} } else if (m_currentNodeName == nnGeometry) {
else if (m_currentNodeName == nnGeometry)
{
if (submesh->usesSharedVertexData) { if (submesh->usesSharedVertexData) {
throw DeadlyImportError("Found <geometry> in <submesh> when use shared geometry is true. Invalid mesh file."); throw DeadlyImportError("Found <geometry> in <submesh> when use shared geometry is true. Invalid mesh file.");
} }
submesh->vertexData = new VertexDataXml(); submesh->vertexData = new VertexDataXml();
ReadGeometry(submesh->vertexData); ReadGeometry(submesh->vertexData);
} } else if (m_currentNodeName == nnBoneAssignments) {
else if (m_currentNodeName == nnBoneAssignments)
{
ReadBoneAssignments(submesh->vertexData); ReadBoneAssignments(submesh->vertexData);
} }
// Assimp incompatible/ignored nodes // Assimp incompatible/ignored nodes
else else {
SkipCurrentNode(); SkipCurrentNode();
}
} }
submesh->index = static_cast<unsigned int>(mesh->subMeshes.size()); submesh->index = static_cast<unsigned int>(mesh->subMeshes.size());
@ -676,7 +670,7 @@ void OgreXmlSerializer::ReadBoneAssignments(VertexDataXml *dest)
} }
} }
DefaultLogger::get()->debug(Formatter::format() << " - " << dest->boneAssignments.size() << " bone assignments"); ASSIMP_LOG_DEBUG_F( " - ", dest->boneAssignments.size(), " bone assignments");
} }
// Skeleton // Skeleton
@ -731,13 +725,13 @@ XmlReaderPtr OgreXmlSerializer::OpenReader(Assimp::IOSystem *pIOHandler, const s
{ {
if (!EndsWith(filename, ".skeleton.xml", false)) if (!EndsWith(filename, ".skeleton.xml", false))
{ {
DefaultLogger::get()->error("Imported Mesh is referencing to unsupported '" + filename + "' skeleton file."); ASSIMP_LOG_ERROR_F("Imported Mesh is referencing to unsupported '", filename, "' skeleton file.");
return XmlReaderPtr(); return XmlReaderPtr();
} }
if (!pIOHandler->Exists(filename)) if (!pIOHandler->Exists(filename))
{ {
DefaultLogger::get()->error("Failed to find skeleton file '" + filename + "' that is referenced by imported Mesh."); ASSIMP_LOG_ERROR_F("Failed to find skeleton file '", filename, "' that is referenced by imported Mesh.");
return XmlReaderPtr(); return XmlReaderPtr();
} }
@ -760,7 +754,7 @@ void OgreXmlSerializer::ReadSkeleton(Skeleton *skeleton)
throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <skeleton>"); throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <skeleton>");
} }
DefaultLogger::get()->debug("Reading Skeleton"); ASSIMP_LOG_DEBUG("Reading Skeleton");
// Optional blend mode from root node // Optional blend mode from root node
if (HasAttribute("blendmode")) { if (HasAttribute("blendmode")) {
@ -793,7 +787,7 @@ void OgreXmlSerializer::ReadAnimations(Skeleton *skeleton)
throw DeadlyImportError("Cannot read <animations> for a Skeleton without bones"); throw DeadlyImportError("Cannot read <animations> for a Skeleton without bones");
} }
DefaultLogger::get()->debug(" - Animations"); ASSIMP_LOG_DEBUG(" - Animations");
NextNode(); NextNode();
while(m_currentNodeName == nnAnimation) while(m_currentNodeName == nnAnimation)
@ -809,7 +803,7 @@ void OgreXmlSerializer::ReadAnimations(Skeleton *skeleton)
ReadAnimationTracks(anim); ReadAnimationTracks(anim);
skeleton->animations.push_back(anim); skeleton->animations.push_back(anim);
DefaultLogger::get()->debug(Formatter::format() << " " << anim->name << " (" << anim->length << " sec, " << anim->tracks.size() << " tracks)"); ASSIMP_LOG_DEBUG_F( " ", anim->name, " (", anim->length, " sec, ", anim->tracks.size(), " tracks)");
} }
} }
@ -867,7 +861,7 @@ void OgreXmlSerializer::ReadAnimationKeyFrames(Animation *anim, VertexAnimationT
{ {
axis.x = 1.0f; axis.x = 1.0f;
if (angle != 0) { if (angle != 0) {
DefaultLogger::get()->warn("Found invalid a key frame with a zero rotation axis in animation: " + anim->name); ASSIMP_LOG_WARN_F("Found invalid a key frame with a zero rotation axis in animation: ", anim->name);
} }
} }
keyframe.rotation = aiQuaternion(axis, angle); keyframe.rotation = aiQuaternion(axis, angle);
@ -925,7 +919,7 @@ static bool BoneCompare(Bone *a, Bone *b)
void OgreXmlSerializer::ReadBones(Skeleton *skeleton) void OgreXmlSerializer::ReadBones(Skeleton *skeleton)
{ {
DefaultLogger::get()->debug(" - Bones"); ASSIMP_LOG_DEBUG(" - Bones");
NextNode(); NextNode();
while(m_currentNodeName == nnBone) while(m_currentNodeName == nnBone)
@ -994,7 +988,7 @@ void OgreXmlSerializer::ReadBones(Skeleton *skeleton)
for (size_t i=0, len=skeleton->bones.size(); i<len; ++i) for (size_t i=0, len=skeleton->bones.size(); i<len; ++i)
{ {
Bone *b = skeleton->bones[i]; Bone *b = skeleton->bones[i];
DefaultLogger::get()->debug(Formatter::format() << " " << b->id << " " << b->name); ASSIMP_LOG_DEBUG_F( " ", b->id, " ", b->name);
if (b->id != static_cast<uint16_t>(i)) { if (b->id != static_cast<uint16_t>(i)) {
throw DeadlyImportError(Formatter::format() << "Bone ids are not in sequence starting from 0. Missing index " << i); throw DeadlyImportError(Formatter::format() << "Bone ids are not in sequence starting from 0. Missing index " << i);

View File

@ -708,7 +708,7 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
} else if ( "quads" == propKey ) { } else if ( "quads" == propKey ) {
m_currentMesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON; m_currentMesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
} else { } else {
DefaultLogger::get()->warn( propKey + " is not supported primitive type." ); ASSIMP_LOG_WARN_F( propKey, " is not supported primitive type." );
} }
} }
} }
@ -1213,12 +1213,11 @@ void OpenGEXImporter::resolveReferences() {
if ( nullptr != m_currentMesh ) { if ( nullptr != m_currentMesh ) {
unsigned int matIdx = static_cast< unsigned int >( m_material2refMap[ name ] ); unsigned int matIdx = static_cast< unsigned int >( m_material2refMap[ name ] );
if ( m_currentMesh->mMaterialIndex != 0 ) { if ( m_currentMesh->mMaterialIndex != 0 ) {
DefaultLogger::get()->warn( "Override of material reference in current mesh by material reference." ); ASSIMP_LOG_WARN( "Override of material reference in current mesh by material reference." );
} }
m_currentMesh->mMaterialIndex = matIdx; m_currentMesh->mMaterialIndex = matIdx;
} else { } else {
DefaultLogger::get()->warn( "Cannot resolve material reference, because no current mesh is there." ); ASSIMP_LOG_WARN( "Cannot resolve material reference, because no current mesh is there." );
} }
} }
} }

View File

@ -242,7 +242,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Execute the post-processing step on the given scene // Execute the post-processing step on the given scene
void OptimizeGraphProcess::Execute( aiScene* pScene) { void OptimizeGraphProcess::Execute( aiScene* pScene) {
DefaultLogger::get()->debug("OptimizeGraphProcess begin"); ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
nodes_in = nodes_out = count_merged = 0; nodes_in = nodes_out = count_merged = 0;
mScene = pScene; mScene = pScene;
@ -329,12 +329,10 @@ void OptimizeGraphProcess::Execute( aiScene* pScene) {
pScene->mRootNode->mParent = NULL; pScene->mRootNode->mParent = NULL;
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
if ( nodes_in != nodes_out) { if ( nodes_in != nodes_out) {
ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
char buf[512]; } else {
::ai_snprintf(buf,512,"OptimizeGraphProcess finished; Input nodes: %u, Output nodes: %u",nodes_in,nodes_out); ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
DefaultLogger::get()->info(buf);
} }
else DefaultLogger::get()->debug("OptimizeGraphProcess finished");
} }
meshes.clear(); meshes.clear();
locked.clear(); locked.clear();

View File

@ -107,11 +107,11 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
{ {
const unsigned int num_old = pScene->mNumMeshes; const unsigned int num_old = pScene->mNumMeshes;
if (num_old <= 1) { if (num_old <= 1) {
DefaultLogger::get()->debug("Skipping OptimizeMeshesProcess"); ASSIMP_LOG_DEBUG("Skipping OptimizeMeshesProcess");
return; return;
} }
DefaultLogger::get()->debug("OptimizeMeshesProcess begin"); ASSIMP_LOG_DEBUG("OptimizeMeshesProcess begin");
mScene = pScene; mScene = pScene;
// need to clear persistent members from previous runs // need to clear persistent members from previous runs
@ -151,11 +151,9 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
std::copy(output.begin(),output.end(),mScene->mMeshes); std::copy(output.begin(),output.end(),mScene->mMeshes);
if (output.size() != num_old) { if (output.size() != num_old) {
char tmp[512]; ASSIMP_LOG_DEBUG_F("OptimizeMeshesProcess finished. Input meshes: ", num_old, ", Output meshes: ", pScene->mNumMeshes);
::ai_snprintf(tmp,512,"OptimizeMeshesProcess finished. Input meshes: %u, Output meshes: %u",num_old,pScene->mNumMeshes);
DefaultLogger::get()->info(tmp);
} else { } else {
DefaultLogger::get()->debug( "OptimizeMeshesProcess finished" ); ASSIMP_LOG_DEBUG( "OptimizeMeshesProcess finished" );
} }
} }

View File

@ -97,7 +97,7 @@ PLY::EDataType PLY::Property::ParseDataType(std::vector<char> &buffer) {
} }
if (PLY::EDT_INVALID == eOut) if (PLY::EDT_INVALID == eOut)
{ {
DefaultLogger::get()->info("Found unknown data type in PLY file. This is OK"); ASSIMP_LOG_INFO("Found unknown data type in PLY file. This is OK");
} }
return eOut; return eOut;
@ -229,7 +229,7 @@ PLY::ESemantic PLY::Property::ParseSemantic(std::vector<char> &buffer) {
eOut = PLY::EST_ZNormal; eOut = PLY::EST_ZNormal;
} }
else { else {
DefaultLogger::get()->info("Found unknown property semantic in file. This is ok"); ASSIMP_LOG_INFO("Found unknown property semantic in file. This is ok");
PLY::DOM::SkipLine(buffer); PLY::DOM::SkipLine(buffer);
} }
return eOut; return eOut;
@ -295,7 +295,7 @@ bool PLY::Property::ParseProperty(std::vector<char> &buffer, PLY::Property* pOut
if (PLY::EST_INVALID == pOut->Semantic) if (PLY::EST_INVALID == pOut->Semantic)
{ {
DefaultLogger::get()->info("Found unknown semantic in PLY file. This is OK"); ASSIMP_LOG_INFO("Found unknown semantic in PLY file. This is OK");
std::string(&buffer[0], &buffer[0] + strlen(&buffer[0])); std::string(&buffer[0], &buffer[0] + strlen(&buffer[0]));
} }
@ -514,7 +514,7 @@ bool PLY::DOM::SkipComments(std::vector<char> &buffer)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, bool isBinary) { bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, bool isBinary) {
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() begin");
// parse all elements // parse all elements
while (!buffer.empty()) while (!buffer.empty())
@ -543,14 +543,14 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
if (!isBinary) // it would occur an error, if binary data start with values as space or line end. if (!isBinary) // it would occur an error, if binary data start with values as space or line end.
SkipSpacesAndLineEnd(buffer); SkipSpacesAndLineEnd(buffer);
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() succeeded");
return true; return true;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, PLYImporter* loader) bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, PLYImporter* loader)
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceLists() begin");
alElementData.resize(alElements.size()); alElementData.resize(alElements.size());
std::vector<PLY::Element>::const_iterator i = alElements.begin(); std::vector<PLY::Element>::const_iterator i = alElements.begin();
@ -571,7 +571,7 @@ bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std
} }
} }
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() succeeded"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceLists() succeeded");
return true; return true;
} }
@ -582,7 +582,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary(IOStreamBuffer<char> &streamBuffe
PLYImporter* loader, PLYImporter* loader,
bool p_bBE) bool p_bBE)
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceListsBinary() begin");
alElementData.resize(alElements.size()); alElementData.resize(alElements.size());
std::vector<PLY::Element>::const_iterator i = alElements.begin(); std::vector<PLY::Element>::const_iterator i = alElements.begin();
@ -602,7 +602,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary(IOStreamBuffer<char> &streamBuffe
} }
} }
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() succeeded"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceListsBinary() succeeded");
return true; return true;
} }
@ -615,11 +615,11 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
std::vector<char> buffer; std::vector<char> buffer;
streamBuffer.getNextLine(buffer); streamBuffer.getNextLine(buffer);
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() begin");
if (!p_pcOut->ParseHeader(streamBuffer, buffer, true)) if (!p_pcOut->ParseHeader(streamBuffer, buffer, true))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() failure");
return false; return false;
} }
@ -628,10 +628,10 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
const char* pCur = (char*)&buffer[0]; const char* pCur = (char*)&buffer[0];
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE)) if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() failure");
return false; return false;
} }
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() succeeded"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() succeeded");
return true; return true;
} }
@ -644,11 +644,11 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
std::vector<char> buffer; std::vector<char> buffer;
streamBuffer.getNextLine(buffer); streamBuffer.getNextLine(buffer);
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() begin");
if (!p_pcOut->ParseHeader(streamBuffer, buffer, false)) if (!p_pcOut->ParseHeader(streamBuffer, buffer, false))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
return false; return false;
} }
@ -656,10 +656,10 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
streamBuffer.getNextLine(buffer); streamBuffer.getNextLine(buffer);
if (!p_pcOut->ParseElementInstanceLists(streamBuffer, buffer, loader)) if (!p_pcOut->ParseElementInstanceLists(streamBuffer, buffer, loader))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
return false; return false;
} }
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() succeeded"); ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() succeeded");
return true; return true;
} }

View File

@ -391,7 +391,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in
} }
if (node->mMeshes[i] < numIn) { if (node->mMeshes[i] < numIn) {
// Worst case. Need to operate on a full copy of the mesh // Worst case. Need to operate on a full copy of the mesh
DefaultLogger::get()->info("PretransformVertices: Copying mesh due to mismatching transforms"); ASSIMP_LOG_INFO("PretransformVertices: Copying mesh due to mismatching transforms");
aiMesh* ntz; aiMesh* ntz;
const unsigned int tmp = mesh->mNumBones; // const unsigned int tmp = mesh->mNumBones; //
@ -441,7 +441,7 @@ void PretransformVertices::BuildMeshRefCountArray(aiNode* nd, unsigned int * ref
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void PretransformVertices::Execute( aiScene* pScene) void PretransformVertices::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("PretransformVerticesProcess begin"); ASSIMP_LOG_DEBUG("PretransformVerticesProcess begin");
// Return immediately if we have no meshes // Return immediately if we have no meshes
if (!pScene->mNumMeshes) if (!pScene->mNumMeshes)
@ -713,22 +713,12 @@ void PretransformVertices::Execute( aiScene* pScene)
} }
// print statistics // print statistics
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger()) {
{ ASSIMP_LOG_DEBUG("PretransformVerticesProcess finished");
char buffer[4096];
DefaultLogger::get()->debug("PretransformVerticesProcess finished"); ASSIMP_LOG_INFO_F("Removed ", iOldNodes, " nodes and ", iOldAnimationChannels, " animation channels (",
CountNodes(pScene->mRootNode) ," output nodes)" );
::ai_snprintf(buffer,4096,"Removed %u nodes and %u animation channels (%u output nodes)", ASSIMP_LOG_INFO_F("Kept ", pScene->mNumLights, " lights and ", pScene->mNumCameras, " cameras." );
iOldNodes,iOldAnimationChannels,CountNodes(pScene->mRootNode)); ASSIMP_LOG_INFO_F("Moved ", iOldMeshes, " meshes to WCS (number of output meshes: ", pScene->mNumMeshes, ")");
DefaultLogger::get()->info(buffer);
ai_snprintf(buffer, 4096,"Kept %u lights and %u cameras",
pScene->mNumLights,pScene->mNumCameras);
DefaultLogger::get()->info(buffer);
ai_snprintf(buffer, 4096,"Moved %u meshes to WCS (number of output meshes: %u)",
iOldMeshes,pScene->mNumMeshes);
DefaultLogger::get()->info(buffer);
} }
} }

View File

@ -62,7 +62,7 @@ void ConvertListToStrings(const std::string& in, std::list<std::string>& out)
while (*s != '\'') { while (*s != '\'') {
++s; ++s;
if (*s == '\0') { if (*s == '\0') {
DefaultLogger::get()->error("ConvertListToString: String list is ill-formatted"); ASSIMP_LOG_ERROR("ConvertListToString: String list is ill-formatted");
return; return;
} }
} }

View File

@ -348,7 +348,7 @@ class ComputeSpatialSortProcess : public BaseProcess
void Execute( aiScene* pScene) void Execute( aiScene* pScene)
{ {
typedef std::pair<SpatialSort, ai_real> _Type; typedef std::pair<SpatialSort, ai_real> _Type;
DefaultLogger::get()->debug("Generate spatially-sorted vertex cache"); ASSIMP_LOG_DEBUG("Generate spatially-sorted vertex cache");
std::vector<_Type>* p = new std::vector<_Type>(pScene->mNumMeshes); std::vector<_Type>* p = new std::vector<_Type>(pScene->mNumMeshes);
std::vector<_Type>::iterator it = p->begin(); std::vector<_Type>::iterator it = p->begin();

View File

@ -125,7 +125,7 @@ void Q3DImporter::InternReadFile( const std::string& pFile,
} }
// Print the file format version // Print the file format version
DefaultLogger::get()->info("Quick3D File format version: " + ASSIMP_LOG_INFO_F("Quick3D File format version: ",
std::string(&((const char*)stream.GetPtr())[8],2)); std::string(&((const char*)stream.GetPtr())[8],2));
// ... an store it // ... an store it
@ -413,7 +413,7 @@ outer:
// If we have no materials loaded - generate a default mat // If we have no materials loaded - generate a default mat
if (materials.empty()) if (materials.empty())
{ {
DefaultLogger::get()->info("Quick3D: No material found, generating one"); ASSIMP_LOG_INFO("Quick3D: No material found, generating one");
materials.push_back(Material()); materials.push_back(Material());
materials.back().diffuse = fgColor ; materials.back().diffuse = fgColor ;
} }

View File

@ -160,7 +160,7 @@ void RAWImporter::InternReadFile( const std::string& pFile,
} }
if (num != 12 && num != 9) if (num != 12 && num != 9)
{ {
DefaultLogger::get()->error("A line may have either 9 or 12 floats and an optional texture"); ASSIMP_LOG_ERROR("A line may have either 9 or 12 floats and an optional texture");
continue; continue;
} }

View File

@ -87,7 +87,7 @@ void RemoveRedundantMatsProcess::SetupProperties(const Importer* pImp)
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void RemoveRedundantMatsProcess::Execute( aiScene* pScene) void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("RemoveRedundantMatsProcess begin"); ASSIMP_LOG_DEBUG("RemoveRedundantMatsProcess begin");
unsigned int redundantRemoved = 0, unreferencedRemoved = 0; unsigned int redundantRemoved = 0, unreferencedRemoved = 0;
if (pScene->mNumMaterials) if (pScene->mNumMaterials)
@ -122,7 +122,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
// Keep this material even if no mesh references it // Keep this material even if no mesh references it
abReferenced[i] = true; abReferenced[i] = true;
DefaultLogger::get()->debug(std::string("Found positive match in exclusion list: \'") + name.data + "\'"); ASSIMP_LOG_DEBUG_F( "Found positive match in exclusion list: \'", name.data, "\'");
} }
} }
} }
@ -211,13 +211,11 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
} }
if (redundantRemoved == 0 && unreferencedRemoved == 0) if (redundantRemoved == 0 && unreferencedRemoved == 0)
{ {
DefaultLogger::get()->debug("RemoveRedundantMatsProcess finished "); ASSIMP_LOG_DEBUG("RemoveRedundantMatsProcess finished ");
} }
else else
{ {
char szBuffer[128]; // should be sufficiently large ASSIMP_LOG_INFO_F("RemoveRedundantMatsProcess finished. Removed ", redundantRemoved, " redundant and ",
::ai_snprintf(szBuffer,128,"RemoveRedundantMatsProcess finished. Removed %u redundant and %u unused materials.", unreferencedRemoved, " unused materials.");
redundantRemoved,unreferencedRemoved);
DefaultLogger::get()->info(szBuffer);
} }
} }

View File

@ -145,7 +145,7 @@ bool UpdateNodeGraph(aiNode* node,std::list<aiNode*>& childsOfParent,bool root)
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void RemoveVCProcess::Execute( aiScene* pScene) void RemoveVCProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("RemoveVCProcess begin"); ASSIMP_LOG_DEBUG("RemoveVCProcess begin");
bool bHas = false; //,bMasked = false; bool bHas = false; //,bMasked = false;
mScene = pScene; mScene = pScene;
@ -224,15 +224,18 @@ void RemoveVCProcess::Execute( aiScene* pScene)
if (!pScene->mNumMeshes || !pScene->mNumMaterials) if (!pScene->mNumMeshes || !pScene->mNumMaterials)
{ {
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE; pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
DefaultLogger::get()->debug("Setting AI_SCENE_FLAGS_INCOMPLETE flag"); ASSIMP_LOG_DEBUG("Setting AI_SCENE_FLAGS_INCOMPLETE flag");
// If we have no meshes anymore we should also clear another flag ... // If we have no meshes anymore we should also clear another flag ...
if (!pScene->mNumMeshes) if (!pScene->mNumMeshes)
pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT; pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
} }
if (bHas)DefaultLogger::get()->info("RemoveVCProcess finished. Data structure cleanup has been done."); if (bHas) {
else DefaultLogger::get()->debug("RemoveVCProcess finished. Nothing to be done ..."); ASSIMP_LOG_INFO("RemoveVCProcess finished. Data structure cleanup has been done.");
} else {
ASSIMP_LOG_DEBUG("RemoveVCProcess finished. Nothing to be done ...");
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -150,7 +150,7 @@ static SIBChunk ReadChunk(StreamReaderLE* stream)
chunk.Tag = stream->GetU4(); chunk.Tag = stream->GetU4();
chunk.Size = stream->GetU4(); chunk.Size = stream->GetU4();
if (chunk.Size > stream->GetRemainingSizeToLimit()) if (chunk.Size > stream->GetRemainingSizeToLimit())
DefaultLogger::get()->error("SIB: Chunk overflow"); ASSIMP_LOG_ERROR("SIB: Chunk overflow");
ByteSwap::Swap4(&chunk.Tag); ByteSwap::Swap4(&chunk.Tag);
return chunk; return chunk;
} }
@ -589,7 +589,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
if (mtl >= meshes.size()) if (mtl >= meshes.size())
{ {
DefaultLogger::get()->error("SIB: Face material index is invalid."); ASSIMP_LOG_ERROR("SIB: Face material index is invalid.");
mtl = 0; mtl = 0;
} }

View File

@ -286,7 +286,7 @@ void SMDImporter::CreateOutputMeshes()
if (UINT_MAX == (*iFace).iTexture)aaiFaces[(*iFace).iTexture].push_back( 0 ); if (UINT_MAX == (*iFace).iTexture)aaiFaces[(*iFace).iTexture].push_back( 0 );
else if ((*iFace).iTexture >= aszTextures.size()) else if ((*iFace).iTexture >= aszTextures.size())
{ {
DefaultLogger::get()->error("[SMD/VTA] Material index overflow in face"); ASSIMP_LOG_INFO("[SMD/VTA] Material index overflow in face");
aaiFaces[(*iFace).iTexture].push_back((unsigned int)aszTextures.size()-1); aaiFaces[(*iFace).iTexture].push_back((unsigned int)aszTextures.size()-1);
} }
else aaiFaces[(*iFace).iTexture].push_back(iNum); else aaiFaces[(*iFace).iTexture].push_back(iNum);
@ -366,7 +366,7 @@ void SMDImporter::CreateOutputMeshes()
if (pairval.first >= asBones.size() || if (pairval.first >= asBones.size() ||
pairval.first == face.avVertices[iVert].iParentNode) pairval.first == face.avVertices[iVert].iParentNode)
{ {
DefaultLogger::get()->error("[SMD/VTA] Bone index overflow. " ASSIMP_LOG_ERROR("[SMD/VTA] Bone index overflow. "
"The bone index will be ignored, the weight will be assigned " "The bone index will be ignored, the weight will be assigned "
"to the vertex' parent node"); "to the vertex' parent node");
continue; continue;
@ -387,7 +387,7 @@ void SMDImporter::CreateOutputMeshes()
{ {
if (face.avVertices[iVert].iParentNode >= asBones.size()) if (face.avVertices[iVert].iParentNode >= asBones.size())
{ {
DefaultLogger::get()->error("[SMD/VTA] Bone index overflow. " ASSIMP_LOG_ERROR("[SMD/VTA] Bone index overflow. "
"The index of the vertex parent bone is invalid. " "The index of the vertex parent bone is invalid. "
"The remaining weights will be normalized to 1.0"); "The remaining weights will be normalized to 1.0");
@ -953,7 +953,7 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent,
unsigned int iBone = 0; unsigned int iBone = 0;
if(!ParseUnsignedInt(szCurrent,&szCurrent,iBone)) if(!ParseUnsignedInt(szCurrent,&szCurrent,iBone))
{ {
DefaultLogger::get()->error("Unexpected EOF/EOL while parsing bone index"); ASSIMP_LOG_ERROR("Unexpected EOF/EOL while parsing bone index");
SMDI_PARSE_RETURN; SMDI_PARSE_RETURN;
} }
if (iBone >= asBones.size()) if (iBone >= asBones.size())

View File

@ -776,10 +776,10 @@ namespace STEP {
// XXX is this really how the EXPRESS notation ([?:3],[1:3]) is intended? // XXX is this really how the EXPRESS notation ([?:3],[1:3]) is intended?
if (max_cnt && inp->GetSize() > max_cnt) { if (max_cnt && inp->GetSize() > max_cnt) {
DefaultLogger::get()->warn("too many aggregate elements"); ASSIMP_LOG_WARN("too many aggregate elements");
} }
else if (inp->GetSize() < min_cnt) { else if (inp->GetSize() < min_cnt) {
DefaultLogger::get()->warn("too few aggregate elements"); ASSIMP_LOG_WARN("too few aggregate elements");
} }
out.reserve(inp->GetSize()); out.reserve(inp->GetSize());

View File

@ -286,14 +286,14 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
if(!SkipSpacesAndLineEnd(&sz)) if(!SkipSpacesAndLineEnd(&sz))
{ {
// seems we're finished although there was no end marker // seems we're finished although there was no end marker
DefaultLogger::get()->warn("STL: unexpected EOF. \'endsolid\' keyword was expected"); ASSIMP_LOG_WARN("STL: unexpected EOF. \'endsolid\' keyword was expected");
break; break;
} }
// facet normal -0.13 -0.13 -0.98 // facet normal -0.13 -0.13 -0.98
if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0') { if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0') {
if (faceVertexCounter != 3) { if (faceVertexCounter != 3) {
DefaultLogger::get()->warn("STL: A new facet begins but the old is not yet complete"); ASSIMP_LOG_WARN("STL: A new facet begins but the old is not yet complete");
} }
faceVertexCounter = 0; faceVertexCounter = 0;
normalBuffer.push_back(aiVector3D()); normalBuffer.push_back(aiVector3D());
@ -302,7 +302,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
sz += 6; sz += 6;
SkipSpaces(&sz); SkipSpaces(&sz);
if (strncmp(sz,"normal",6)) { if (strncmp(sz,"normal",6)) {
DefaultLogger::get()->warn("STL: a facet normal vector was expected but not found"); ASSIMP_LOG_WARN("STL: a facet normal vector was expected but not found");
} else { } else {
if (sz[6] == '\0') { if (sz[6] == '\0') {
throw DeadlyImportError("STL: unexpected EOF while parsing facet"); throw DeadlyImportError("STL: unexpected EOF while parsing facet");
@ -319,7 +319,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
} }
} else if (!strncmp(sz,"vertex",6) && ::IsSpaceOrNewLine(*(sz+6))) { // vertex 1.50000 1.50000 0.00000 } else if (!strncmp(sz,"vertex",6) && ::IsSpaceOrNewLine(*(sz+6))) { // vertex 1.50000 1.50000 0.00000
if (faceVertexCounter >= 3) { if (faceVertexCounter >= 3) {
DefaultLogger::get()->error("STL: a facet with more than 3 vertices has been found"); ASSIMP_LOG_ERROR("STL: a facet with more than 3 vertices has been found");
++sz; ++sz;
} else { } else {
if (sz[6] == '\0') { if (sz[6] == '\0') {
@ -418,7 +418,7 @@ bool STLImporter::LoadBinaryFile()
// read the default vertex color for facets // read the default vertex color for facets
bIsMaterialise = true; bIsMaterialise = true;
DefaultLogger::get()->info("STL: Taking code path for Materialise files"); ASSIMP_LOG_INFO("STL: Taking code path for Materialise files");
const ai_real invByte = (ai_real)1.0 / ( ai_real )255.0; const ai_real invByte = (ai_real)1.0 / ( ai_real )255.0;
clrColorDefault.r = (*sz2++) * invByte; clrColorDefault.r = (*sz2++) * invByte;
clrColorDefault.g = (*sz2++) * invByte; clrColorDefault.g = (*sz2++) * invByte;
@ -500,7 +500,7 @@ bool STLImporter::LoadBinaryFile()
*pMesh->mColors[0]++ = this->clrColorDefault; *pMesh->mColors[0]++ = this->clrColorDefault;
pMesh->mColors[0] -= pMesh->mNumVertices; pMesh->mColors[0] -= pMesh->mNumVertices;
DefaultLogger::get()->info("STL: Mesh has vertex colors"); ASSIMP_LOG_INFO("STL: Mesh has vertex colors");
} }
aiColor4D* clr = &pMesh->mColors[0][i*3]; aiColor4D* clr = &pMesh->mColors[0][i*3];
clr->a = 1.0; clr->a = 1.0;

View File

@ -137,11 +137,11 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
{ {
if (!pScene->mNumMeshes) if (!pScene->mNumMeshes)
{ {
DefaultLogger::get()->debug("SortByPTypeProcess skipped, there are no meshes"); ASSIMP_LOG_DEBUG("SortByPTypeProcess skipped, there are no meshes");
return; return;
} }
DefaultLogger::get()->debug("SortByPTypeProcess begin"); ASSIMP_LOG_DEBUG("SortByPTypeProcess begin");
unsigned int aiNumMeshesPerPType[4] = {0,0,0,0}; unsigned int aiNumMeshesPerPType[4] = {0,0,0,0};
@ -404,8 +404,8 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
aiNumMeshesPerPType[1], ((configRemoveMeshes & aiPrimitiveType_LINE) ? "X" : ""), aiNumMeshesPerPType[1], ((configRemoveMeshes & aiPrimitiveType_LINE) ? "X" : ""),
aiNumMeshesPerPType[2], ((configRemoveMeshes & aiPrimitiveType_TRIANGLE) ? "X" : ""), aiNumMeshesPerPType[2], ((configRemoveMeshes & aiPrimitiveType_TRIANGLE) ? "X" : ""),
aiNumMeshesPerPType[3], ((configRemoveMeshes & aiPrimitiveType_POLYGON) ? "X" : "")); aiNumMeshesPerPType[3], ((configRemoveMeshes & aiPrimitiveType_POLYGON) ? "X" : ""));
DefaultLogger::get()->info(buffer); ASSIMP_LOG_INFO(buffer);
DefaultLogger::get()->debug("SortByPTypeProcess finished"); ASSIMP_LOG_DEBUG("SortByPTypeProcess finished");
} }
} }

View File

@ -78,7 +78,7 @@ void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
{ {
if (0xffffffff == this->LIMIT)return; if (0xffffffff == this->LIMIT)return;
DefaultLogger::get()->debug("SplitLargeMeshesProcess_Triangle begin"); ASSIMP_LOG_DEBUG("SplitLargeMeshesProcess_Triangle begin");
std::vector<std::pair<aiMesh*, unsigned int> > avList; std::vector<std::pair<aiMesh*, unsigned int> > avList;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
@ -96,10 +96,11 @@ void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
// now we need to update all nodes // now we need to update all nodes
this->UpdateNode(pScene->mRootNode,avList); this->UpdateNode(pScene->mRootNode,avList);
DefaultLogger::get()->info("SplitLargeMeshesProcess_Triangle finished. Meshes have been split"); ASSIMP_LOG_INFO("SplitLargeMeshesProcess_Triangle finished. Meshes have been split");
}
else {
ASSIMP_LOG_DEBUG("SplitLargeMeshesProcess_Triangle finished. There was nothing to do");
} }
else DefaultLogger::get()->debug("SplitLargeMeshesProcess_Triangle finished. There was nothing to do");
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -154,7 +155,7 @@ void SplitLargeMeshesProcess_Triangle::SplitMesh(
{ {
if (pMesh->mNumFaces > SplitLargeMeshesProcess_Triangle::LIMIT) if (pMesh->mNumFaces > SplitLargeMeshesProcess_Triangle::LIMIT)
{ {
DefaultLogger::get()->info("Mesh exceeds the triangle limit. It will be split ..."); ASSIMP_LOG_INFO("Mesh exceeds the triangle limit. It will be split ...");
// we need to split this mesh into sub meshes // we need to split this mesh into sub meshes
// determine the size of a submesh // determine the size of a submesh
@ -378,7 +379,7 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
if (0xffffffff == this->LIMIT)return; if (0xffffffff == this->LIMIT)return;
DefaultLogger::get()->debug("SplitLargeMeshesProcess_Vertex begin"); ASSIMP_LOG_DEBUG("SplitLargeMeshesProcess_Vertex begin");
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
this->SplitMesh(a, pScene->mMeshes[a],avList); this->SplitMesh(a, pScene->mMeshes[a],avList);
@ -394,10 +395,10 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
// now we need to update all nodes // now we need to update all nodes
SplitLargeMeshesProcess_Triangle::UpdateNode(pScene->mRootNode,avList); SplitLargeMeshesProcess_Triangle::UpdateNode(pScene->mRootNode,avList);
DefaultLogger::get()->info("SplitLargeMeshesProcess_Vertex finished. Meshes have been split"); ASSIMP_LOG_INFO("SplitLargeMeshesProcess_Vertex finished. Meshes have been split");
} else {
ASSIMP_LOG_DEBUG("SplitLargeMeshesProcess_Vertex finished. There was nothing to do");
} }
else DefaultLogger::get()->debug("SplitLargeMeshesProcess_Vertex finished. There was nothing to do");
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -342,11 +342,8 @@ void CatmullClarkSubdivider::InternSubdivide (
// Report the number of bad edges. bad edges are referenced by less than two // Report the number of bad edges. bad edges are referenced by less than two
// faces in the mesh. They occur at outer model boundaries in non-closed // faces in the mesh. They occur at outer model boundaries in non-closed
// shapes. // shapes.
char tmp[512]; ASSIMP_LOG_DEBUG_F("Catmull-Clark Subdivider: got ", bad_cnt, " bad edges touching only one face (totally ",
ai_snprintf(tmp, 512, "Catmull-Clark Subdivider: got %u bad edges touching only one face (totally %u edges). ", static_cast<unsigned int>(edges.size()), " edges). ");
bad_cnt,static_cast<unsigned int>(edges.size()));
DASSIMP_LOG_DEBUG(tmp);
}} }}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------

View File

@ -192,7 +192,7 @@ void TerragenImporter::InternReadFile( const std::string& pFile,
{ {
mode = reader.GetI1(); mode = reader.GetI1();
if (0 != mode) if (0 != mode)
DefaultLogger::get()->error("TER: Unsupported mapping mode, a flat terrain is returned"); ASSIMP_LOG_ERROR("TER: Unsupported mapping mode, a flat terrain is returned");
} }
// actual terrain data // actual terrain data
else if (!::strncmp(head,AI_TERR_CHUNK_ALTW,4)) else if (!::strncmp(head,AI_TERR_CHUNK_ALTW,4))

View File

@ -105,12 +105,10 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
if (info.mRotation) if (info.mRotation)
{ {
float out = info.mRotation; float out = info.mRotation;
if ((rounded = (int)(info.mRotation / (float)AI_MATH_TWO_PI))) if ((rounded = static_cast<int>((info.mRotation / static_cast<float>(AI_MATH_TWO_PI)))))
{ {
out -= rounded*(float)AI_MATH_PI; out -= rounded * static_cast<float>(AI_MATH_PI);
ASSIMP_LOG_INFO_F("Texture coordinate rotation ", info.mRotation, " can be simplified to ", out);
ai_snprintf(szTemp, 512, "Texture coordinate rotation %f can be simplified to %f",info.mRotation,out);
DefaultLogger::get()->info(szTemp);
} }
// Next step - convert negative rotation angles to positives // Next step - convert negative rotation angles to positives
@ -150,7 +148,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
out = 1.f; out = 1.f;
} }
if (szTemp[0]) { if (szTemp[0]) {
DefaultLogger::get()->info(szTemp); ASSIMP_LOG_INFO(szTemp);
info.mTranslation.x = out; info.mTranslation.x = out;
} }
} }
@ -183,7 +181,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
out = 1.f; out = 1.f;
} }
if (szTemp[0]) { if (szTemp[0]) {
DefaultLogger::get()->info(szTemp); ASSIMP_LOG_INFO(szTemp);
info.mTranslation.y = out; info.mTranslation.y = out;
} }
} }
@ -221,7 +219,7 @@ inline const char* MappingModeToChar(aiTextureMapMode map)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void TextureTransformStep::Execute( aiScene* pScene) void TextureTransformStep::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("TransformUVCoordsProcess begin"); ASSIMP_LOG_DEBUG("TransformUVCoordsProcess begin");
/* We build a per-mesh list of texture transformations we'll need /* We build a per-mesh list of texture transformations we'll need
@ -416,7 +414,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
++it2; ++it2;
if ((*it2).lockedPos != AI_TT_UV_IDX_LOCK_NONE) { if ((*it2).lockedPos != AI_TT_UV_IDX_LOCK_NONE) {
DefaultLogger::get()->error("Channel mismatch, can't compute all transformations properly [design bug]"); ASSIMP_LOG_ERROR("Channel mismatch, can't compute all transformations properly [design bug]");
continue; continue;
} }
@ -449,10 +447,8 @@ void TextureTransformStep::Execute( aiScene* pScene)
if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) { if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) {
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
::ai_snprintf(buffer,1024,"%u UV channels required but just %u available", ASSIMP_LOG_ERROR_F(static_cast<unsigned int>(trafo.size()), " UV channels required but just ",
static_cast<unsigned int>(trafo.size()),AI_MAX_NUMBER_OF_TEXTURECOORDS); AI_MAX_NUMBER_OF_TEXTURECOORDS, " available");
DefaultLogger::get()->error(buffer);
} }
size = AI_MAX_NUMBER_OF_TEXTURECOORDS; size = AI_MAX_NUMBER_OF_TEXTURECOORDS;
} }
@ -487,7 +483,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
MappingModeToChar ((*it).mapU), MappingModeToChar ((*it).mapU),
MappingModeToChar ((*it).mapV)); MappingModeToChar ((*it).mapV));
DefaultLogger::get()->info(buffer); ASSIMP_LOG_INFO(buffer);
} }
// Check whether we need a new buffer here // Check whether we need a new buffer here
@ -560,12 +556,10 @@ void TextureTransformStep::Execute( aiScene* pScene)
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
if (transformedChannels) { if (transformedChannels) {
::ai_snprintf(buffer,1024,"TransformUVCoordsProcess end: %u output channels (in: %u, modified: %u)", ASSIMP_LOG_INFO_F("TransformUVCoordsProcess end: ", outChannels, " output channels (in: ", inChannels, ", modified: ", transformedChannels,")");
outChannels,inChannels,transformedChannels); } else {
ASSIMP_LOG_DEBUG("TransformUVCoordsProcess finished");
DefaultLogger::get()->info(buffer);
} }
else DefaultLogger::get()->debug("TransformUVCoordsProcess finished");
} }
} }

View File

@ -100,7 +100,7 @@ bool TriangulateProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void TriangulateProcess::Execute( aiScene* pScene) void TriangulateProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("TriangulateProcess begin"); ASSIMP_LOG_DEBUG("TriangulateProcess begin");
bool bHas = false; bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
@ -110,13 +110,12 @@ void TriangulateProcess::Execute( aiScene* pScene)
} }
} }
if ( bHas ) { if ( bHas ) {
DefaultLogger::get()->info( "TriangulateProcess finished. All polygons have been triangulated." ); ASSIMP_LOG_INFO( "TriangulateProcess finished. All polygons have been triangulated." );
} else { } else {
DefaultLogger::get()->debug( "TriangulateProcess finished. There was nothing to be done." ); ASSIMP_LOG_DEBUG( "TriangulateProcess finished. There was nothing to be done." );
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Triangulates the given mesh. // Triangulates the given mesh.
bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh) bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
@ -410,7 +409,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
// Instead we're continuing with the standard tri-fanning algorithm which we'd // Instead we're continuing with the standard tri-fanning algorithm which we'd
// use if we had only convex polygons. That's life. // use if we had only convex polygons. That's life.
DefaultLogger::get()->error("Failed to triangulate polygon (no ear found). Probably not a simple polygon?"); ASSIMP_LOG_ERROR("Failed to triangulate polygon (no ear found). Probably not a simple polygon?");
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS #ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
fprintf(fout,"critical error here, no ear found! "); fprintf(fout,"critical error here, no ear found! ");
@ -488,7 +487,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
// drop dumb 0-area triangles // drop dumb 0-area triangles
if (std::fabs(GetArea2D(temp_verts[i[0]],temp_verts[i[1]],temp_verts[i[2]])) < 1e-5f) { if (std::fabs(GetArea2D(temp_verts[i[0]],temp_verts[i[1]],temp_verts[i[2]])) < 1e-5f) {
DefaultLogger::get()->debug("Dropping triangle with area 0"); ASSIMP_LOG_DEBUG("Dropping triangle with area 0");
--curOut; --curOut;
delete[] f->mIndices; delete[] f->mIndices;

View File

@ -206,7 +206,7 @@ inline void ValidateDSProcess::DoValidationWithNameCheck(T** array,
void ValidateDSProcess::Execute( aiScene* pScene) void ValidateDSProcess::Execute( aiScene* pScene)
{ {
this->mScene = pScene; this->mScene = pScene;
DefaultLogger::get()->debug("ValidateDataStructureProcess begin"); ASSIMP_LOG_DEBUG("ValidateDataStructureProcess begin");
// validate the node graph of the scene // validate the node graph of the scene
Validate(pScene->mRootNode); Validate(pScene->mRootNode);
@ -273,7 +273,7 @@ void ValidateDSProcess::Execute( aiScene* pScene)
} }
// if (!has)ReportError("The aiScene data structure is empty"); // if (!has)ReportError("The aiScene data structure is empty");
DefaultLogger::get()->debug("ValidateDataStructureProcess end"); ASSIMP_LOG_DEBUG("ValidateDataStructureProcess end");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -587,7 +587,7 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, std::vector<XFile::Materi
} }
if( oldMat.sceneIndex == SIZE_MAX ) { if( oldMat.sceneIndex == SIZE_MAX ) {
DefaultLogger::get()->warn( format() << "Could not resolve global material reference \"" << oldMat.mName << "\"" ); ASSIMP_LOG_WARN_F( "Could not resolve global material reference \"", oldMat.mName, "\"" );
oldMat.sceneIndex = 0; oldMat.sceneIndex = 0;
} }

View File

@ -255,7 +255,7 @@ XFileParser::XFileParser( const std::vector<char>& pBuffer)
// FIXME: we don't need the compressed data anymore, could release // FIXME: we don't need the compressed data anymore, could release
// it already for better memory usage. Consider breaking const-co. // it already for better memory usage. Consider breaking const-co.
DefaultLogger::get()->info("Successfully decompressed MSZIP-compressed file"); ASSIMP_LOG_INFO("Successfully decompressed MSZIP-compressed file");
#endif // !! ASSIMP_BUILD_NO_COMPRESSED_X #endif // !! ASSIMP_BUILD_NO_COMPRESSED_X
} }
else else
@ -322,11 +322,11 @@ void XFileParser::ParseFile()
if( objectName == "}") if( objectName == "}")
{ {
// whatever? // whatever?
DefaultLogger::get()->warn("} found in dataObject"); ASSIMP_LOG_WARN("} found in dataObject");
} else } else
{ {
// unknown format // unknown format
DefaultLogger::get()->warn("Unknown data object in animation of .x file"); ASSIMP_LOG_WARN("Unknown data object in animation of .x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -422,7 +422,7 @@ void XFileParser::ParseDataObjectFrame( Node* pParent)
ParseDataObjectMesh( mesh); ParseDataObjectMesh( mesh);
} else } else
{ {
DefaultLogger::get()->warn("Unknown data object in frame in x file"); ASSIMP_LOG_WARN("Unknown data object in frame in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -509,7 +509,7 @@ void XFileParser::ParseDataObjectMesh( Mesh* pMesh)
ParseDataObjectSkinWeights( pMesh); ParseDataObjectSkinWeights( pMesh);
else else
{ {
DefaultLogger::get()->warn("Unknown data object in mesh in x file"); ASSIMP_LOG_WARN("Unknown data object in mesh in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -719,7 +719,7 @@ void XFileParser::ParseDataObjectMeshMaterialList( Mesh* pMesh)
// ignore // ignore
} else } else
{ {
DefaultLogger::get()->warn("Unknown data object in material list in x file"); ASSIMP_LOG_WARN("Unknown data object in material list in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -767,7 +767,7 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial)
pMaterial->mTextures.push_back( TexEntry( texname, true)); pMaterial->mTextures.push_back( TexEntry( texname, true));
} else } else
{ {
DefaultLogger::get()->warn("Unknown data object in material in x file"); ASSIMP_LOG_WARN("Unknown data object in material in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -805,7 +805,7 @@ void XFileParser::ParseDataObjectAnimationSet()
ParseDataObjectAnimation( anim); ParseDataObjectAnimation( anim);
else else
{ {
DefaultLogger::get()->warn("Unknown data object in animation set in x file"); ASSIMP_LOG_WARN("Unknown data object in animation set in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -842,7 +842,7 @@ void XFileParser::ParseDataObjectAnimation( Animation* pAnim)
CheckForClosingBrace(); CheckForClosingBrace();
} else } else
{ {
DefaultLogger::get()->warn("Unknown data object in animation in x file"); ASSIMP_LOG_WARN("Unknown data object in animation in x file");
ParseUnknownDataObject(); ParseUnknownDataObject();
} }
} }
@ -950,7 +950,7 @@ void XFileParser::ParseDataObjectTextureFilename( std::string& pName)
// FIX: some files (e.g. AnimationTest.x) have "" as texture file name // FIX: some files (e.g. AnimationTest.x) have "" as texture file name
if (!pName.length()) if (!pName.length())
{ {
DefaultLogger::get()->warn("Length of texture file name is zero. Skipping this texture."); ASSIMP_LOG_WARN("Length of texture file name is zero. Skipping this texture.");
} }
// some exporters write double backslash paths out. We simply replace them if we find them // some exporters write double backslash paths out. We simply replace them if we find them

View File

@ -64,28 +64,28 @@ public:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LogWarn(const Formatter::format& message) { static void LogWarn(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->warn(Prefix()+(std::string)message); ASSIMP_LOG_WARN(Prefix()+(std::string)message);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LogError(const Formatter::format& message) { static void LogError(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->error(Prefix()+(std::string)message); ASSIMP_LOG_ERROR(Prefix()+(std::string)message);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LogInfo(const Formatter::format& message) { static void LogInfo(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->info(Prefix()+(std::string)message); ASSIMP_LOG_INFO(Prefix()+(std::string)message);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LogDebug(const Formatter::format& message) { static void LogDebug(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->debug(Prefix()+(std::string)message); ASSIMP_LOG_DEBUG(Prefix()+(std::string)message);
} }
} }
@ -126,6 +126,6 @@ private:
static const char* Prefix(); static const char* Prefix();
}; };
} // ! Assimp } // ! Assimp
#endif #endif