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() {
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");
ai_assert(false);

View File

@ -210,7 +210,7 @@ void DNAParser::Parse ()
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
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
// or if the target type is not contained in `our` DNA.
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;
}

View File

@ -86,7 +86,7 @@ public:
const Scene& /*in*/,
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;
}
};

View File

@ -487,46 +487,6 @@ void COBImporter::UnsupportedChunk_Ascii(LineSplitter& splitter, const ChunkInfo
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*/)
{
@ -576,8 +536,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter;
if (!splitter.match_start("mat# ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `mat#` line in `Mat1` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id );
return;
}
@ -589,8 +548,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter;
if (!splitter.match_start("shader: ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `mat#` line in `Mat1` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id);
return;
}
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;
}
else if (shader != "flat") {
LogWarn_Ascii(splitter,format()<<
"Unknown value for `shader` in `Mat1` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Unknown value for `shader` in `Mat1` chunk ", nfo.id );
}
++splitter;
if (!splitter.match_start("rgb ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `rgb` line in `Mat1` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `rgb` line in `Mat1` chunk ", nfo.id);
}
const char* rgb = splitter[1];
@ -618,8 +574,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk
++splitter;
if (!splitter.match_start("alpha ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `alpha` line in `Mat1` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `alpha` line in `Mat1` chunk ", nfo.id);
}
const char* tokens[10];
@ -640,8 +595,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
}
++splitter;
if (!splitter.match_start("Units ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `Units` line in `Unit` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `Units` line in `Unit` chunk ", nfo.id);
return;
}
@ -652,13 +606,12 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
const unsigned int t=strtoul10(splitter[1]);
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];
return;
}
}
LogWarn_Ascii(splitter,format()<<"`Unit` chunk "<<nfo.id<<" is a child of "
<<nfo.parent_id<<" which does not exist");
ASSIMP_LOG_WARN_F( "`Unit` chunk ", nfo.id, " is a child of ", 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;
}
else {
LogWarn_Ascii(splitter,format()<<
"Unknown kind of light source in `Lght` chunk "<<nfo.id<<" : "<<*splitter);
ASSIMP_LOG_WARN_F( "Unknown kind of light source in `Lght` chunk ", nfo.id, " : ", *splitter );
msh.ltype = Light::SPOT;
}
++splitter;
if (!splitter.match_start("color ")) {
LogWarn_Ascii(splitter,format()<<
"Expected `color` line in `Lght` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `color` line in `Lght` chunk ", nfo.id );
}
const char* rgb = splitter[1];
@ -708,16 +659,14 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
SkipSpaces(&rgb);
if (strncmp(rgb,"cone angle",10)) {
LogWarn_Ascii(splitter,format()<<
"Expected `cone angle` entity in `color` line in `Lght` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `cone angle` entity in `color` line in `Lght` chunk ", nfo.id );
}
SkipSpaces(rgb+10,&rgb);
msh.angle = fast_atof(&rgb);
SkipSpaces(&rgb);
if (strncmp(rgb,"inner angle",11)) {
LogWarn_Ascii(splitter,format()<<
"Expected `inner angle` entity in `color` line in `Lght` chunk "<<nfo.id);
ASSIMP_LOG_WARN_F( "Expected `inner angle` entity in `color` line in `Lght` chunk ", nfo.id);
}
SkipSpaces(rgb+11,&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) {
if (splitter.match_start("Hole")) {
LogWarn_Ascii(splitter,"Skipping unsupported `Hole` line");
ASSIMP_LOG_WARN_F( "Skipping unsupported `Hole` line" );
continue;
}
@ -888,7 +837,7 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
const unsigned int head = strtoul10((++splitter)[1]);
if (head != sizeof(Bitmap::BitmapHeader)) {
LogWarn_Ascii(splitter,"Unexpected ThumbNailHdrSize, skipping this chunk");
ASSIMP_LOG_WARN_F("Unexpected ThumbNailHdrSize, skipping this chunk");
return;
}
@ -1142,7 +1091,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene& out, StreamReaderLE& reader, const
mat.type = Material::METAL;
break;
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;
}
@ -1157,7 +1106,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene& out, StreamReaderLE& reader, const
mat.autofacet = Material::SMOOTH;
break;
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_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) {
const unsigned int t=reader.GetI2();
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];
return;
}
}
LogWarn_Ascii(format()<<"`Unit` chunk "<<nfo.id<<" is a child of "
<<nfo.parent_id<<" which does not exist");
ASSIMP_LOG_WARN_F( "`Unit` chunk ", nfo.id, " is a child of ", nfo.parent_id, " which does not exist");
}
#endif
#endif // ASSIMP_BUILD_NO_COB_IMPORTER

View File

@ -78,9 +78,6 @@ public:
COBImporter();
~COBImporter();
public:
// --------------------
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const;
@ -115,15 +112,11 @@ private:
* @param stream Stream to read from. */
void ReadBinaryFile(COB::Scene& out, StreamReaderLE* stream);
private:
// Conversion to Assimp output format
aiNode* BuildNodes(const COB::Node& root,const COB::Scene& scin,aiScene* fill);
private:
// ASCII file support
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);
// 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
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 );
DefaultLogger::get()->debug("CalcTangentsProcess begin");
ASSIMP_LOG_DEBUG("CalcTangentsProcess begin");
bool bHas = false;
for ( unsigned int a = 0; a < pScene->mNumMeshes; a++ ) {
@ -103,9 +103,9 @@ void CalcTangentsProcess::Execute( aiScene* pScene)
}
if ( bHas ) {
DefaultLogger::get()->info("CalcTangentsProcess finished. Tangents have been calculated");
ASSIMP_LOG_INFO("CalcTangentsProcess finished. Tangents have been calculated");
} 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.
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;
}
// what we can check, though, is if the mesh has normals and texture coordinates. That's a requirement
if( pMesh->mNormals == NULL)
{
DefaultLogger::get()->error("Failed to compute tangents; need normals");
ASSIMP_LOG_ERROR("Failed to compute tangents; need normals");
return false;
}
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;
}

View File

