INtroduce new log macros.

This commit is contained in:
kimkulling
2018-04-26 14:10:18 +02:00
parent 0e15b25cd1
commit 30c20eb5fc
65 changed files with 413 additions and 531 deletions

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));