INtroduce new log macros.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user