@ -99,7 +99,7 @@ inline unsigned int FindEmptyUVChannel (aiMesh* mesh)
for (unsigned int m = 0; m < AI_MAX_NUMBER_OF_TEXTURECOORDS;++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;
}
@ -384,13 +384,13 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const 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)
{
DefaultLogger::get()->debug("GenUVCoordsProcess begin");
ASSIMP_LOG_DEBUG("GenUVCoordsProcess begin");
char buffer[1024];
if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT)
@ -418,7 +418,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex,
MappingTypeToString(mapping));
DefaultLogger::get()->info(buffer);
ASSIMP_LOG_INFO(buffer);
}
if (aiTextureMapping_OTHER == mapping)
@ -485,7 +485,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
}
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 "
"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
ai_assert(pScene->mRootNode != NULL);
DefaultLogger::get()->debug("MakeLeftHandedProcess begin");
ASSIMP_LOG_DEBUG("MakeLeftHandedProcess begin");
// recursively convert all the nodes
ProcessNode( pScene->mRootNode, aiMatrix4x4());
@ -110,7 +110,7 @@ void MakeLeftHandedProcess::Execute( aiScene* pScene)
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.
void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh) {
if ( nullptr == pMesh ) {
DefaultLogger::get()->error( "Nullptr to mesh found." );
ASSIMP_LOG_ERROR( "Nullptr to mesh found." );
return;
}
// 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.
void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat) {
if ( nullptr == _mat ) {
DefaultLogger::get()->error( "Nullptr to aiMaterial found." );
ASSIMP_LOG_ERROR( "Nullptr to aiMaterial found." );
return;
}
@ -245,13 +245,13 @@ bool FlipUVsProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data.
void FlipUVsProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("FlipUVsProcess begin");
ASSIMP_LOG_DEBUG("FlipUVsProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
ProcessMesh(pScene->mMeshes[i]);
for (unsigned int i = 0; i < pScene->mNumMaterials;++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) {
aiMaterialProperty* prop = mat->mProperties[a];
if( !prop ) {
DefaultLogger::get()->debug( "Property is null" );
ASSIMP_LOG_DEBUG( "Property is null" );
continue;
}
@ -319,10 +319,10 @@ bool FlipWindingOrderProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data.
void FlipWindingOrderProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("FlipWindingOrderProcess begin");
ASSIMP_LOG_DEBUG("FlipWindingOrderProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++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.
void DeboneProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("DeboneProcess begin");
ASSIMP_LOG_DEBUG("DeboneProcess begin");
if(!pScene->mNumMeshes) {
return;
@ -148,9 +148,7 @@ void DeboneProcess::Execute( aiScene* pScene)
}
if(!DefaultLogger::isNullLogger()) {
char buffer[1024];
::ai_snprintf(buffer,1024,"Removed %u bones. Input bones: %u. Output bones: %u",in-out,in,out);
DefaultLogger::get()->info(buffer);
ASSIMP_LOG_INFO_F("Removed %u bones. Input bones:", in - out, ". Output bones: ", out);
}
// 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);
}
DefaultLogger::get()->debug("DeboneProcess end");
ASSIMP_LOG_DEBUG("DeboneProcess end");
}
// ------------------------------------------------------------------------------------------------

View File

@ -93,9 +93,7 @@ void EmbedTexturesProcess::Execute(aiScene* pScene) {
}
}
char stringBuffer[128];
::ai_snprintf(stringBuffer, 128, "EmbedTexturesProcess finished. Embedded %u textures.", embeddedTexturesCount);
DefaultLogger::get()->info(stringBuffer);
ASSIMP_LOG_INFO_F("EmbedTexturesProcess finished. Embedded ", embeddedTexturesCount, " textures." );
}
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
std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
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
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);
file.open(imagePath, std::ios::binary | std::ios::ate);
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;
}
}

View File

@ -91,7 +91,7 @@ void DOMWarning(const std::string& message, const Element* element /*= NULL*/)
return;
}
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.
void FindDegeneratesProcess::Execute( aiScene* pScene) {
DefaultLogger::get()->debug("FindDegeneratesProcess begin");
ASSIMP_LOG_DEBUG("FindDegeneratesProcess begin");
for (unsigned int i = 0; i < pScene->mNumMeshes;++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 ) {
@ -242,7 +242,7 @@ evil_jump_outside:
if (!mesh->mNumFaces) {
// WTF!?
// 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)
// OK ... bad idea.
@ -250,10 +250,7 @@ evil_jump_outside:
}
}
if (deg && !DefaultLogger::isNullLogger())
{
char s[64];
ASSIMP_itoa10(s,deg);
DefaultLogger::get()->warn(std::string("Found ") + s + " degenerated primitives");
if (deg && !DefaultLogger::isNullLogger()) {
ASSIMP_LOG_WARN_F( "Found ", deg, " 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.
void FindInstancesProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("FindInstancesProcess begin");
ASSIMP_LOG_DEBUG("FindInstancesProcess begin");
if (pScene->mNumMeshes) {
// 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
if (!DefaultLogger::isNullLogger()) {
char buffer[512];
::ai_snprintf(buffer,512,"FindInstancesProcess finished. Found %i instances",pScene->mNumMeshes-numMeshesOut);
DefaultLogger::get()->info(buffer);
ASSIMP_LOG_INFO_F( "FindInstancesProcess finished. Found ", (pScene->mNumMeshes - numMeshesOut), " instances" );
}
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.
void FindInvalidDataProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("FindInvalidDataProcess begin");
ASSIMP_LOG_DEBUG("FindInvalidDataProcess begin");
bool out = false;
std::vector<unsigned int> meshMapping(pScene->mNumMeshes);
@ -163,9 +163,10 @@ void FindInvalidDataProcess::Execute( aiScene* pScene)
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);
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;
in = NULL;
return true;
@ -354,7 +354,7 @@ int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
// Process vertex positions
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;
}

View File

@ -82,28 +82,35 @@ bool FixInfacingNormalsProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data.
void FixInfacingNormalsProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("FixInfacingNormalsProcess begin");
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess begin");
bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
if(ProcessMesh( pScene->mMeshes[a],a))bHas = true;
bool bHas( false );
for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
if (ProcessMesh(pScene->mMeshes[a], a)) {
bHas = true;
}
}
if (bHas)
DefaultLogger::get()->debug("FixInfacingNormalsProcess finished. Found issues.");
else DefaultLogger::get()->debug("FixInfacingNormalsProcess finished. No changes to the scene.");
if (bHas) {
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess finished. Found issues.");
} else {
ASSIMP_LOG_DEBUG("FixInfacingNormalsProcess finished. No changes to the scene.");
}
}
// ------------------------------------------------------------------------------------------------
// Apply the step to the mesh
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
if (!pcMesh->HasNormals())return false;
if (!pcMesh->HasNormals()) {
return false;
}
// 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
// normals need to be flipped, although there are a few special cases ..
// 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;
// now compare the volumes of the bounding boxes
if (std::fabs(fDelta0_x * fDelta0_y * fDelta0_z) <
std::fabs(fDelta1_x * fDelta1_yz))
{
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);
if (std::fabs(fDelta0_x * fDelta0_y * fDelta0_z) < 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);
}
// Invert normals

View File

@ -72,16 +72,14 @@ GenFaceNormalsProcess::~GenFaceNormalsProcess()
// ------------------------------------------------------------------------------------------------
// 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;
}
// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
void GenFaceNormalsProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("GenFaceNormalsProcess begin");
void GenFaceNormalsProcess::Execute( aiScene* pScene) {
ASSIMP_LOG_DEBUG("GenFaceNormalsProcess begin");
if (pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) {
throw DeadlyImportError("Post-processing order mismatch: expecting pseudo-indexed (\"verbose\") vertices here");
@ -94,11 +92,12 @@ void GenFaceNormalsProcess::Execute( aiScene* pScene)
}
}
if (bHas) {
DefaultLogger::get()->info("GenFaceNormalsProcess finished. "
ASSIMP_LOG_INFO("GenFaceNormalsProcess finished. "
"Face normals have been calculated");
}
else DefaultLogger::get()->debug("GenFaceNormalsProcess finished. "
} else {
ASSIMP_LOG_DEBUG("GenFaceNormalsProcess finished. "
"Normals are already there");
}
}
// ------------------------------------------------------------------------------------------------
@ -113,7 +112,7 @@ bool GenFaceNormalsProcess::GenMeshFaceNormals (aiMesh* pMesh)
// triangles or higher-order polygons the normal vectors
// are undefined.
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;
}

View File

@ -88,24 +88,25 @@ void GenVertexNormalsProcess::SetupProperties(const Importer* pImp)
// Executes the post processing step on the given imported data.
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");
}
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))
bHas = true;
}
if (bHas) {
DefaultLogger::get()->info("GenVertexNormalsProcess finished. "
ASSIMP_LOG_INFO("GenVertexNormalsProcess finished. "
"Vertex normals have been calculated");
}
else DefaultLogger::get()->debug("GenVertexNormalsProcess finished. "
} else {
ASSIMP_LOG_DEBUG("GenVertexNormalsProcess finished. "
"Normals are already there");
}
}
// ------------------------------------------------------------------------------------------------
@ -120,7 +121,7 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
// are undefined.
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;
}

View File

@ -470,7 +470,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
}
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
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
// the library version they're using - a log dump is
// sufficient.
const unsigned int flags = aiGetCompileFlags();
ASSIMP_LOG_DEBUG_F( "Assimp ", aiGetVersionMajor(), ".", aiGetVersionMinor(), ".", aiGetVersionRevision(), " "
const unsigned int flags( aiGetCompileFlags() );
std::stringstream stream;
stream << "Assimp " << aiGetVersionMajor() << "." << aiGetVersionMinor() << "." << aiGetVersionRevision() << " "
#if defined(ASSIMP_BUILD_ARCHITECTURE)
,ASSIMP_BUILD_ARCHITECTURE
<< ASSIMP_BUILD_ARCHITECTURE
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
, "x86"
<< "x86"
#elif defined(_M_X64) || defined(__x86_64__)
, "amd64"
<< "amd64"
#elif defined(_M_IA64) || defined(__ia64__)
, "itanium"
<< "itanium"
#elif defined(__ppc__) || defined(__powerpc__)
, "ppc32"
<< "ppc32"
#elif defined(__powerpc64__)
, "ppc64"
<< "ppc64"
#elif defined(__arm__)
, "arm"
<< "arm"
#else
, "<unknown architecture>"
<< "<unknown architecture>"
#endif
, " "
<< " "
#if defined(ASSIMP_BUILD_COMPILER)
, ASSIMP_BUILD_COMPILER
<< ( ASSIMP_BUILD_COMPILER )
#elif defined(_MSC_VER)
, "msvc"
<< "msvc"
#elif defined(__GNUC__)
, "gcc"
<< "gcc"
#else
, "<unknown compiler>"
<< "<unknown compiler>"
#endif
#ifdef ASSIMP_BUILD_DEBUG
, " debug"
<< " debug"
#endif
, (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
, (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
, (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "")
);
<< (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
<< (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
<< (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)
{
if (!pScene->mNumMeshes) {
DefaultLogger::get()->debug("ImproveCacheLocalityProcess skipped; there are no meshes");
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess skipped; there are no meshes");
return;
}
DefaultLogger::get()->debug("ImproveCacheLocalityProcess begin");
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess begin");
float out = 0.f;
unsigned int numf = 0, numm = 0;
@ -112,12 +112,8 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
}
}
if (!DefaultLogger::isNullLogger()) {
char szBuff[128]; // should be sufficiently large in every case
ai_snprintf(szBuff,128,"Cache relevant are %u meshes (%u faces). Average output ACMR is %f",
numm,numf,out/numf);
DefaultLogger::get()->info(szBuff);
DefaultLogger::get()->debug("ImproveCacheLocalityProcess finished. ");
ASSIMP_LOG_INFO_F("Cache relevant are ", numm, " meshes (", numf," faces). Average output ACMR is ", out / numf );
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess finished. ");
}
}
@ -135,7 +131,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
return 0.f;
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;
}
@ -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
if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
char szBuff[128]; // should be sufficiently large in every case
ai_snprintf(szBuff,128,"Mesh %u | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2,
((fACMR - fACMR2) / fACMR) * 100.f);
DefaultLogger::get()->debug(szBuff);
ASSIMP_LOG_DEBUG_F("Mesh %u | ACMR in: ", meshNum, " out: ", fACMR, " | ~", fACMR2, ((fACMR - fACMR2) / fACMR) * 100.f);
}
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.
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
int iNumOldVertices = 0;
@ -95,19 +95,13 @@ void JoinVerticesProcess::Execute( aiScene* pScene)
iNumVertices += ProcessMesh( pScene->mMeshes[a],a);
// if logging is active, print detailed statistics
if (!DefaultLogger::isNullLogger())
{
if (iNumOldVertices == iNumVertices)
{
DefaultLogger::get()->debug("JoinVerticesProcess finished ");
} else
{
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);
if (!DefaultLogger::isNullLogger()) {
if (iNumOldVertices == iNumVertices) {
ASSIMP_LOG_DEBUG("JoinVerticesProcess finished ");
} else {
ASSIMP_LOG_INFO_F("JoinVerticesProcess finished | Verts in: ", iNumOldVertices,
" out: ", iNumVertices, " | ~",
((iNumOldVertices - iNumVertices) / (float)iNumOldVertices) * 100.f );
}
}
@ -274,7 +268,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
}
if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
DefaultLogger::get()->debug((Formatter::format(),
ASSIMP_LOG_DEBUG_F(
"Mesh ",meshIndex,
" (",
(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,
"%"
));
);
}
// replace vertex data with the unique data sets
@ -375,7 +369,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
}
}
} 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) {

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 need to duplicate the corresponding polygon.
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;
continue;
}
@ -1442,17 +1442,21 @@ void LWOImporter::LoadLWO2File()
if (skip)
break;
if (mCurLayer->mFaces.empty())
DefaultLogger::get()->warn("LWO2: Unexpected PTAG");
else LoadLWO2PolygonTags(head.length);
if (mCurLayer->mFaces.empty()) {
ASSIMP_LOG_WARN("LWO2: Unexpected PTAG");
} else {
LoadLWO2PolygonTags(head.length);
}
break;
}
// list of tags
case AI_LWO_TAGS:
{
if (!mTags->empty())
if (!mTags->empty()) {
ASSIMP_LOG_WARN("LWO2: SRFS chunk encountered twice");
else LoadLWOTags(head.length);
} else {
LoadLWOTags(head.length);
}
break;
}

View File

@ -684,7 +684,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
(*it).tokens[0] == "LightMotion")) {
if (nodes.empty())
DASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'");
ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'");
else {
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
else if ((*it).tokens[0] == "LightType") {
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);

View File

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

View File

@ -130,7 +130,7 @@ void MD5Parser::ParseHeader()
// FIX: can break the log length limit, so we need to be careful
char* sz = 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();
}
@ -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 ));
}
if (pcHeader->ulVersion != AI_MDC_VERSION)
DefaultLogger::get()->warn("Unsupported MDC file version (2 (AI_MDC_VERSION) was expected)");
if (pcHeader->ulVersion != AI_MDC_VERSION) {
ASSIMP_LOG_WARN("Unsupported MDC file version (2 (AI_MDC_VERSION) was expected)");
}
if (pcHeader->ulOffsetBorderFrames + pcHeader->ulNumFrames * sizeof(MDC::Frame) > 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.");
}
if (this->configFrameID >= this->pcHeader->ulNumFrames)
if (this->configFrameID >= this->pcHeader->ulNumFrames) {
throw DeadlyImportError("The requested frame is not available");
}
}
// ------------------------------------------------------------------------------------------------
@ -388,7 +390,7 @@ void MDCImporter::InternReadFile(
uint32_t quak = pcTriangle->aiIndices[iIndex];
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;
}

View File

@ -481,7 +481,7 @@ void MDLImporter::InternReadFile_Quake1() {
if (iIndex >= (unsigned int)pcHeader->num_verts)
{
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];
@ -1026,7 +1026,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) {
// (we might need to read this section a second time - to process frame vertices correctly)
pcGroupTris->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1;
DASSIMP_LOG_WARN("Index overflow in MDL7 vertex list");
ASSIMP_LOG_WARN("Index overflow in MDL7 vertex list");
}
// write the output face index
@ -1894,7 +1894,7 @@ void MDLImporter::GenerateOutputMeshes_3DGS_MDL7(
unsigned int iBone = groupData.aiBones[ oldFace.mIndices[c] ];
if (UINT_MAX != iBone) {
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. ");
iBone = iNumOutBones-1;
}

View File

@ -64,7 +64,7 @@ using namespace Assimp;
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)
{
// 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)
{
unsigned char* colorMap = new unsigned char[256*3];
constexpr size_t len = 256 * 3;
unsigned char* colorMap = new unsigned char[len];
szColorMap = colorMap;
pcStream->Read(colorMap,256*3,1);
DefaultLogger::get()->info("Found valid colormap.lmp in directory. "
pcStream->Read(colorMap, len,1);
ASSIMP_LOG_INFO("Found valid colormap.lmp in directory. "
"It will be used to decode embedded textures in palletized formats.");
}
delete pcStream;
@ -186,7 +187,7 @@ void MDLImporter::CreateTexture_3DGS_MDL4(const unsigned char* szData,
if (iType == 1 || iType > 3)
{
DefaultLogger::get()->error("Unsupported texture file format");
ASSIMP_LOG_ERROR("Unsupported texture file format");
return;
}
@ -508,7 +509,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
// ***** EMBEDDED DDS FILE *****
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");
}

View File

@ -349,9 +349,6 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
stream.CopyAndAdvance(j.parentName,32);
j.parentName[32] = '\0';
// DefaultLogger::get()->debug(j.name);
// DefaultLogger::get()->debug(j.parentName);
ReadVector(stream,j.rotation);
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);
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)) {

View File

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

View File

@ -130,18 +130,18 @@ void NDOImporter::InternReadFile( const std::string& pFile,
unsigned int file_format = 12;
if (!strncmp("1.0",head+6,3)) {
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)) {
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)) {
file_format = 12;
DefaultLogger::get()->info("NDO file format is 1.2");
ASSIMP_LOG_INFO("NDO file format is 1.2");
}
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 */

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,
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
if( !file.get()) {
DefaultLogger::get()->error("NFF2: Unable to open material library " + path + ".");
ASSIMP_LOG_ERROR("NFF2: Unable to open material library " + path + ".");
return;
}
@ -158,7 +158,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
// The file should start with the magic sequence "mat"
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;
}
@ -174,7 +174,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
// 'version' defines the version of the file format
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
else if (TokenMatch(sz,"matdef",6))
@ -192,8 +192,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
{
if (!curShader)
{
DefaultLogger::get()->error(std::string("NFF2 material library: Found element ") +
sz + "but there is no active material");
ASSIMP_LOG_ERROR_F("NFF2 material library: Found element ", sz, "but there is no active material");
continue;
}
}
@ -308,7 +307,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
SkipSpaces(line,&sz);
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))
{
@ -471,7 +470,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
unsigned int m = ::strtoul10(sz,&sz);
if (m >= (unsigned int)tempPositions.size())
{
DefaultLogger::get()->error("NFF2: Vertex index overflow");
ASSIMP_LOG_ERROR("NFF2: Vertex index overflow");
m= 0;
}
// mesh.vertices.push_back (tempPositions[idx]);
@ -577,7 +576,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
matIdx = ::strtoul10(sz,&sz);
if (matIdx >= materialTable.size())
{
DefaultLogger::get()->error("NFF2: Material index overflow.");
ASSIMP_LOG_ERROR("NFF2: Material index overflow.");
matIdx = 0;
}
@ -750,7 +749,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
{
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;
}
@ -943,7 +942,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
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;
}
sz = line;
@ -955,7 +954,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
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;
}
sz = line;
@ -971,7 +970,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
float f;
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;
}
currentMesh.dir /= f; // normalize
@ -1029,18 +1028,20 @@ void NFFImporter::InternReadFile( const std::string& pFile,
// 'pb' - bezier patch. Not supported yet
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
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
else if ('#' == line[0])
{
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))
{
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;
}
aiVector3D& v = tempPositions[i];
@ -175,14 +175,14 @@ void OFFImporter::InternReadFile( const std::string& pFile,
{
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;
}
sz = line;SkipSpaces(&sz);
faces->mNumIndices = strtoul10(sz,&sz);
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;
continue;
}
@ -217,7 +217,7 @@ void OFFImporter::InternReadFile( const std::string& pFile,
idx = strtoul10(sz,&sz);
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;
}
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();
pScene->mNumMaterials = 0;
if ( pModel->m_MaterialLib.empty() ) {
DefaultLogger::get()->debug("OBJ: no materials specified");
ASSIMP_LOG_DEBUG("OBJ: no materials specified");
return;
}
@ -591,7 +591,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
break;
default:
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);

View File

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

View File

@ -426,7 +426,7 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
if ( *m_DataIt =='/' ) {
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 there are no texture coordinates in the file, but normals
@ -486,7 +486,7 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
}
if ( face->m_vertices.empty() ) {
DefaultLogger::get()->error("Obj: Ignoring empty face");
ASSIMP_LOG_ERROR("Obj: Ignoring empty face");
// skip line and clean up
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
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
// materials if that happens, so create a new named material instead of discarding it
// 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->MaterialName.Set(strName);
m_pModel->m_MaterialLib.push_back(strName);
@ -620,12 +620,12 @@ void ObjFileParser::getMaterialLib() {
IOStream *pFile = m_pIO->Open( absName );
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";
DefaultLogger::get()->info("OBJ: Opening fallback material file " + strMatFallbackName);
ASSIMP_LOG_INFO("OBJ: Opening fallback material file " + strMatFallbackName);
pFile = m_pIO->Open(strMatFallbackName);
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);
return;
}
@ -817,7 +817,7 @@ void ObjFileParser::createMesh( const std::string &meshName )
}
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()
{
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 (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))));
}
#endif
@ -192,7 +192,7 @@ void OgreBinarySerializer::RollbackHeader()
void OgreBinarySerializer::SkipBytes(size_t numBytes)
{
#if (OGRE_BINARY_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug(Formatter::format() << "Skipping " << numBytes << " bytes");
ASSIMP_LOG_DEBUG_F( "Skipping ", numBytes, " bytes");
#endif
m_reader->IncPtr(numBytes);
@ -237,8 +237,8 @@ void OgreBinarySerializer::ReadMesh(Mesh *mesh)
{
mesh->hasSkeletalAnimations = Read<bool>();
DefaultLogger::get()->debug("Reading Mesh");
DefaultLogger::get()->debug(Formatter::format() << " - Skeletal animations: " << (mesh->hasSkeletalAnimations ? "true" : "false"));
ASSIMP_LOG_DEBUG("Reading Mesh");
ASSIMP_LOG_DEBUG_F( " - Skeletal animations: ", mesh->hasSkeletalAnimations ? "true" : "false" );
if (!AtEnd())
{
@ -420,9 +420,9 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
submesh->indexData->faceCount = static_cast<uint32_t>(submesh->indexData->count / 3);
submesh->indexData->is32bit = Read<bool>();
DefaultLogger::get()->debug(Formatter::format() << "Reading SubMesh " << mesh->subMeshes.size());
DefaultLogger::get()->debug(Formatter::format() << " - Material: '" << submesh->materialRef << "'");
DefaultLogger::get()->debug(Formatter::format() << " - Uses shared geometry: " << (submesh->usesSharedVertexData ? "true" : "false"));
ASSIMP_LOG_DEBUG_F( "Reading SubMesh ", mesh->subMeshes.size());
ASSIMP_LOG_DEBUG_F( " - Material: '", submesh->materialRef, "'");
ASSIMP_LOG_DEBUG_F( " - Uses shared geometry: ", submesh->usesSharedVertexData ? "true" : "false" );
// Index buffer
if (submesh->indexData->count > 0)
@ -431,9 +431,9 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh)
uint8_t *indexBuffer = ReadBytes(numBytes);
submesh->indexData->buffer = MemoryStreamPtr(new Assimp::MemoryIOStream(indexBuffer, numBytes, true));
DefaultLogger::get()->debug(Formatter::format() << " - " << submesh->indexData->faceCount
<< " faces from " << submesh->indexData->count << (submesh->indexData->is32bit ? " 32bit" : " 16bit")
<< " indexes of " << numBytes << " bytes");
ASSIMP_LOG_DEBUG_F( " - ", submesh->indexData->faceCount,
" faces from ", submesh->indexData->count, (submesh->indexData->is32bit ? " 32bit" : " 16bit"),
" indexes of ", numBytes, " bytes");
}
// Vertex buffer if not referencing the shared geometry
@ -549,7 +549,7 @@ void OgreBinarySerializer::ReadSubMeshNames(Mesh *mesh)
}
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())
id = ReadHeader();
@ -563,7 +563,7 @@ void OgreBinarySerializer::ReadGeometry(VertexData *dest)
{
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())
{
@ -620,8 +620,8 @@ void OgreBinarySerializer::ReadGeometryVertexElement(VertexData *dest)
element.offset = Read<uint16_t>();
element.index = Read<uint16_t>();
DefaultLogger::get()->debug(Formatter::format() << " - Vertex element " << element.SemanticToString() << " of type "
<< element.TypeToString() << " index=" << element.index << " source=" << element.source);
ASSIMP_LOG_DEBUG_F( " - Vertex element ", element.SemanticToString(), " of type ",
element.TypeToString(), " index=", element.index, " source=", element.source);
dest->vertexElements.push_back(element);
}
@ -642,7 +642,7 @@ void OgreBinarySerializer::ReadGeometryVertexBuffer(VertexData *dest)
uint8_t *vertexBuffer = ReadBytes(numBytes);
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*/)
@ -892,13 +892,13 @@ MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHand
{
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();
}
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();
}
@ -925,7 +925,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
<< " 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 firstAnim = true;
@ -944,7 +944,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
{
if (firstBone)
{
DefaultLogger::get()->debug(" - Bones");
ASSIMP_LOG_DEBUG(" - Bones");
firstBone = false;
}
@ -960,7 +960,7 @@ void OgreBinarySerializer::ReadSkeleton(Skeleton *skeleton)
{
if (firstAnim)
{
DefaultLogger::get()->debug(" - Animations");
ASSIMP_LOG_DEBUG(" - Animations");
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);
}
DefaultLogger::get()->debug(Formatter::format() << " " << bone->id << " " << bone->name);
ASSIMP_LOG_DEBUG_F( " ", bone->id, " ", bone->name);
skeleton->bones.push_back(bone);
}
@ -1053,7 +1053,7 @@ void OgreBinarySerializer::ReadSkeletonAnimation(Skeleton *skeleton)
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)

View File

@ -175,18 +175,18 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
if (materialFile) {
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)
{
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;
}
std::unique_ptr<IOStream> stream(materialFile);
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;
}
@ -201,7 +201,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
ss << &data[0];
}
DefaultLogger::get()->debug("Reading material '" + materialName + "'");
ASSIMP_LOG_DEBUG_F("Reading material '", materialName, "'");
aiMaterial *material = new aiMaterial();
m_textures.clear();
@ -234,7 +234,6 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
ss >> linePart;
if (linePart != materialName)
{
//DefaultLogger::get()->debug(Formatter::format() << "Found material '" << linePart << "' that does not match at index " << ss.tellg());
ss >> linePart;
continue;
}
@ -242,11 +241,11 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste
NextAfterNewLine(ss, linePart);
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;
}
DefaultLogger::get()->debug("material '" + materialName + "'");
ASSIMP_LOG_DEBUG_F("material '", materialName, "'");
while(linePart != partBlockEnd)
{
@ -350,11 +349,11 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream
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;
}
DefaultLogger::get()->debug(" technique '" + techniqueName + "'");
ASSIMP_LOG_DEBUG_F(" technique '", techniqueName, "'");
const string partPass = "pass";
@ -386,11 +385,11 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
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;
}
DefaultLogger::get()->debug(" pass '" + passName + "'");
ASSIMP_LOG_DEBUG_F(" pass '", passName, "'");
const string partAmbient = "ambient";
const string partDiffuse = "diffuse";
@ -417,7 +416,7 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat
ss >> 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)
{
@ -452,11 +451,11 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
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;
}
DefaultLogger::get()->debug(" texture_unit '" + textureUnitName + "'");
ASSIMP_LOG_DEBUG_F(" texture_unit '", textureUnitName, "'");
const string partTexture = "texture";
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)
{
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")
{
@ -581,8 +580,8 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr
unsigned int textureTypeIndex = m_textures[textureType];
m_textures[textureType]++;
DefaultLogger::get()->debug(Formatter::format() << " texture '" << textureRef << "' type " << textureType
<< " index " << textureTypeIndex << " UV " << uvCoord);
ASSIMP_LOG_DEBUG_F( " texture '", textureRef, "' type ", textureType,
" index ", textureTypeIndex, " UV ", uvCoord);
aiString assimpTextureRef(textureRef);
material->AddProperty(&assimpTextureRef, AI_MATKEY_TEXTURE(textureType, textureTypeIndex));

View File

@ -190,7 +190,7 @@ std::string &OgreXmlSerializer::NextNode()
CurrentNodeName(true);
#if (OGRE_XML_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug("<" + m_currentNodeName + ">");
ASSIMP_LOG_DEBUG"<" + m_currentNodeName + ">");
#endif
return m_currentNodeName;
}
@ -210,7 +210,7 @@ std::string OgreXmlSerializer::CurrentNodeName(bool forceRead)
std::string &OgreXmlSerializer::SkipCurrentNode()
{
#if (OGRE_XML_SERIALIZER_DEBUG == 1)
DefaultLogger::get()->debug("Skipping node <" + m_currentNodeName + ">");
ASSIMP_LOG_DEBUG("Skipping node <" + m_currentNodeName + ">");
#endif
for(;;) {
@ -317,7 +317,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
throw DeadlyImportError("Root node is <" + m_currentNodeName + "> expecting <mesh>");
}
DefaultLogger::get()->debug("Reading Mesh");
ASSIMP_LOG_DEBUG("Reading Mesh");
NextNode();
@ -351,7 +351,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
else if (m_currentNodeName == nnSkeletonLink)
{
mesh->skeletonRef = ReadAttribute<std::string>("name");
DefaultLogger::get()->debug("Read skeleton link " + mesh->skeletonRef);
ASSIMP_LOG_DEBUG_F("Read skeleton link ", mesh->skeletonRef);
NextNode();
}
// Assimp incompatible/ignored nodes
@ -363,7 +363,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) {
void OgreXmlSerializer::ReadGeometry(VertexDataXml *dest)
{
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();
while(m_currentNodeName == nnVertexBuffer) {
@ -385,22 +385,22 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest)
if (positions)
{
DefaultLogger::get()->debug(" - Contains positions");
ASSIMP_LOG_DEBUG(" - Contains positions");
dest->positions.reserve(dest->count);
}
if (normals)
{
DefaultLogger::get()->debug(" - Contains normals");
ASSIMP_LOG_DEBUG(" - Contains normals");
dest->normals.reserve(dest->count);
}
if (tangents)
{
DefaultLogger::get()->debug(" - Contains tangents");
ASSIMP_LOG_DEBUG(" - Contains tangents");
dest->tangents.reserve(dest->count);
}
if (uvs > 0)
{
DefaultLogger::get()->debug(Formatter::format() << " - Contains " << uvs << " texture coords");
ASSIMP_LOG_DEBUG_F( " - Contains ", uvs, " texture coords");
dest->uvs.resize(uvs);
for(size_t i=0, len=dest->uvs.size(); i<len; ++i) {
dest->uvs[i].reserve(dest->count);
@ -508,7 +508,7 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest)
}
}
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);
}
DefaultLogger::get()->debug(Formatter::format() << "Reading SubMesh " << mesh->subMeshes.size());
DefaultLogger::get()->debug(Formatter::format() << " - Material: '" << submesh->materialRef << "'");
DefaultLogger::get()->debug(Formatter::format() << " - Uses shared geometry: " << (submesh->usesSharedVertexData ? "true" : "false"));
ASSIMP_LOG_DEBUG_F( "Reading SubMesh ", mesh->subMeshes.size());
ASSIMP_LOG_DEBUG_F( " - Material: '", submesh->materialRef, "'");
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
// 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)
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;
}
@ -597,32 +597,26 @@ void OgreXmlSerializer::ReadSubMesh(MeshXml *mesh)
NextNode();
}
if (submesh->indexData->faces.size() == submesh->indexData->faceCount)
{
DefaultLogger::get()->debug(Formatter::format() << " - Faces " << submesh->indexData->faceCount);
}
else
{
if (submesh->indexData->faces.size() == submesh->indexData->faceCount) {
ASSIMP_LOG_DEBUG_F( " - Faces ", submesh->indexData->faceCount);
} else {
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) {
throw DeadlyImportError("Found <geometry> in <submesh> when use shared geometry is true. Invalid mesh file.");
}
submesh->vertexData = new VertexDataXml();
ReadGeometry(submesh->vertexData);
}
else if (m_currentNodeName == nnBoneAssignments)
{
} else if (m_currentNodeName == nnBoneAssignments) {
ReadBoneAssignments(submesh->vertexData);
}
// Assimp incompatible/ignored nodes
else
else {
SkipCurrentNode();
}
}
submesh->index = static_cast<unsigned int>(mesh->subMeshes.size());
mesh->subMeshes.push_back(submesh);
@ -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
@ -731,13 +725,13 @@ XmlReaderPtr OgreXmlSerializer::OpenReader(Assimp::IOSystem *pIOHandler, const s
{
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();
}
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();
}
@ -760,7 +754,7 @@ void OgreXmlSerializer::ReadSkeleton(Skeleton *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
if (HasAttribute("blendmode")) {
@ -793,7 +787,7 @@ void OgreXmlSerializer::ReadAnimations(Skeleton *skeleton)
throw DeadlyImportError("Cannot read <animations> for a Skeleton without bones");
}
DefaultLogger::get()->debug(" - Animations");
ASSIMP_LOG_DEBUG(" - Animations");
NextNode();
while(m_currentNodeName == nnAnimation)
@ -809,7 +803,7 @@ void OgreXmlSerializer::ReadAnimations(Skeleton *skeleton)
ReadAnimationTracks(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;
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);
@ -925,7 +919,7 @@ static bool BoneCompare(Bone *a, Bone *b)
void OgreXmlSerializer::ReadBones(Skeleton *skeleton)
{
DefaultLogger::get()->debug(" - Bones");
ASSIMP_LOG_DEBUG(" - Bones");
NextNode();
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)
{
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)) {
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 ) {
m_currentMesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
} 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 ) {
unsigned int matIdx = static_cast< unsigned int >( m_material2refMap[ name ] );
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;
} 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
void OptimizeGraphProcess::Execute( aiScene* pScene) {
DefaultLogger::get()->debug("OptimizeGraphProcess begin");
ASSIMP_LOG_DEBUG("OptimizeGraphProcess begin");
nodes_in = nodes_out = count_merged = 0;
mScene = pScene;
@ -329,12 +329,10 @@ void OptimizeGraphProcess::Execute( aiScene* pScene) {
pScene->mRootNode->mParent = NULL;
if (!DefaultLogger::isNullLogger()) {
if ( nodes_in != nodes_out) {
char buf[512];
::ai_snprintf(buf,512,"OptimizeGraphProcess finished; Input nodes: %u, Output nodes: %u",nodes_in,nodes_out);
DefaultLogger::get()->info(buf);
ASSIMP_LOG_INFO_F("OptimizeGraphProcess finished; Input nodes: ", nodes_in, ", Output nodes: ", nodes_out);
} else {
ASSIMP_LOG_DEBUG("OptimizeGraphProcess finished");
}
else DefaultLogger::get()->debug("OptimizeGraphProcess finished");
}
meshes.clear();
locked.clear();

View File

@ -107,11 +107,11 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene)
{
const unsigned int num_old = pScene->mNumMeshes;
if (num_old <= 1) {
DefaultLogger::get()->debug("Skipping OptimizeMeshesProcess");
ASSIMP_LOG_DEBUG("Skipping OptimizeMeshesProcess");
return;
}
DefaultLogger::get()->debug("OptimizeMeshesProcess begin");
ASSIMP_LOG_DEBUG("OptimizeMeshesProcess begin");
mScene = pScene;
// 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);
if (output.size() != num_old) {
char tmp[512];
::ai_snprintf(tmp,512,"OptimizeMeshesProcess finished. Input meshes: %u, Output meshes: %u",num_old,pScene->mNumMeshes);
DefaultLogger::get()->info(tmp);
ASSIMP_LOG_DEBUG_F("OptimizeMeshesProcess finished. Input meshes: ", num_old, ", Output meshes: ", pScene->mNumMeshes);
} 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)
{
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;
@ -229,7 +229,7 @@ PLY::ESemantic PLY::Property::ParseSemantic(std::vector<char> &buffer) {
eOut = PLY::EST_ZNormal;
}
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);
}
return eOut;
@ -295,7 +295,7 @@ bool PLY::Property::ParseProperty(std::vector<char> &buffer, PLY::Property* pOut
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]));
}
@ -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) {
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() begin");
// parse all elements
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.
SkipSpacesAndLineEnd(buffer);
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() succeeded");
return true;
}
// ------------------------------------------------------------------------------------------------
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());
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;
}
@ -582,7 +582,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary(IOStreamBuffer<char> &streamBuffe
PLYImporter* loader,
bool p_bBE)
{
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceListsBinary() begin");
alElementData.resize(alElements.size());
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;
}
@ -615,11 +615,11 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
std::vector<char> 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))
{
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() failure");
return false;
}
@ -628,10 +628,10 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
const char* pCur = (char*)&buffer[0];
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;
}
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() succeeded");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() succeeded");
return true;
}
@ -644,11 +644,11 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
std::vector<char> 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))
{
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
return false;
}
@ -656,10 +656,10 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
streamBuffer.getNextLine(buffer);
if (!p_pcOut->ParseElementInstanceLists(streamBuffer, buffer, loader))
{
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
return false;
}
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() succeeded");
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() succeeded");
return true;
}

View File

@ -391,7 +391,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector<aiMesh*>& out, aiMesh** in
}
if (node->mMeshes[i] < numIn) {
// 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;
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.
void PretransformVertices::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("PretransformVerticesProcess begin");
ASSIMP_LOG_DEBUG("PretransformVerticesProcess begin");
// Return immediately if we have no meshes
if (!pScene->mNumMeshes)
@ -713,22 +713,12 @@ void PretransformVertices::Execute( aiScene* pScene)
}
// print statistics
if (!DefaultLogger::isNullLogger())
{
char buffer[4096];
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_DEBUG("PretransformVerticesProcess finished");
DefaultLogger::get()->debug("PretransformVerticesProcess finished");
::ai_snprintf(buffer,4096,"Removed %u nodes and %u animation channels (%u output nodes)",
iOldNodes,iOldAnimationChannels,CountNodes(pScene->mRootNode));
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);
ASSIMP_LOG_INFO_F("Removed ", iOldNodes, " nodes and ", iOldAnimationChannels, " animation channels (",
CountNodes(pScene->mRootNode) ," output nodes)" );
ASSIMP_LOG_INFO_F("Kept ", pScene->mNumLights, " lights and ", pScene->mNumCameras, " cameras." );
ASSIMP_LOG_INFO_F("Moved ", iOldMeshes, " meshes to WCS (number of output meshes: ", pScene->mNumMeshes, ")");
}
}

View File

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

View File

@ -348,7 +348,7 @@ class ComputeSpatialSortProcess : public BaseProcess
void Execute( aiScene* pScene)
{
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>::iterator it = p->begin();

View File

@ -125,7 +125,7 @@ void Q3DImporter::InternReadFile( const std::string& pFile,
}
// 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));
// ... an store it
@ -413,7 +413,7 @@ outer:
// If we have no materials loaded - generate a default mat
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.back().diffuse = fgColor ;
}

View File

@ -160,7 +160,7 @@ void RAWImporter::InternReadFile( const std::string& pFile,
}
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;
}

View File

@ -87,7 +87,7 @@ void RemoveRedundantMatsProcess::SetupProperties(const Importer* pImp)
// Executes the post processing step on the given imported data.
void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("RemoveRedundantMatsProcess begin");
ASSIMP_LOG_DEBUG("RemoveRedundantMatsProcess begin");
unsigned int redundantRemoved = 0, unreferencedRemoved = 0;
if (pScene->mNumMaterials)
@ -122,7 +122,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
// Keep this material even if no mesh references it
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)
{
DefaultLogger::get()->debug("RemoveRedundantMatsProcess finished ");
ASSIMP_LOG_DEBUG("RemoveRedundantMatsProcess finished ");
}
else
{
char szBuffer[128]; // should be sufficiently large
::ai_snprintf(szBuffer,128,"RemoveRedundantMatsProcess finished. Removed %u redundant and %u unused materials.",
redundantRemoved,unreferencedRemoved);
DefaultLogger::get()->info(szBuffer);
ASSIMP_LOG_INFO_F("RemoveRedundantMatsProcess finished. Removed ", redundantRemoved, " redundant and ",
unreferencedRemoved, " unused materials.");
}
}

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.
void RemoveVCProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("RemoveVCProcess begin");
ASSIMP_LOG_DEBUG("RemoveVCProcess begin");
bool bHas = false; //,bMasked = false;
mScene = pScene;
@ -224,15 +224,18 @@ void RemoveVCProcess::Execute( aiScene* pScene)
if (!pScene->mNumMeshes || !pScene->mNumMaterials)
{
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 (!pScene->mNumMeshes)
pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
}
if (bHas)DefaultLogger::get()->info("RemoveVCProcess finished. Data structure cleanup has been done.");
else DefaultLogger::get()->debug("RemoveVCProcess finished. Nothing to be done ...");
if (bHas) {
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.Size = stream->GetU4();
if (chunk.Size > stream->GetRemainingSizeToLimit())
DefaultLogger::get()->error("SIB: Chunk overflow");
ASSIMP_LOG_ERROR("SIB: Chunk overflow");
ByteSwap::Swap4(&chunk.Tag);
return chunk;
}
@ -589,7 +589,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
if (mtl >= meshes.size())
{
DefaultLogger::get()->error("SIB: Face material index is invalid.");
ASSIMP_LOG_ERROR("SIB: Face material index is invalid.");
mtl = 0;
}

View File

@ -286,7 +286,7 @@ void SMDImporter::CreateOutputMeshes()
if (UINT_MAX == (*iFace).iTexture)aaiFaces[(*iFace).iTexture].push_back( 0 );
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);
}
else aaiFaces[(*iFace).iTexture].push_back(iNum);
@ -366,7 +366,7 @@ void SMDImporter::CreateOutputMeshes()
if (pairval.first >= asBones.size() ||
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 "
"to the vertex' parent node");
continue;
@ -387,7 +387,7 @@ void SMDImporter::CreateOutputMeshes()
{
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 remaining weights will be normalized to 1.0");
@ -953,7 +953,7 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent,
unsigned int iBone = 0;
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;
}
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?
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) {
DefaultLogger::get()->warn("too few aggregate elements");
ASSIMP_LOG_WARN("too few aggregate elements");
}
out.reserve(inp->GetSize());

View File

@ -286,14 +286,14 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
if(!SkipSpacesAndLineEnd(&sz))
{
// 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;
}
// facet normal -0.13 -0.13 -0.98
if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0') {
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;
normalBuffer.push_back(aiVector3D());
@ -302,7 +302,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) {
sz += 6;
SkipSpaces(&sz);
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 {
if (sz[6] == '\0') {
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
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;
} else {
if (sz[6] == '\0') {
@ -418,7 +418,7 @@ bool STLImporter::LoadBinaryFile()
// read the default vertex color for facets
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;
clrColorDefault.r = (*sz2++) * invByte;
clrColorDefault.g = (*sz2++) * invByte;
@ -500,7 +500,7 @@ bool STLImporter::LoadBinaryFile()
*pMesh->mColors[0]++ = this->clrColorDefault;
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];
clr->a = 1.0;

View File

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

View File

@ -78,7 +78,7 @@ void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
{
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;
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
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)
{
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
// determine the size of a submesh
@ -378,7 +379,7 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
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++)
this->SplitMesh(a, pScene->mMeshes[a],avList);
@ -394,10 +395,10 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
// now we need to update all nodes
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
// faces in the mesh. They occur at outer model boundaries in non-closed
// shapes.
char tmp[512];
ai_snprintf(tmp, 512, "Catmull-Clark Subdivider: got %u bad edges touching only one face (totally %u edges). ",
bad_cnt,static_cast<unsigned int>(edges.size()));
DASSIMP_LOG_DEBUG(tmp);
ASSIMP_LOG_DEBUG_F("Catmull-Clark Subdivider: got ", bad_cnt, " bad edges touching only one face (totally ",
static_cast<unsigned int>(edges.size()), " edges). ");
}}
// ---------------------------------------------------------------------

View File

@ -192,7 +192,7 @@ void TerragenImporter::InternReadFile( const std::string& pFile,
{
mode = reader.GetI1();
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
else if (!::strncmp(head,AI_TERR_CHUNK_ALTW,4))

View File

@ -105,12 +105,10 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
if (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;
ai_snprintf(szTemp, 512, "Texture coordinate rotation %f can be simplified to %f",info.mRotation,out);
DefaultLogger::get()->info(szTemp);
out -= rounded * static_cast<float>(AI_MATH_PI);
ASSIMP_LOG_INFO_F("Texture coordinate rotation ", info.mRotation, " can be simplified to ", out);
}
// Next step - convert negative rotation angles to positives
@ -150,7 +148,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
out = 1.f;
}
if (szTemp[0]) {
DefaultLogger::get()->info(szTemp);
ASSIMP_LOG_INFO(szTemp);
info.mTranslation.x = out;
}
}
@ -183,7 +181,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
out = 1.f;
}
if (szTemp[0]) {
DefaultLogger::get()->info(szTemp);
ASSIMP_LOG_INFO(szTemp);
info.mTranslation.y = out;
}
}
@ -221,7 +219,7 @@ inline const char* MappingModeToChar(aiTextureMapMode map)
// ------------------------------------------------------------------------------------------------
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
@ -416,7 +414,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
++it2;
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;
}
@ -449,10 +447,8 @@ void TextureTransformStep::Execute( aiScene* pScene)
if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) {
if (!DefaultLogger::isNullLogger()) {
::ai_snprintf(buffer,1024,"%u UV channels required but just %u available",
static_cast<unsigned int>(trafo.size()),AI_MAX_NUMBER_OF_TEXTURECOORDS);
DefaultLogger::get()->error(buffer);
ASSIMP_LOG_ERROR_F(static_cast<unsigned int>(trafo.size()), " UV channels required but just ",
AI_MAX_NUMBER_OF_TEXTURECOORDS, " available");
}
size = AI_MAX_NUMBER_OF_TEXTURECOORDS;
}
@ -487,7 +483,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
MappingModeToChar ((*it).mapU),
MappingModeToChar ((*it).mapV));
DefaultLogger::get()->info(buffer);
ASSIMP_LOG_INFO(buffer);
}
// Check whether we need a new buffer here
@ -560,12 +556,10 @@ void TextureTransformStep::Execute( aiScene* pScene)
if (!DefaultLogger::isNullLogger()) {
if (transformedChannels) {
::ai_snprintf(buffer,1024,"TransformUVCoordsProcess end: %u output channels (in: %u, modified: %u)",
outChannels,inChannels,transformedChannels);
DefaultLogger::get()->info(buffer);
ASSIMP_LOG_INFO_F("TransformUVCoordsProcess end: ", outChannels, " output channels (in: ", inChannels, ", modified: ", transformedChannels,")");
} else {
ASSIMP_LOG_DEBUG("TransformUVCoordsProcess finished");
}
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.
void TriangulateProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("TriangulateProcess begin");
ASSIMP_LOG_DEBUG("TriangulateProcess begin");
bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
@ -110,13 +110,12 @@ void TriangulateProcess::Execute( aiScene* pScene)
}
}
if ( bHas ) {
DefaultLogger::get()->info( "TriangulateProcess finished. All polygons have been triangulated." );
ASSIMP_LOG_INFO( "TriangulateProcess finished. All polygons have been triangulated." );
} 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.
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
// 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
fprintf(fout,"critical error here, no ear found! ");
@ -488,7 +487,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
// drop dumb 0-area triangles
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;
delete[] f->mIndices;

View File

@ -206,7 +206,7 @@ inline void ValidateDSProcess::DoValidationWithNameCheck(T** array,
void ValidateDSProcess::Execute( aiScene* pScene)
{
this->mScene = pScene;
DefaultLogger::get()->debug("ValidateDataStructureProcess begin");
ASSIMP_LOG_DEBUG("ValidateDataStructureProcess begin");
// validate the node graph of the scene
Validate(pScene->mRootNode);
@ -273,7 +273,7 @@ void ValidateDSProcess::Execute( aiScene* pScene)
}
// 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 ) {
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;
}

View File

@ -255,7 +255,7 @@ XFileParser::XFileParser( const std::vector<char>& pBuffer)
// FIXME: we don't need the compressed data anymore, could release
// 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
}
else
@ -322,11 +322,11 @@ void XFileParser::ParseFile()
if( objectName == "}")
{
// whatever?
DefaultLogger::get()->warn("} found in dataObject");
ASSIMP_LOG_WARN("} found in dataObject");
} else
{
// 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();
}
}
@ -422,7 +422,7 @@ void XFileParser::ParseDataObjectFrame( Node* pParent)
ParseDataObjectMesh( mesh);
} else
{
DefaultLogger::get()->warn("Unknown data object in frame in x file");
ASSIMP_LOG_WARN("Unknown data object in frame in x file");
ParseUnknownDataObject();
}
}
@ -509,7 +509,7 @@ void XFileParser::ParseDataObjectMesh( Mesh* pMesh)
ParseDataObjectSkinWeights( pMesh);
else
{
DefaultLogger::get()->warn("Unknown data object in mesh in x file");
ASSIMP_LOG_WARN("Unknown data object in mesh in x file");
ParseUnknownDataObject();
}
}
@ -719,7 +719,7 @@ void XFileParser::ParseDataObjectMeshMaterialList( Mesh* pMesh)
// ignore
} 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();
}
}
@ -767,7 +767,7 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial)
pMaterial->mTextures.push_back( TexEntry( texname, true));
} else
{
DefaultLogger::get()->warn("Unknown data object in material in x file");
ASSIMP_LOG_WARN("Unknown data object in material in x file");
ParseUnknownDataObject();
}
}
@ -805,7 +805,7 @@ void XFileParser::ParseDataObjectAnimationSet()
ParseDataObjectAnimation( anim);
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();
}
}
@ -842,7 +842,7 @@ void XFileParser::ParseDataObjectAnimation( Animation* pAnim)
CheckForClosingBrace();
} else
{
DefaultLogger::get()->warn("Unknown data object in animation in x file");
ASSIMP_LOG_WARN("Unknown data object in animation in x file");
ParseUnknownDataObject();
}
}
@ -950,7 +950,7 @@ void XFileParser::ParseDataObjectTextureFilename( std::string& pName)
// FIX: some files (e.g. AnimationTest.x) have "" as texture file name
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

View File

@ -64,28 +64,28 @@ public:
// ------------------------------------------------------------------------------------------------
static void LogWarn(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->warn(Prefix()+(std::string)message);
ASSIMP_LOG_WARN(Prefix()+(std::string)message);
}
}
// ------------------------------------------------------------------------------------------------
static void LogError(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->error(Prefix()+(std::string)message);
ASSIMP_LOG_ERROR(Prefix()+(std::string)message);
}
}
// ------------------------------------------------------------------------------------------------
static void LogInfo(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->info(Prefix()+(std::string)message);
ASSIMP_LOG_INFO(Prefix()+(std::string)message);
}
}
// ------------------------------------------------------------------------------------------------
static void LogDebug(const Formatter::format& message) {
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();
};
} // ! Assimp
#endif