Next log call changes.

pull/1918/head
kimkulling 2018-04-20 16:23:24 +02:00
parent b6f29bf54f
commit 0e15b25cd1
28 changed files with 247 additions and 276 deletions

View File

@ -230,7 +230,7 @@ casu_cres:
if(!skipped_before[sk_idx]) if(!skipped_before[sk_idx])
{ {
skipped_before[sk_idx] = true; skipped_before[sk_idx] = true;
LogWarning("Skipping node \"" + nn + "\" in " + pParentNodeName + "."); ASSIMP_LOG_WARN_F("Skipping node \"", nn, "\" in ", pParentNodeName, ".");
} }
} }

View File

@ -358,18 +358,6 @@ private:
/************** Functions: LOG set *************/ /************** Functions: LOG set *************/
/***********************************************/ /***********************************************/
/// \fn void LogInfo(const std::string& pMessage)
/// Short variant for calling \ref DefaultLogger::get()->info()
void LogInfo(const std::string& pMessage) { DefaultLogger::get()->info(pMessage); }
/// \fn void LogWarning(const std::string& pMessage)
/// Short variant for calling \ref DefaultLogger::get()->warn()
void LogWarning(const std::string& pMessage) { DefaultLogger::get()->warn(pMessage); }
/// \fn void LogError(const std::string& pMessage)
/// Short variant for calling \ref DefaultLogger::get()->error()
void LogError(const std::string& pMessage) { DefaultLogger::get()->error(pMessage); }
/***********************************************/ /***********************************************/
/************** Functions: XML set *************/ /************** Functions: XML set *************/
/***********************************************/ /***********************************************/

View File

@ -509,22 +509,22 @@ void COBImporter::LogDebug_Ascii(const LineSplitter& splitter, const format& mes
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void COBImporter::LogWarn_Ascii(const Formatter::format& message) { void COBImporter::LogWarn_Ascii(const Formatter::format& message) {
DefaultLogger::get()->warn(std::string("COB: ")+=message); ASSIMP_LOG_WARN_F( "COB: ", message );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void COBImporter::LogError_Ascii(const Formatter::format& message) { void COBImporter::LogError_Ascii(const Formatter::format& message) {
DefaultLogger::get()->error(std::string("COB: ")+=message); ASSIMP_LOG_ERROR_F( "COB: ", message);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void COBImporter::LogInfo_Ascii(const Formatter::format& message) { void COBImporter::LogInfo_Ascii(const Formatter::format& message) {
DefaultLogger::get()->info(std::string("COB: ")+=message); ASSIMP_LOG_INFO_F("COB: ", message);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void COBImporter::LogDebug_Ascii(const Formatter::format& message) { void COBImporter::LogDebug_Ascii(const Formatter::format& message) {
DefaultLogger::get()->debug(std::string("COB: ")+=message); ASSIMP_LOG_DEBUG_F("COB: ", message);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -233,7 +233,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
if (TokenMatchI(buffer, "DROPOUT", 7)) { if (TokenMatchI(buffer, "DROPOUT", 7)) {
// seems this is invalid marker data; at least the doc says it's possible // seems this is invalid marker data; at least the doc says it's possible
DefaultLogger::get()->warn("CSM: Encountered invalid marker data (DROPOUT)"); ASSIMP_LOG_WARN("CSM: Encountered invalid marker data (DROPOUT)");
} }
else { else {
aiVectorKey* sub = s->mPositionKeys + s->mNumPositionKeys; aiVectorKey* sub = s->mPositionKeys + s->mNumPositionKeys;

View File

@ -200,7 +200,7 @@ void DXFImporter::InternReadFile( const std::string& pFile,
// comments // comments
else if (reader.Is(999)) { else if (reader.Is(999)) {
DefaultLogger::get()->info("DXF Comment: " + reader.Value()); ASSIMP_LOG_INFO_F("DXF Comment: ", reader.Value());
} }
// don't read past the official EOF sign // don't read past the official EOF sign
@ -393,7 +393,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// XXX rotation currently ignored - I didn't find an appropriate sample model. // XXX rotation currently ignored - I didn't find an appropriate sample model.
if (insert.angle != 0.f) { if (insert.angle != 0.f) {
DefaultLogger::get()->warn("DXF: BLOCK rotation not currently implemented"); ASSIMP_LOG_WARN("DXF: BLOCK rotation not currently implemented");
} }
for (aiVector3D& v : pl_out->positions) { for (aiVector3D& v : pl_out->positions) {
@ -523,7 +523,7 @@ void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output)
// XXX is this a valid case? // XXX is this a valid case?
if (reader.Is(0,"INSERT")) { if (reader.Is(0,"INSERT")) {
DefaultLogger::get()->warn("DXF: INSERT within a BLOCK not currently supported; skipping"); ASSIMP_LOG_WARN("DXF: INSERT within a BLOCK not currently supported; skipping");
for( ;!reader.End() && !reader.Is(0,"ENDBLK"); ++reader); for( ;!reader.End() && !reader.Is(0,"ENDBLK"); ++reader);
break; break;
} }
@ -678,16 +678,15 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
//} //}
if (vguess && line.positions.size() != vguess) { if (vguess && line.positions.size() != vguess) {
DefaultLogger::get()->warn((Formatter::format("DXF: unexpected vertex count in polymesh: "), ASSIMP_LOG_WARN_F("DXF: unexpected vertex count in polymesh: ",
line.positions.size(),", expected ", vguess line.positions.size(),", expected ", vguess );
));
} }
if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH ) { if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH ) {
if (line.positions.size() < 3 || line.indices.size() < 3) { if (line.positions.size() < 3 || line.indices.size() < 3) {
DefaultLogger::get()->warn("DXF: not enough vertices for polymesh; ignoring"); ASSIMP_LOG_WARN("DXF: not enough vertices for polymesh; ignoring");
output.blocks.back().lines.pop_back(); output.blocks.back().lines.pop_back();
return; return;
} }
// if these numbers are wrong, parsing might have gone wild. // if these numbers are wrong, parsing might have gone wild.
@ -695,13 +694,11 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
// to set the 71 and 72 fields, respectively, to valid values. // to set the 71 and 72 fields, respectively, to valid values.
// So just fire a warning. // So just fire a warning.
if (iguess && line.counts.size() != iguess) { if (iguess && line.counts.size() != iguess) {
DefaultLogger::get()->warn((Formatter::format("DXF: unexpected face count in polymesh: "), ASSIMP_LOG_WARN_F( "DXF: unexpected face count in polymesh: ", line.counts.size(),", expected ", iguess );
line.counts.size(),", expected ", iguess
));
} }
} }
else if (!line.indices.size() && !line.counts.size()) { else if (!line.indices.size() && !line.counts.size()) {
// a polyline - so there are no indices yet. // a poly-line - so there are no indices yet.
size_t guess = line.positions.size() + (line.flags & DXF_POLYLINE_FLAG_CLOSED ? 1 : 0); size_t guess = line.positions.size() + (line.flags & DXF_POLYLINE_FLAG_CLOSED ? 1 : 0);
line.indices.reserve(guess); line.indices.reserve(guess);
@ -743,10 +740,10 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
{ {
case 8: case 8:
// layer to which the vertex belongs to - assume that // layer to which the vertex belongs to - assume that
// this is always the layer the top-level polyline // this is always the layer the top-level poly-line
// entity resides on as well. // entity resides on as well.
if(reader.Value() != line.layer) { if(reader.Value() != line.layer) {
DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set"); ASSIMP_LOG_WARN("DXF: expected vertex to be part of a poly-face but the 0x128 flag isn't set");
} }
break; break;
@ -765,7 +762,7 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
case 73: case 73:
case 74: case 74:
if (cnti == 4) { if (cnti == 4) {
DefaultLogger::get()->warn("DXF: more than 4 indices per face not supported; ignoring"); ASSIMP_LOG_WARN("DXF: more than 4 indices per face not supported; ignoring");
break; break;
} }
indices[cnti++] = reader.ValueAsUnsignedInt(); indices[cnti++] = reader.ValueAsUnsignedInt();
@ -781,7 +778,7 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
} }
if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH && !(flags & DXF_VERTEX_FLAG_PART_OF_POLYFACE)) { if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH && !(flags & DXF_VERTEX_FLAG_PART_OF_POLYFACE)) {
DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set"); ASSIMP_LOG_WARN("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set");
} }
if (cnti) { if (cnti) {
@ -789,7 +786,7 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
for (unsigned int i = 0; i < cnti; ++i) { for (unsigned int i = 0; i < cnti; ++i) {
// IMPORTANT NOTE: POLYMESH indices are ONE-BASED // IMPORTANT NOTE: POLYMESH indices are ONE-BASED
if (indices[i] == 0) { if (indices[i] == 0) {
DefaultLogger::get()->warn("DXF: invalid vertex index, indices are one-based."); ASSIMP_LOG_WARN("DXF: invalid vertex index, indices are one-based.");
--line.counts.back(); --line.counts.back();
continue; continue;
} }
@ -906,7 +903,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
// sanity checks to see if we got something meaningful // sanity checks to see if we got something meaningful
if ((b[1] && !b[0]) || !b[2] || !b[3]) { if ((b[1] && !b[0]) || !b[2] || !b[3]) {
DefaultLogger::get()->warn("DXF: unexpected vertex setup in 3DFACE/LINE/FACE entity; ignoring"); ASSIMP_LOG_WARN("DXF: unexpected vertex setup in 3DFACE/LINE/FACE entity; ignoring");
output.blocks.back().lines.pop_back(); output.blocks.back().lines.pop_back();
return; return;
} }

View File

@ -363,7 +363,7 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c
} }
if (verbosify || (exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) { if (verbosify || (exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) {
DefaultLogger::get()->debug("export: Scene data not in verbose format, applying MakeVerboseFormat step first"); ASSIMP_LOG_DEBUG("export: Scene data not in verbose format, applying MakeVerboseFormat step first");
MakeVerboseFormatProcess proc; MakeVerboseFormatProcess proc;
proc.Execute(scenecopy.get()); proc.Execute(scenecopy.get());

View File

@ -214,7 +214,7 @@ const Object* LazyObject::Get(bool dieOnError)
// note: the error message is already formatted, so raw logging is ok // note: the error message is already formatted, so raw logging is ok
if(!DefaultLogger::isNullLogger()) { if(!DefaultLogger::isNullLogger()) {
DefaultLogger::get()->error(ex.what()); ASSIMP_LOG_ERROR(ex.what());
} }
return NULL; return NULL;
} }

View File

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

View File

@ -1124,7 +1124,7 @@ void FBXExporter::WriteObjects ()
err << " has " << m->mNumUVComponents[uvi]; err << " has " << m->mNumUVComponents[uvi];
err << " components! Data will be preserved,"; err << " components! Data will be preserved,";
err << " but may be incorrectly interpreted on load."; err << " but may be incorrectly interpreted on load.";
DefaultLogger::get()->warn(err.str()); ASSIMP_LOG_WARN(err.str());
} }
FBX::Node uv("LayerElementUV", int32_t(uvi)); FBX::Node uv("LayerElementUV", int32_t(uvi));
uv.Begin(outstream, binary, indent); uv.Begin(outstream, binary, indent);
@ -1449,7 +1449,7 @@ void FBXExporter::WriteObjects ()
err << "Multilayer textures not supported (for now),"; err << "Multilayer textures not supported (for now),";
err << " skipping texture type " << j; err << " skipping texture type " << j;
err << " of material " << i; err << " of material " << i;
DefaultLogger::get()->warn(err.str()); ASSIMP_LOG_WARN(err.str());
} }
// get image path for this (single-image) texture // get image path for this (single-image) texture
@ -1484,7 +1484,7 @@ void FBXExporter::WriteObjects ()
err << "Not sure how to handle texture of type " << j; err << "Not sure how to handle texture of type " << j;
err << " on material " << i; err << " on material " << i;
err << ", skipping..."; err << ", skipping...";
DefaultLogger::get()->warn(err.str()); ASSIMP_LOG_WARN(err.str());
continue; continue;
} }
const std::string& prop_name = elem2->second; const std::string& prop_name = elem2->second;

View File

@ -131,7 +131,7 @@ void IRRImporter::SetupProperties(const Importer* pImp)
// read the output frame rate of all node animation channels // read the output frame rate of all node animation channels
fps = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IRR_ANIM_FPS,100); fps = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IRR_ANIM_FPS,100);
if (fps < 10.) { if (fps < 10.) {
DefaultLogger::get()->error("IRR: Invalid FPS configuration"); ASSIMP_LOG_ERROR("IRR: Invalid FPS configuration");
fps = 100; fps = 100;
} }
@ -281,7 +281,7 @@ void IRRImporter::CopyMaterial(std::vector<aiMaterial*>& materials,
return; return;
} }
else if (inmaterials.size() > 1) { else if (inmaterials.size() > 1) {
DefaultLogger::get()->info("IRR: Skipping additional materials"); ASSIMP_LOG_INFO("IRR: Skipping additional materials");
} }
mesh->mMaterialIndex = (unsigned int)materials.size(); mesh->mMaterialIndex = (unsigned int)materials.size();
@ -319,17 +319,18 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
if (root->animators.empty()) { if (root->animators.empty()) {
return; return;
} }
unsigned int total = 0; unsigned int total( 0 );
for (std::list<Animator>::iterator it = root->animators.begin();it != root->animators.end(); ++it) { for (std::list<Animator>::iterator it = root->animators.begin();it != root->animators.end(); ++it) {
if ((*it).type == Animator::UNKNOWN || (*it).type == Animator::OTHER) { if ((*it).type == Animator::UNKNOWN || (*it).type == Animator::OTHER) {
DefaultLogger::get()->warn("IRR: Skipping unknown or unsupported animator"); ASSIMP_LOG_WARN("IRR: Skipping unknown or unsupported animator");
continue; continue;
} }
++total; ++total;
} }
if (!total)return; if (!total) {
else if (1 == total) { return;
DefaultLogger::get()->warn("IRR: Adding dummy nodes to simulate multiple animators"); } else if (1 == total) {
ASSIMP_LOG_WARN("IRR: Adding dummy nodes to simulate multiple animators");
} }
// NOTE: 1 tick == i millisecond // NOTE: 1 tick == i millisecond
@ -518,9 +519,9 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
const int size = (int)in.splineKeys.size(); const int size = (int)in.splineKeys.size();
if (!size) { if (!size) {
// We have no point in the spline. That's bad. Really bad. // We have no point in the spline. That's bad. Really bad.
DefaultLogger::get()->warn("IRR: Spline animators with no points defined"); ASSIMP_LOG_WARN("IRR: Spline animators with no points defined");
delete anim;anim = NULL; delete anim;anim = nullptr;
break; break;
} }
else if (size == 1) { else if (size == 1) {
@ -672,7 +673,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// graph we're currently building // graph we're currently building
aiScene* scene = batch.GetImport(root->id); aiScene* scene = batch.GetImport(root->id);
if (!scene) { if (!scene) {
DefaultLogger::get()->error("IRR: Unable to load external file: " + root->meshPath); ASSIMP_LOG_ERROR("IRR: Unable to load external file: " + root->meshPath);
break; break;
} }
attach.push_back(AttachmentInfo(scene,rootOut)); attach.push_back(AttachmentInfo(scene,rootOut));
@ -683,7 +684,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// should be equal. If they are not, we can impossibly // should be equal. If they are not, we can impossibly
// do this ... // do this ...
if (root->materials.size() != (unsigned int)scene->mNumMaterials) { if (root->materials.size() != (unsigned int)scene->mNumMaterials) {
DefaultLogger::get()->warn("IRR: Failed to match imported materials " ASSIMP_LOG_WARN("IRR: Failed to match imported materials "
"with the materials found in the IRR scene file"); "with the materials found in the IRR scene file");
break; break;
@ -722,7 +723,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
} }
} }
if (bdo) { if (bdo) {
DefaultLogger::get()->info("IRR: Replacing mesh vertex alpha with common opacity"); ASSIMP_LOG_INFO("IRR: Replacing mesh vertex alpha with common opacity");
for (unsigned int a = 0; a < mesh->mNumVertices;++a) for (unsigned int a = 0; a < mesh->mNumVertices;++a)
mesh->mColors[0][a].a = 1.f; mesh->mColors[0][a].a = 1.f;
@ -806,7 +807,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
{ {
// A skybox is defined by six materials // A skybox is defined by six materials
if (root->materials.size() < 6) { if (root->materials.size() < 6) {
DefaultLogger::get()->error("IRR: There should be six materials for a skybox"); ASSIMP_LOG_ERROR("IRR: There should be six materials for a skybox");
break; break;
} }
@ -823,7 +824,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// for IRR skyboxes. We add a 'IRR.SkyBox_' prefix to the node. // for IRR skyboxes. We add a 'IRR.SkyBox_' prefix to the node.
// ************************************************************* // *************************************************************
root->name = "IRR.SkyBox_" + root->name; root->name = "IRR.SkyBox_" + root->name;
DefaultLogger::get()->info("IRR: Loading skybox, this will " ASSIMP_LOG_INFO("IRR: Loading skybox, this will "
"require special handling to be displayed correctly"); "require special handling to be displayed correctly");
} }
break; break;
@ -831,7 +832,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
case Node::TERRAIN: case Node::TERRAIN:
{ {
// to support terrains, we'd need to have a texture decoder // to support terrains, we'd need to have a texture decoder
DefaultLogger::get()->error("IRR: Unsupported node - TERRAIN"); ASSIMP_LOG_ERROR("IRR: Unsupported node - TERRAIN");
} }
break; break;
default: default:
@ -1010,11 +1011,11 @@ void IRRImporter::InternReadFile( const std::string& pFile,
} }
else if (!ASSIMP_stricmp(sz,"billBoard")) { else if (!ASSIMP_stricmp(sz,"billBoard")) {
// We don't support billboards, so ignore them // We don't support billboards, so ignore them
DefaultLogger::get()->error("IRR: Billboards are not supported by Assimp"); ASSIMP_LOG_ERROR("IRR: Billboards are not supported by Assimp");
nd = new Node(Node::DUMMY); nd = new Node(Node::DUMMY);
} }
else { else {
DefaultLogger::get()->warn("IRR: Found unknown node: " + std::string(sz)); ASSIMP_LOG_WARN("IRR: Found unknown node: " + std::string(sz));
/* We skip the contents of nodes we don't know. /* We skip the contents of nodes we don't know.
* We parse the transformation and all animators * We parse the transformation and all animators
@ -1041,7 +1042,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
*/ */
if (!curNode) { if (!curNode) {
#if 0 #if 0
DefaultLogger::get()->error("IRR: Encountered <attributes> element, but " ASSIMP_LOG_ERROR("IRR: Encountered <attributes> element, but "
"there is no node active"); "there is no node active");
#endif #endif
continue; continue;
@ -1269,7 +1270,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
lights.pop_back(); lights.pop_back();
curNode->type = Node::DUMMY; curNode->type = Node::DUMMY;
DefaultLogger::get()->error("Ignoring light of unknown type: " + prop.value); ASSIMP_LOG_ERROR("Ignoring light of unknown type: " + prop.value);
} }
} }
else if ((prop.name == "Mesh" && Node::MESH == curNode->type) || else if ((prop.name == "Mesh" && Node::MESH == curNode->type) ||
@ -1277,7 +1278,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
{ {
/* This is the file name of the mesh - either /* This is the file name of the mesh - either
* animated or not. We need to make sure we setup * animated or not. We need to make sure we setup
* the correct postprocessing settings here. * the correct post-processing settings here.
*/ */
unsigned int pp = 0; unsigned int pp = 0;
BatchLoader::PropertyMap map; BatchLoader::PropertyMap map;
@ -1299,7 +1300,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
const std::string extension = GetExtension(prop.value); const std::string extension = GetExtension(prop.value);
if ("irr" == extension) { if ("irr" == extension) {
DefaultLogger::get()->error("IRR: Can't load another IRR file recursively"); ASSIMP_LOG_ERROR("IRR: Can't load another IRR file recursively");
} }
else else
{ {
@ -1323,7 +1324,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
curAnim->type = Animator::FOLLOW_SPLINE; curAnim->type = Animator::FOLLOW_SPLINE;
} }
else { else {
DefaultLogger::get()->warn("IRR: Ignoring unknown animator: " ASSIMP_LOG_WARN("IRR: Ignoring unknown animator: "
+ prop.value); + prop.value);
curAnim->type = Animator::UNKNOWN; curAnim->type = Animator::UNKNOWN;
@ -1348,7 +1349,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
// back in the node hierarchy // back in the node hierarchy
if (!curParent) { if (!curParent) {
curParent = root; curParent = root;
DefaultLogger::get()->error("IRR: Too many closing <node> elements"); ASSIMP_LOG_ERROR("IRR: Too many closing <node> elements");
} }
else curParent = curParent->parent; else curParent = curParent->parent;
} }
@ -1369,15 +1370,14 @@ void IRRImporter::InternReadFile( const std::string& pFile,
} }
} }
/* Now iterate through all cameras and compute their final (horizontal) FOV // Now iterate through all cameras and compute their final (horizontal) FOV
*/
for (aiCamera *cam : cameras) { for (aiCamera *cam : cameras) {
// screen aspect could be missing // screen aspect could be missing
if (cam->mAspect) { if (cam->mAspect) {
cam->mHorizontalFOV *= cam->mAspect; cam->mHorizontalFOV *= cam->mAspect;
} else {
ASSIMP_LOG_WARN("IRR: Camera aspect is not given, can't compute horizontal FOV");
} }
else DefaultLogger::get()->warn("IRR: Camera aspect is not given, can't compute horizontal FOV");
} }
batch.LoadAll(); batch.LoadAll();
@ -1472,7 +1472,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
* models from external files * models from external files
*/ */
if (!pScene->mNumMeshes || !pScene->mNumMaterials) { if (!pScene->mNumMeshes || !pScene->mNumMaterials) {
DefaultLogger::get()->warn("IRR: No meshes loaded, setting AI_SCENE_FLAGS_INCOMPLETE"); ASSIMP_LOG_WARN("IRR: No meshes loaded, setting AI_SCENE_FLAGS_INCOMPLETE");
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE; pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
} }

View File

@ -175,7 +175,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
if (!ASSIMP_stricmp(reader->getNodeName(),"buffer") && (curMat || curMesh)) { if (!ASSIMP_stricmp(reader->getNodeName(),"buffer") && (curMat || curMesh)) {
// end of previous buffer. A material and a mesh should be there // end of previous buffer. A material and a mesh should be there
if ( !curMat || !curMesh) { if ( !curMat || !curMesh) {
DefaultLogger::get()->error("IRRMESH: A buffer must contain a mesh and a material"); ASSIMP_LOG_ERROR("IRRMESH: A buffer must contain a mesh and a material");
releaseMaterial( &curMat ); releaseMaterial( &curMat );
releaseMesh( &curMesh ); releaseMesh( &curMesh );
} else { } else {
@ -197,7 +197,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
if (!ASSIMP_stricmp(reader->getNodeName(),"material")) { if (!ASSIMP_stricmp(reader->getNodeName(),"material")) {
if (curMat) { if (curMat) {
DefaultLogger::get()->warn("IRRMESH: Only one material description per buffer, please"); ASSIMP_LOG_WARN("IRRMESH: Only one material description per buffer, please");
releaseMaterial( &curMat ); releaseMaterial( &curMat );
} }
curMat = ParseMaterial(curMatFlags); curMat = ParseMaterial(curMatFlags);
@ -208,7 +208,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
if (!num) { if (!num) {
// This is possible ... remove the mesh from the list and skip further reading // This is possible ... remove the mesh from the list and skip further reading
DefaultLogger::get()->warn("IRRMESH: Found mesh with zero vertices"); ASSIMP_LOG_WARN("IRRMESH: Found mesh with zero vertices");
releaseMaterial( &curMat ); releaseMaterial( &curMat );
releaseMesh( &curMesh ); releaseMesh( &curMesh );
@ -255,7 +255,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
} }
else if (ASSIMP_stricmp("standard", t)) { else if (ASSIMP_stricmp("standard", t)) {
releaseMaterial( &curMat ); releaseMaterial( &curMat );
DefaultLogger::get()->warn("IRRMESH: Unknown vertex format"); ASSIMP_LOG_WARN("IRRMESH: Unknown vertex format");
} }
else vertexFormat = 0; else vertexFormat = 0;
textMeaning = 1; textMeaning = 1;
@ -275,7 +275,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
curMesh->mNumVertices = reader->getAttributeValueAsInt("indexCount"); curMesh->mNumVertices = reader->getAttributeValueAsInt("indexCount");
if (!curMesh->mNumVertices) { if (!curMesh->mNumVertices) {
// This is possible ... remove the mesh from the list and skip further reading // This is possible ... remove the mesh from the list and skip further reading
DefaultLogger::get()->warn("IRRMESH: Found mesh with zero indices"); ASSIMP_LOG_WARN("IRRMESH: Found mesh with zero indices");
// mesh - away // mesh - away
releaseMesh( &curMesh ); releaseMesh( &curMesh );
@ -288,7 +288,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
} }
if (curMesh->mNumVertices % 3) { if (curMesh->mNumVertices % 3) {
DefaultLogger::get()->warn("IRRMESH: Number if indices isn't divisible by 3"); ASSIMP_LOG_WARN("IRRMESH: Number if indices isn't divisible by 3");
} }
curMesh->mNumFaces = curMesh->mNumVertices / 3; curMesh->mNumFaces = curMesh->mNumVertices / 3;
@ -439,7 +439,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
unsigned int total = 0; unsigned int total = 0;
while(SkipSpacesAndLineEnd(&sz)) { while(SkipSpacesAndLineEnd(&sz)) {
if (curFace >= faceEnd) { if (curFace >= faceEnd) {
DefaultLogger::get()->error("IRRMESH: Too many indices"); ASSIMP_LOG_ERROR("IRRMESH: Too many indices");
break; break;
} }
if (!curIdx) { if (!curIdx) {
@ -449,7 +449,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
unsigned int idx = strtoul10(sz,&sz); unsigned int idx = strtoul10(sz,&sz);
if (idx >= curVertices.size()) { if (idx >= curVertices.size()) {
DefaultLogger::get()->error("IRRMESH: Index out of range"); ASSIMP_LOG_ERROR("IRRMESH: Index out of range");
idx = 0; idx = 0;
} }
@ -492,7 +492,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
// End of the last buffer. A material and a mesh should be there // End of the last buffer. A material and a mesh should be there
if (curMat || curMesh) { if (curMat || curMesh) {
if ( !curMat || !curMesh) { if ( !curMat || !curMesh) {
DefaultLogger::get()->error("IRRMESH: A buffer must contain a mesh and a material"); ASSIMP_LOG_ERROR("IRRMESH: A buffer must contain a mesh and a material");
releaseMaterial( &curMat ); releaseMaterial( &curMat );
releaseMesh( &curMesh ); releaseMesh( &curMesh );
} }

View File

@ -179,14 +179,14 @@ void IrrlichtBase::ReadVectorProperty (VectorProperty& out)
SkipSpaces(&ptr); SkipSpaces(&ptr);
if (',' != *ptr) if (',' != *ptr)
{ {
DefaultLogger::get()->error("IRR(MESH): Expected comma in vector definition"); ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
} }
else SkipSpaces(ptr+1,&ptr); else SkipSpaces(ptr+1,&ptr);
ptr = fast_atoreal_move<float>( ptr,(float&)out.value.y ); ptr = fast_atoreal_move<float>( ptr,(float&)out.value.y );
SkipSpaces(&ptr); SkipSpaces(&ptr);
if (',' != *ptr) if (',' != *ptr)
{ {
DefaultLogger::get()->error("IRR(MESH): Expected comma in vector definition"); ASSIMP_LOG_ERROR("IRR(MESH): Expected comma in vector definition");
} }
else SkipSpaces(ptr+1,&ptr); else SkipSpaces(ptr+1,&ptr);
ptr = fast_atoreal_move<float>( ptr,(float&)out.value.z ); ptr = fast_atoreal_move<float>( ptr,(float&)out.value.z );
@ -360,7 +360,7 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags)
matFlags = AI_IRRMESH_MAT_normalmap_ta; matFlags = AI_IRRMESH_MAT_normalmap_ta;
} }
else { else {
DefaultLogger::get()->warn("IRRMat: Unrecognized material type: " + prop.value); ASSIMP_LOG_WARN("IRRMat: Unrecognized material type: " + prop.value);
} }
} }
@ -391,9 +391,7 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags)
// set the corresponding material flag // set the corresponding material flag
matFlags |= AI_IRRMESH_EXTRA_2ND_TEXTURE; matFlags |= AI_IRRMESH_EXTRA_2ND_TEXTURE;
} } else if (matFlags & AI_IRRMESH_MAT_solid_2layer) {// or just as second diffuse texture
// or just as second diffuse texture
else if (matFlags & AI_IRRMESH_MAT_solid_2layer) {
++cnt; ++cnt;
s.Set(prop.value); s.Set(prop.value);
mat->AddProperty(&s,AI_MATKEY_TEXTURE_DIFFUSE(1)); mat->AddProperty(&s,AI_MATKEY_TEXTURE_DIFFUSE(1));
@ -401,19 +399,15 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags)
// set the corresponding material flag // set the corresponding material flag
matFlags |= AI_IRRMESH_EXTRA_2ND_TEXTURE; matFlags |= AI_IRRMESH_EXTRA_2ND_TEXTURE;
} else {
ASSIMP_LOG_WARN("IRRmat: Skipping second texture");
} }
else DefaultLogger::get()->warn("IRRmat: Skipping second texture"); } else if (prop.name == "Texture3" && cnt == 2) {
}
else if (prop.name == "Texture3" && cnt == 2)
{
// Irrlicht does not seem to use these channels. // Irrlicht does not seem to use these channels.
++cnt; ++cnt;
s.Set(prop.value); s.Set(prop.value);
mat->AddProperty(&s,AI_MATKEY_TEXTURE_DIFFUSE(nd+1)); mat->AddProperty(&s,AI_MATKEY_TEXTURE_DIFFUSE(nd+1));
} } else if (prop.name == "Texture4" && cnt == 3) {
else if (prop.name == "Texture4" && cnt == 3)
{
// Irrlicht does not seem to use these channels. // Irrlicht does not seem to use these channels.
++cnt; ++cnt;
s.Set(prop.value); s.Set(prop.value);
@ -499,7 +493,8 @@ aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags)
break; break;
} }
} }
DefaultLogger::get()->error("IRRMESH: Unexpected end of file. Material is not complete"); ASSIMP_LOG_ERROR("IRRMESH: Unexpected end of file. Material is not complete");
return mat; return mat;
} }

View File

@ -504,62 +504,50 @@ const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void WriteLogOpening(const std::string& file) void WriteLogOpening(const std::string& file)
{ {
Logger* l = DefaultLogger::get(); ASSIMP_LOG_INFO_F("Load ", file);
if (!l) {
return;
}
l->info("Load " + file);
// print a full version dump. This is nice because we don't // print a full version dump. This is nice because we don't
// need to ask the authors of incoming bug reports for // need to ask the authors of incoming bug reports for
// the library version they're using - a log dump is // the library version they're using - a log dump is
// sufficient. // sufficient.
const unsigned int flags = aiGetCompileFlags(); const unsigned int flags = aiGetCompileFlags();
l->debug(format() ASSIMP_LOG_DEBUG_F( "Assimp ", aiGetVersionMajor(), ".", aiGetVersionMinor(), ".", aiGetVersionRevision(), " "
<< "Assimp "
<< aiGetVersionMajor()
<< "."
<< aiGetVersionMinor()
<< "."
<< aiGetVersionRevision()
<< " "
#if defined(ASSIMP_BUILD_ARCHITECTURE) #if defined(ASSIMP_BUILD_ARCHITECTURE)
<< ASSIMP_BUILD_ARCHITECTURE ,ASSIMP_BUILD_ARCHITECTURE
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__) #elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
<< "x86" , "x86"
#elif defined(_M_X64) || defined(__x86_64__) #elif defined(_M_X64) || defined(__x86_64__)
<< "amd64" , "amd64"
#elif defined(_M_IA64) || defined(__ia64__) #elif defined(_M_IA64) || defined(__ia64__)
<< "itanium" , "itanium"
#elif defined(__ppc__) || defined(__powerpc__) #elif defined(__ppc__) || defined(__powerpc__)
<< "ppc32" , "ppc32"
#elif defined(__powerpc64__) #elif defined(__powerpc64__)
<< "ppc64" , "ppc64"
#elif defined(__arm__) #elif defined(__arm__)
<< "arm" , "arm"
#else #else
<< "<unknown architecture>" , "<unknown architecture>"
#endif #endif
<< " " , " "
#if defined(ASSIMP_BUILD_COMPILER) #if defined(ASSIMP_BUILD_COMPILER)
<< ASSIMP_BUILD_COMPILER , ASSIMP_BUILD_COMPILER
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
<< "msvc" , "msvc"
#elif defined(__GNUC__) #elif defined(__GNUC__)
<< "gcc" , "gcc"
#else #else
<< "<unknown compiler>" , "<unknown compiler>"
#endif #endif
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
<< " debug" , " debug"
#endif #endif
<< (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "") , (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
<< (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "") , (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
<< (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "") , (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "")
); );
} }

View File

@ -126,7 +126,7 @@ STEP::DB* STEP::ReadFileHeader(std::shared_ptr<IOStream> stream)
// XXX need support for multiple schemas? // XXX need support for multiple schemas?
if (list->GetSize() > 1) { if (list->GetSize() > 1) {
DefaultLogger::get()->warn(AddLineNumber("multiple schemas currently not supported",line)); ASSIMP_LOG_WARN(AddLineNumber("multiple schemas currently not supported",line));
} }
const EXPRESS::STRING* string( nullptr ); const EXPRESS::STRING* string( nullptr );
if (!list->GetSize() || !(string=dynamic_cast<const EXPRESS::STRING*>( (*list)[0].get() ))) { if (!list->GetSize() || !(string=dynamic_cast<const EXPRESS::STRING*>( (*list)[0].get() ))) {
@ -192,7 +192,7 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
// LineSplitter already ignores empty lines // LineSplitter already ignores empty lines
ai_assert(s.length()); ai_assert(s.length());
if (s[0] != '#') { if (s[0] != '#') {
DefaultLogger::get()->warn(AddLineNumber("expected token \'#\'",line)); ASSIMP_LOG_WARN(AddLineNumber("expected token \'#\'",line));
++splitter; ++splitter;
continue; continue;
} }
@ -202,14 +202,14 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
// --- // ---
const std::string::size_type n0 = s.find_first_of('='); const std::string::size_type n0 = s.find_first_of('=');
if (n0 == std::string::npos) { if (n0 == std::string::npos) {
DefaultLogger::get()->warn(AddLineNumber("expected token \'=\'",line)); ASSIMP_LOG_WARN(AddLineNumber("expected token \'=\'",line));
++splitter; ++splitter;
continue; continue;
} }
const uint64_t id = strtoul10_64(s.substr(1,n0-1).c_str()); const uint64_t id = strtoul10_64(s.substr(1,n0-1).c_str());
if (!id) { if (!id) {
DefaultLogger::get()->warn(AddLineNumber("expected positive, numeric entity id",line)); ASSIMP_LOG_WARN(AddLineNumber("expected positive, numeric entity id",line));
++splitter; ++splitter;
continue; continue;
} }
@ -236,7 +236,7 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
} }
if(!ok) { if(!ok) {
DefaultLogger::get()->warn(AddLineNumber("expected token \'(\'",line)); ASSIMP_LOG_WARN(AddLineNumber("expected token \'(\'",line));
continue; continue;
} }
} }
@ -263,13 +263,13 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
} }
} }
if(!ok) { if(!ok) {
DefaultLogger::get()->warn(AddLineNumber("expected token \')\'",line)); ASSIMP_LOG_WARN(AddLineNumber("expected token \')\'",line));
continue; continue;
} }
} }
if (map.find(id) != map.end()) { if (map.find(id) != map.end()) {
DefaultLogger::get()->warn(AddLineNumber((Formatter::format(),"an object with the id #",id," already exists"),line)); ASSIMP_LOG_WARN(AddLineNumber((Formatter::format(),"an object with the id #",id," already exists"),line));
} }
std::string::size_type ns = n0; std::string::size_type ns = n0;
@ -292,7 +292,7 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
} }
if (!splitter) { if (!splitter) {
DefaultLogger::get()->warn("STEP: ignoring unexpected EOF"); ASSIMP_LOG_WARN("STEP: ignoring unexpected EOF");
} }
if ( !DefaultLogger::isNullLogger()){ if ( !DefaultLogger::isNullLogger()){
@ -392,7 +392,7 @@ std::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*& i
std::string stemp = std::string(start, static_cast<size_t>(cur - start)); std::string stemp = std::string(start, static_cast<size_t>(cur - start));
if(!StringToUTF8(stemp)) { if(!StringToUTF8(stemp)) {
// TODO: route this to a correct logger with line numbers etc., better error messages // TODO: route this to a correct logger with line numbers etc., better error messages
DefaultLogger::get()->error("an error occurred reading escape sequences in ASCII text"); ASSIMP_LOG_ERROR("an error occurred reading escape sequences in ASCII text");
} }
return std::make_shared<EXPRESS::STRING>(stemp); return std::make_shared<EXPRESS::STRING>(stemp);

View File

@ -74,7 +74,7 @@ void LWOImporter::LoadLWOBFile()
case AI_LWO_PNTS: case AI_LWO_PNTS:
{ {
if (!mCurLayer->mTempPoints.empty()) if (!mCurLayer->mTempPoints.empty())
DefaultLogger::get()->warn("LWO: PNTS chunk encountered twice"); ASSIMP_LOG_WARN("LWO: PNTS chunk encountered twice");
else LoadLWOPoints(head.length); else LoadLWOPoints(head.length);
break; break;
} }
@ -83,7 +83,7 @@ void LWOImporter::LoadLWOBFile()
{ {
if (!mCurLayer->mFaces.empty()) if (!mCurLayer->mFaces.empty())
DefaultLogger::get()->warn("LWO: POLS chunk encountered twice"); ASSIMP_LOG_WARN("LWO: POLS chunk encountered twice");
else LoadLWOBPolygons(head.length); else LoadLWOBPolygons(head.length);
break; break;
} }
@ -91,7 +91,7 @@ void LWOImporter::LoadLWOBFile()
case AI_LWO_SRFS: case AI_LWO_SRFS:
{ {
if (!mTags->empty()) if (!mTags->empty())
DefaultLogger::get()->warn("LWO: SRFS chunk encountered twice"); ASSIMP_LOG_WARN("LWO: SRFS chunk encountered twice");
else LoadLWOTags(head.length); else LoadLWOTags(head.length);
break; break;
} }
@ -183,20 +183,20 @@ void LWOImporter::CopyFaceIndicesLWOB(FaceList::iterator& it,
break; break;
} }
face.mIndices = new unsigned int[face.mNumIndices]; face.mIndices = new unsigned int[face.mNumIndices];
for (unsigned int i = 0; i < face.mNumIndices;++i) for (unsigned int i = 0; i < face.mNumIndices;++i) {
{
unsigned int & mi = face.mIndices[i]; unsigned int & mi = face.mIndices[i];
uint16_t index; uint16_t index;
::memcpy(&index, cursor++, 2); ::memcpy(&index, cursor++, 2);
mi = index; mi = index;
if (mi > mCurLayer->mTempPoints.size()) if (mi > mCurLayer->mTempPoints.size())
{ {
DefaultLogger::get()->warn("LWOB: face index is out of range"); ASSIMP_LOG_WARN("LWOB: face index is out of range");
mi = (unsigned int)mCurLayer->mTempPoints.size()-1; mi = (unsigned int)mCurLayer->mTempPoints.size()-1;
} }
} }
} else {
ASSIMP_LOG_WARN("LWOB: Face has 0 indices");
} }
else DefaultLogger::get()->warn("LWOB: Face has 0 indices");
int16_t surface; int16_t surface;
::memcpy(&surface, cursor++, 2); ::memcpy(&surface, cursor++, 2);
if (surface < 0) if (surface < 0)
@ -242,7 +242,7 @@ LWO::Texture* LWOImporter::SetupNewTextureLWOB(LWO::TextureList& list,unsigned i
else else
{ {
// procedural or gradient, not supported // procedural or gradient, not supported
DefaultLogger::get()->error("LWOB: Unsupported legacy texture: " + type); ASSIMP_LOG_ERROR_F("LWOB: Unsupported legacy texture: ", type);
} }
return tex; return tex;
@ -273,7 +273,7 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
* how much storage is actually left and work with this value from now on. * how much storage is actually left and work with this value from now on.
*/ */
if (mFileBuffer + head.length > end) { if (mFileBuffer + head.length > end) {
DefaultLogger::get()->error("LWOB: Invalid surface chunk length. Trying to continue."); ASSIMP_LOG_ERROR("LWOB: Invalid surface chunk length. Trying to continue.");
head.length = (uint16_t) (end - mFileBuffer); head.length = (uint16_t) (end - mFileBuffer);
} }
@ -381,8 +381,9 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
{ {
if (pTex) { if (pTex) {
GetS0(pTex->mFileName,head.length); GetS0(pTex->mFileName,head.length);
} else {
ASSIMP_LOG_WARN("LWOB: Unexpected TIMG chunk");
} }
else DefaultLogger::get()->warn("LWOB: Unexpected TIMG chunk");
break; break;
} }
// texture strength // texture strength
@ -391,8 +392,9 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TVAL,1); AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TVAL,1);
if (pTex) { if (pTex) {
pTex->mStrength = (float)GetU1()/ 255.f; pTex->mStrength = (float)GetU1()/ 255.f;
} else {
ASSIMP_LOG_ERROR("LWOB: Unexpected TVAL chunk");
} }
else DefaultLogger::get()->warn("LWOB: Unexpected TVAL chunk");
break; break;
} }
// texture flags // texture flags
@ -400,8 +402,7 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
{ {
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TFLG,2); AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,TFLG,2);
if (pTex) if (nullptr != pTex) {
{
const uint16_t s = GetU2(); const uint16_t s = GetU2();
if (s & 1) if (s & 1)
pTex->majorAxis = LWO::Texture::AXIS_X; pTex->majorAxis = LWO::Texture::AXIS_X;
@ -410,10 +411,13 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
else if (s & 4) else if (s & 4)
pTex->majorAxis = LWO::Texture::AXIS_Z; pTex->majorAxis = LWO::Texture::AXIS_Z;
if (s & 16) if (s & 16) {
DefaultLogger::get()->warn("LWOB: Ignoring \'negate\' flag on texture"); ASSIMP_LOG_WARN("LWOB: Ignoring \'negate\' flag on texture");
}
}
else {
ASSIMP_LOG_WARN("LWOB: Unexpected TFLG chunk");
} }
else DefaultLogger::get()->warn("LWOB: Unexpected TFLG chunk");
break; break;
} }
} }

View File

@ -188,7 +188,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// old lightwave file format (prior to v6) // old lightwave file format (prior to v6)
if (AI_LWO_FOURCC_LWOB == fileType) { if (AI_LWO_FOURCC_LWOB == fileType) {
DefaultLogger::get()->info("LWO file format: LWOB (<= LightWave 5.5)"); ASSIMP_LOG_INFO("LWO file format: LWOB (<= LightWave 5.5)");
mIsLWO2 = false; mIsLWO2 = false;
mIsLXOB = false; mIsLXOB = false;
@ -197,12 +197,12 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// New lightwave format // New lightwave format
else if (AI_LWO_FOURCC_LWO2 == fileType) { else if (AI_LWO_FOURCC_LWO2 == fileType) {
mIsLXOB = false; mIsLXOB = false;
DefaultLogger::get()->info("LWO file format: LWO2 (>= LightWave 6)"); ASSIMP_LOG_INFO("LWO file format: LWO2 (>= LightWave 6)");
} }
// MODO file format // MODO file format
else if (AI_LWO_FOURCC_LXOB == fileType) { else if (AI_LWO_FOURCC_LXOB == fileType) {
mIsLXOB = true; mIsLXOB = true;
DefaultLogger::get()->info("LWO file format: LXOB (Modo)"); ASSIMP_LOG_INFO("LWO file format: LXOB (Modo)");
} }
// we don't know this format // we don't know this format
else else
@ -271,7 +271,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
unsigned int idx = (*it).surfaceIndex; unsigned int idx = (*it).surfaceIndex;
if (idx >= mTags->size()) if (idx >= mTags->size())
{ {
DefaultLogger::get()->warn("LWO: Invalid face surface index"); ASSIMP_LOG_WARN("LWO: Invalid face surface index");
idx = UINT_MAX; idx = UINT_MAX;
} }
if(UINT_MAX == idx || UINT_MAX == (idx = _mMapping[idx])) { if(UINT_MAX == idx || UINT_MAX == (idx = _mMapping[idx])) {
@ -423,7 +423,9 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// So we use a separate implementation. // So we use a separate implementation.
ComputeNormals(mesh,smoothingGroups,_mSurfaces[i]); ComputeNormals(mesh,smoothingGroups,_mSurfaces[i]);
} }
else DefaultLogger::get()->debug("LWO2: No need to compute normals, they're already there"); else {
ASSIMP_LOG_DEBUG("LWO2: No need to compute normals, they're already there");
}
++p; ++p;
} }
} }
@ -686,13 +688,13 @@ void LWOImporter::ResolveClips()
if (Clip::REF == clip.type) { if (Clip::REF == clip.type) {
if (clip.clipRef >= mClips.size()) { if (clip.clipRef >= mClips.size()) {
DefaultLogger::get()->error("LWO2: Clip referrer index is out of range"); ASSIMP_LOG_ERROR("LWO2: Clip referrer index is out of range");
clip.clipRef = 0; clip.clipRef = 0;
} }
Clip& dest = mClips[clip.clipRef]; Clip& dest = mClips[clip.clipRef];
if (Clip::REF == dest.type) { if (Clip::REF == dest.type) {
DefaultLogger::get()->error("LWO2: Clip references another clip reference"); ASSIMP_LOG_ERROR("LWO2: Clip references another clip reference");
clip.type = Clip::UNSUPPORTED; clip.type = Clip::UNSUPPORTED;
} }
@ -711,7 +713,7 @@ void LWOImporter::AdjustTexturePath(std::string& out)
if (!mIsLWO2 && ::strstr(out.c_str(), "(sequence)")) { if (!mIsLWO2 && ::strstr(out.c_str(), "(sequence)")) {
// remove the (sequence) and append 000 // remove the (sequence) and append 000
DefaultLogger::get()->info("LWOB: Sequence of animated texture found. It will be ignored"); ASSIMP_LOG_INFO("LWOB: Sequence of animated texture found. It will be ignored");
out = out.substr(0,out.length()-10) + "000"; out = out.substr(0,out.length()-10) + "000";
} }
@ -786,10 +788,10 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
{ {
// read unsupported stuff too (although we won't process it) // read unsupported stuff too (although we won't process it)
case AI_LWO_MBAL: case AI_LWO_MBAL:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (METABALL)"); ASSIMP_LOG_WARN("LWO2: Encountered unsupported primitive chunk (METABALL)");
break; break;
case AI_LWO_CURV: case AI_LWO_CURV:
DefaultLogger::get()->warn("LWO2: Encountered unsupported primitive chunk (SPLINE)");; ASSIMP_LOG_WARN("LWO2: Encountered unsupported primitive chunk (SPLINE)");;
break; break;
// These are ok with no restrictions // These are ok with no restrictions
@ -801,7 +803,7 @@ void LWOImporter::LoadLWO2Polygons(unsigned int length)
default: default:
// hm!? wtf is this? ok ... // hm!? wtf is this? ok ...
DefaultLogger::get()->error("LWO2: Ignoring unknown polygon type."); ASSIMP_LOG_ERROR("LWO2: Ignoring unknown polygon type.");
break; break;
} }
@ -864,7 +866,7 @@ void LWOImporter::CopyFaceIndicesLWO2(FaceList::iterator& it,
face.mIndices[i] = ReadVSizedIntLWO2((uint8_t*&)cursor) + mCurLayer->mPointIDXOfs; face.mIndices[i] = ReadVSizedIntLWO2((uint8_t*&)cursor) + mCurLayer->mPointIDXOfs;
if(face.mIndices[i] > mCurLayer->mTempPoints.size()) if(face.mIndices[i] > mCurLayer->mTempPoints.size())
{ {
DefaultLogger::get()->warn("LWO2: Failure evaluating face record, index is out of range"); ASSIMP_LOG_WARN("LWO2: Failure evaluating face record, index is out of range");
face.mIndices[i] = (unsigned int)mCurLayer->mTempPoints.size()-1; face.mIndices[i] = (unsigned int)mCurLayer->mTempPoints.size()-1;
} }
} }
@ -891,7 +893,7 @@ void LWOImporter::LoadLWO2PolygonTags(unsigned int length)
unsigned int j = GetU2(); unsigned int j = GetU2();
if (i >= mCurLayer->mFaces.size()) { if (i >= mCurLayer->mFaces.size()) {
DefaultLogger::get()->warn("LWO2: face index in PTAG is out of range"); ASSIMP_LOG_WARN("LWO2: face index in PTAG is out of range");
continue; continue;
} }
@ -914,7 +916,7 @@ VMapEntry* FindEntry(std::vector< T >& list,const std::string& name, bool perPol
for (auto & elem : list) { for (auto & elem : list) {
if (elem.name == name) { if (elem.name == name) {
if (!perPoly) { if (!perPoly) {
DefaultLogger::get()->warn("LWO2: Found two VMAP sections with equal names"); ASSIMP_LOG_WARN("LWO2: Found two VMAP sections with equal names");
} }
return &elem; return &elem;
} }
@ -999,7 +1001,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
{ {
case AI_LWO_TXUV: case AI_LWO_TXUV:
if (dims != 2) { if (dims != 2) {
DefaultLogger::get()->warn("LWO2: Skipping UV channel \'" ASSIMP_LOG_WARN("LWO2: Skipping UV channel \'"
+ name + "\' with !2 components"); + name + "\' with !2 components");
return; return;
} }
@ -1008,7 +1010,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
case AI_LWO_WGHT: case AI_LWO_WGHT:
case AI_LWO_MNVW: case AI_LWO_MNVW:
if (dims != 1) { if (dims != 1) {
DefaultLogger::get()->warn("LWO2: Skipping Weight Channel \'" ASSIMP_LOG_WARN("LWO2: Skipping Weight Channel \'"
+ name + "\' with !1 components"); + name + "\' with !1 components");
return; return;
} }
@ -1018,7 +1020,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
case AI_LWO_RGB: case AI_LWO_RGB:
case AI_LWO_RGBA: case AI_LWO_RGBA:
if (dims != 3 && dims != 4) { if (dims != 3 && dims != 4) {
DefaultLogger::get()->warn("LWO2: Skipping Color Map \'" ASSIMP_LOG_WARN("LWO2: Skipping Color Map \'"
+ name + "\' with a dimension > 4 or < 3"); + name + "\' with a dimension > 4 or < 3");
return; return;
} }
@ -1033,7 +1035,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
if (name != "vert_normals" || dims != 3 || mCurLayer->mNormals.name.length()) if (name != "vert_normals" || dims != 3 || mCurLayer->mNormals.name.length())
return; return;
DefaultLogger::get()->info("Processing non-standard extension: MODO VMAP.NORM.vert_normals"); ASSIMP_LOG_INFO("Processing non-standard extension: MODO VMAP.NORM.vert_normals");
mCurLayer->mNormals.name = name; mCurLayer->mNormals.name = name;
base = & mCurLayer->mNormals; base = & mCurLayer->mNormals;
@ -1048,7 +1050,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
if (name == "APS.Level") { if (name == "APS.Level") {
// XXX handle this (seems to be subdivision-related). // XXX handle this (seems to be subdivision-related).
} }
DefaultLogger::get()->warn("LWO2: Skipping unknown VMAP/VMAD channel \'" + name + "\'"); ASSIMP_LOG_WARN_F("LWO2: Skipping unknown VMAP/VMAD channel \'", name, "\'");
return; return;
}; };
base->Allocate((unsigned int)mCurLayer->mTempPoints.size()); base->Allocate((unsigned int)mCurLayer->mTempPoints.size());
@ -1068,7 +1070,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
unsigned int idx = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mPointIDXOfs; unsigned int idx = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mPointIDXOfs;
if (idx >= numPoints) { if (idx >= numPoints) {
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAP/VMAD entry \'" + name + "\', vertex index is out of range"); ASSIMP_LOG_WARN_F("LWO2: Failure evaluating VMAP/VMAD entry \'", name, "\', vertex index is out of range");
mFileBuffer += base->dims<<2u; mFileBuffer += base->dims<<2u;
continue; continue;
} }
@ -1119,7 +1121,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly)
CreateNewEntry(mCurLayer->mNormals, srcIdx ); CreateNewEntry(mCurLayer->mNormals, srcIdx );
} }
if (!had) { if (!had) {
DefaultLogger::get()->warn("LWO2: Failure evaluating VMAD entry \'" + name + "\', vertex index wasn't found in that polygon"); ASSIMP_LOG_WARN_F("LWO2: Failure evaluating VMAD entry \'", name, "\', vertex index wasn't found in that polygon");
ai_assert(had); ai_assert(had);
} }
} }
@ -1180,11 +1182,11 @@ void LWOImporter::LoadLWO2Clip(unsigned int length)
break; break;
case AI_LWO_STCC: case AI_LWO_STCC:
DefaultLogger::get()->warn("LWO2: Color shifted images are not supported"); ASSIMP_LOG_WARN("LWO2: Color shifted images are not supported");
break; break;
case AI_LWO_ANIM: case AI_LWO_ANIM:
DefaultLogger::get()->warn("LWO2: Animated textures are not supported"); ASSIMP_LOG_WARN("LWO2: Animated textures are not supported");
break; break;
case AI_LWO_XREF: case AI_LWO_XREF:
@ -1201,7 +1203,7 @@ void LWOImporter::LoadLWO2Clip(unsigned int length)
break; break;
default: default:
DefaultLogger::get()->warn("LWO2: Encountered unknown CLIP subchunk"); ASSIMP_LOG_WARN("LWO2: Encountered unknown CLIP sub-chunk");
} }
} }
@ -1282,7 +1284,7 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length)
{ {
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SPAN,4); AI_LWO_VALIDATE_CHUNK_LENGTH(head.length,SPAN,4);
if (envelope.keys.size()<2) if (envelope.keys.size()<2)
DefaultLogger::get()->warn("LWO2: Unexpected SPAN chunk"); ASSIMP_LOG_WARN("LWO2: Unexpected SPAN chunk");
else { else {
LWO::Key& key = envelope.keys.back(); LWO::Key& key = envelope.keys.back();
switch (GetU4()) switch (GetU4())
@ -1300,7 +1302,7 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length)
case AI_LWO_BEZ2: case AI_LWO_BEZ2:
key.inter = LWO::IT_BEZ2;break; key.inter = LWO::IT_BEZ2;break;
default: default:
DefaultLogger::get()->warn("LWO2: Unknown interval interpolation mode"); ASSIMP_LOG_WARN("LWO2: Unknown interval interpolation mode");
}; };
// todo ... read params // todo ... read params
@ -1309,7 +1311,8 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length)
} }
default: default:
DefaultLogger::get()->warn("LWO2: Encountered unknown ENVL subchunk"); ASSIMP_LOG_WARN("LWO2: Encountered unknown ENVL subchunk");
break;
} }
// regardless how much we did actually read, go to the next chunk // regardless how much we did actually read, go to the next chunk
mFileBuffer = next; mFileBuffer = next;
@ -1408,7 +1411,7 @@ void LWOImporter::LoadLWO2File()
case AI_LWO_VMAD: case AI_LWO_VMAD:
if (mCurLayer->mFaces.empty()) if (mCurLayer->mFaces.empty())
{ {
DefaultLogger::get()->warn("LWO2: Unexpected VMAD chunk"); ASSIMP_LOG_WARN("LWO2: Unexpected VMAD chunk");
break; break;
} }
// --- intentionally no break here // --- intentionally no break here
@ -1418,7 +1421,7 @@ void LWOImporter::LoadLWO2File()
break; break;
if (mCurLayer->mTempPoints.empty()) if (mCurLayer->mTempPoints.empty())
DefaultLogger::get()->warn("LWO2: Unexpected VMAP chunk"); ASSIMP_LOG_WARN("LWO2: Unexpected VMAP chunk");
else LoadLWO2VertexMap(head.length,head.type == AI_LWO_VMAD); else LoadLWO2VertexMap(head.length,head.type == AI_LWO_VMAD);
break; break;
} }
@ -1448,7 +1451,7 @@ void LWOImporter::LoadLWO2File()
case AI_LWO_TAGS: case AI_LWO_TAGS:
{ {
if (!mTags->empty()) if (!mTags->empty())
DefaultLogger::get()->warn("LWO2: SRFS chunk encountered twice"); ASSIMP_LOG_WARN("LWO2: SRFS chunk encountered twice");
else LoadLWOTags(head.length); else LoadLWOTags(head.length);
break; break;
} }

View File

@ -473,7 +473,7 @@ inline void LWOImporter::GetS0(std::string& out,unsigned int max)
{ {
if (++iCursor > max) if (++iCursor > max)
{ {
DefaultLogger::get()->warn("LWO: Invalid file, string is is too long"); ASSIMP_LOG_WARN("LWO: Invalid file, string is is too long");
break; break;
} }
++mFileBuffer; ++mFileBuffer;

View File

@ -74,7 +74,7 @@ inline aiTextureMapMode GetMapMode(LWO::Texture::Wrap in)
return aiTextureMapMode_Mirror; return aiTextureMapMode_Mirror;
case LWO::Texture::RESET: case LWO::Texture::RESET:
DefaultLogger::get()->warn("LWO2: Unsupported texture map mode: RESET"); ASSIMP_LOG_WARN("LWO2: Unsupported texture map mode: RESET");
// fall though here // fall though here
case LWO::Texture::EDGE: case LWO::Texture::EDGE:
@ -117,7 +117,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
mapping = aiTextureMapping_BOX; mapping = aiTextureMapping_BOX;
break; break;
case LWO::Texture::FrontProjection: case LWO::Texture::FrontProjection:
DefaultLogger::get()->error("LWO2: Unsupported texture mapping: FrontProjection"); ASSIMP_LOG_ERROR("LWO2: Unsupported texture mapping: FrontProjection");
mapping = aiTextureMapping_OTHER; mapping = aiTextureMapping_OTHER;
break; break;
case LWO::Texture::UV: case LWO::Texture::UV:
@ -181,7 +181,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
} }
if (candidate == end) { if (candidate == end) {
DefaultLogger::get()->error("LWO2: Clip index is out of bounds"); ASSIMP_LOG_ERROR("LWO2: Clip index is out of bounds");
temp = 0; temp = 0;
// fixme: apparently some LWO files shipping with Doom3 don't // fixme: apparently some LWO files shipping with Doom3 don't
@ -194,7 +194,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
} }
else { else {
if (Clip::UNSUPPORTED == (*candidate).type) { if (Clip::UNSUPPORTED == (*candidate).type) {
DefaultLogger::get()->error("LWO2: Clip type is not supported"); ASSIMP_LOG_ERROR("LWO2: Clip type is not supported");
continue; continue;
} }
AdjustTexturePath((*candidate).path); AdjustTexturePath((*candidate).path);
@ -212,7 +212,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
{ {
std::string ss = texture.mFileName; std::string ss = texture.mFileName;
if (!ss.length()) { if (!ss.length()) {
DefaultLogger::get()->error("LWOB: Empty file name"); ASSIMP_LOG_WARN("LWOB: Empty file name");
continue; continue;
} }
AdjustTexturePath(ss); AdjustTexturePath(ss);
@ -246,7 +246,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
default: default:
temp = (unsigned int)aiTextureOp_Multiply; temp = (unsigned int)aiTextureOp_Multiply;
DefaultLogger::get()->warn("LWO2: Unsupported texture blend mode: alpha or displacement"); ASSIMP_LOG_WARN("LWO2: Unsupported texture blend mode: alpha or displacement");
} }
// Setup texture operation // Setup texture operation
@ -347,20 +347,20 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
// the surface and search for a name which we know ... // the surface and search for a name which we know ...
for (const auto &shader : surf.mShaders) { for (const auto &shader : surf.mShaders) {
if (shader.functionName == "LW_SuperCelShader" || shader.functionName == "AH_CelShader") { if (shader.functionName == "LW_SuperCelShader" || shader.functionName == "AH_CelShader") {
DefaultLogger::get()->info("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon"); ASSIMP_LOG_INFO("LWO2: Mapping LW_SuperCelShader/AH_CelShader to aiShadingMode_Toon");
m = aiShadingMode_Toon; m = aiShadingMode_Toon;
break; break;
} }
else if (shader.functionName == "LW_RealFresnel" || shader.functionName == "LW_FastFresnel") { else if (shader.functionName == "LW_RealFresnel" || shader.functionName == "LW_FastFresnel") {
DefaultLogger::get()->info("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel"); ASSIMP_LOG_INFO("LWO2: Mapping LW_RealFresnel/LW_FastFresnel to aiShadingMode_Fresnel");
m = aiShadingMode_Fresnel; m = aiShadingMode_Fresnel;
break; break;
} }
else else
{ {
DefaultLogger::get()->warn("LWO2: Unknown surface shader: " + shader.functionName); ASSIMP_LOG_WARN_F("LWO2: Unknown surface shader: ", shader.functionName);
} }
} }
if (surf.mMaximumSmoothAngle <= 0.0) if (surf.mMaximumSmoothAngle <= 0.0)
@ -398,7 +398,7 @@ char LWOImporter::FindUVChannels(LWO::TextureList& list,
} }
else { else {
// channel mismatch. need to duplicate the material. // channel mismatch. need to duplicate the material.
DefaultLogger::get()->warn("LWO: Channel mismatch, would need to duplicate surface [design bug]"); ASSIMP_LOG_WARN("LWO: Channel mismatch, would need to duplicate surface [design bug]");
// TODO // TODO
} }
@ -429,7 +429,7 @@ void LWOImporter::FindUVChannels(LWO::Surface& surf,
if (extra >= AI_MAX_NUMBER_OF_TEXTURECOORDS) { if (extra >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
DefaultLogger::get()->error("LWO: Maximum number of UV channels for " ASSIMP_LOG_ERROR("LWO: Maximum number of UV channels for "
"this mesh reached. Skipping channel \'" + uv.name + "\'"); "this mesh reached. Skipping channel \'" + uv.name + "\'");
} }
@ -502,7 +502,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, LWO::SortedRep& sorte
if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.0,0.0,0.0,1.0)) { if (vc.abAssigned[idx] && ((aiColor4D*)&vc.rawData[0])[idx] != aiColor4D(0.0,0.0,0.0,1.0)) {
if (next >= AI_MAX_NUMBER_OF_COLOR_SETS) { if (next >= AI_MAX_NUMBER_OF_COLOR_SETS) {
DefaultLogger::get()->error("LWO: Maximum number of vertex color channels for " ASSIMP_LOG_ERROR("LWO: Maximum number of vertex color channels for "
"this mesh reached. Skipping channel \'" + vc.name + "\'"); "this mesh reached. Skipping channel \'" + vc.name + "\'");
} }
@ -567,7 +567,7 @@ void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex )
void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex ) void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex )
{ {
// --- not supported at the moment // --- not supported at the moment
DefaultLogger::get()->error("LWO2: Found procedural texture, this is not supported"); ASSIMP_LOG_ERROR("LWO2: Found procedural texture, this is not supported");
tex.bCanUse = false; tex.bCanUse = false;
} }
@ -575,7 +575,7 @@ void LWOImporter::LoadLWO2Procedural(unsigned int /*size*/, LWO::Texture& tex )
void LWOImporter::LoadLWO2Gradient(unsigned int /*size*/, LWO::Texture& tex ) void LWOImporter::LoadLWO2Gradient(unsigned int /*size*/, LWO::Texture& tex )
{ {
// --- not supported at the moment // --- not supported at the moment
DefaultLogger::get()->error("LWO2: Found gradient texture, this is not supported"); ASSIMP_LOG_ERROR("LWO2: Found gradient texture, this is not supported");
tex.bCanUse = false; tex.bCanUse = false;
} }
@ -590,7 +590,7 @@ void LWOImporter::LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex )
// we could crash later if this is an empty string ... // we could crash later if this is an empty string ...
if (!tex.ordinal.length()) if (!tex.ordinal.length())
{ {
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string"); ASSIMP_LOG_ERROR("LWO2: Ill-formed SURF.BLOK ordinal string");
tex.ordinal = "\x00"; tex.ordinal = "\x00";
} }
while (true) while (true)
@ -662,7 +662,7 @@ void LWOImporter::LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head, unsi
case AI_LWO_REFL: case AI_LWO_REFL:
listRef = &surf.mReflectionTextures;break; listRef = &surf.mReflectionTextures;break;
default: default:
DefaultLogger::get()->warn("LWO2: Encountered unknown texture type"); ASSIMP_LOG_WARN("LWO2: Encountered unknown texture type");
return; return;
} }
@ -691,7 +691,7 @@ void LWOImporter::LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader* /*head*/, u
// we could crash later if this is an empty string ... // we could crash later if this is an empty string ...
if (!shader.ordinal.length()) if (!shader.ordinal.length())
{ {
DefaultLogger::get()->error("LWO2: Ill-formed SURF.BLOK ordinal string"); ASSIMP_LOG_ERROR("LWO2: Ill-formed SURF.BLOK ordinal string");
shader.ordinal = "\x00"; shader.ordinal = "\x00";
} }
@ -750,7 +750,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
} }
} }
if (derived.size()) if (derived.size())
DefaultLogger::get()->warn("LWO2: Unable to find source surface: " + derived); ASSIMP_LOG_WARN("LWO2: Unable to find source surface: " + derived);
} }
while (true) while (true)
@ -886,7 +886,7 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
break; break;
default: default:
DefaultLogger::get()->warn("LWO2: Found an unsupported surface BLOK"); ASSIMP_LOG_WARN("LWO2: Found an unsupported surface BLOK");
}; };
break; break;

View File

@ -200,7 +200,7 @@ void LWSImporter::SetupProperties(const Importer* pImp)
void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill ) void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill )
{ {
if (dad.children.empty()) { if (dad.children.empty()) {
DefaultLogger::get()->error("LWS: Envelope descriptions must not be empty"); ASSIMP_LOG_ERROR("LWS: Envelope descriptions must not be empty");
return; return;
} }
@ -248,7 +248,7 @@ void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill )
num = 4; num = 4;
break; break;
default: default:
DefaultLogger::get()->error("LWS: Unknown span type"); ASSIMP_LOG_ERROR("LWS: Unknown span type");
} }
for (unsigned int i = 0; i < num;++i) { for (unsigned int i = 0; i < num;++i) {
SkipSpaces(&c); SkipSpaces(&c);
@ -305,7 +305,7 @@ void LWSImporter::ReadEnvelope_Old(
return; return;
unexpected_end: unexpected_end:
DefaultLogger::get()->error("LWS: Encountered unexpected end of file while parsing object motion"); ASSIMP_LOG_ERROR("LWS: Encountered unexpected end of file while parsing object motion");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -352,7 +352,7 @@ void LWSImporter::BuildGraph(aiNode* nd, LWS::NodeDesc& src, std::vector<Attachm
if (src.path.length() ) { if (src.path.length() ) {
obj = batch.GetImport(src.id); obj = batch.GetImport(src.id);
if (!obj) { if (!obj) {
DefaultLogger::get()->error("LWS: Failed to read external file " + src.path); ASSIMP_LOG_ERROR("LWS: Failed to read external file " + src.path);
} }
else { else {
if (obj->mRootNode->mNumChildren == 1) { if (obj->mRootNode->mNumChildren == 1) {
@ -551,7 +551,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// get file format version and print to log // get file format version and print to log
++it; ++it;
unsigned int version = strtoul10((*it).tokens[0].c_str()); unsigned int version = strtoul10((*it).tokens[0].c_str());
DefaultLogger::get()->info("LWS file format version is " + (*it).tokens[0]); ASSIMP_LOG_INFO("LWS file format version is " + (*it).tokens[0]);
first = 0.; first = 0.;
last = 60.; last = 60.;
fps = 25.; /* seems to be a good default frame rate */ fps = 25.; /* seems to be a good default frame rate */
@ -656,7 +656,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
d.number = cur_object++; d.number = cur_object++;
nodes.push_back(d); nodes.push_back(d);
} }
else DefaultLogger::get()->error("LWS: Unexpected keyword: \'Channel\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'Channel\'");
} }
// important: index of channel // important: index of channel
@ -673,7 +673,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'Envelope': a single animation channel // 'Envelope': a single animation channel
else if ((*it).tokens[0] == "Envelope") { else if ((*it).tokens[0] == "Envelope") {
if (nodes.empty() || nodes.back().channels.empty()) if (nodes.empty() || nodes.back().channels.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'Envelope\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'Envelope\'");
else { else {
ReadEnvelope((*it),nodes.back().channels.back()); ReadEnvelope((*it),nodes.back().channels.back());
} }
@ -684,7 +684,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
(*it).tokens[0] == "LightMotion")) { (*it).tokens[0] == "LightMotion")) {
if (nodes.empty()) if (nodes.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'"); DASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'<Light|Object|Camera>Motion\'");
else { else {
ReadEnvelope_Old(it,root.children.end(),nodes.back(),version); ReadEnvelope_Old(it,root.children.end(),nodes.back(),version);
} }
@ -692,7 +692,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'Pre/PostBehavior': pre/post animation behaviour for LWSC 2 // 'Pre/PostBehavior': pre/post animation behaviour for LWSC 2
else if (version == 2 && (*it).tokens[0] == "Pre/PostBehavior") { else if (version == 2 && (*it).tokens[0] == "Pre/PostBehavior") {
if (nodes.empty()) if (nodes.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'Pre/PostBehavior'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'Pre/PostBehavior'");
else { else {
for (std::list<LWO::Envelope>::iterator it = nodes.back().channels.begin(); it != nodes.back().channels.end(); ++it) { for (std::list<LWO::Envelope>::iterator it = nodes.back().channels.begin(); it != nodes.back().channels.end(); ++it) {
// two ints per envelope // two ints per envelope
@ -705,14 +705,14 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'ParentItem': specifies the parent of the current element // 'ParentItem': specifies the parent of the current element
else if ((*it).tokens[0] == "ParentItem") { else if ((*it).tokens[0] == "ParentItem") {
if (nodes.empty()) if (nodes.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'ParentItem\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'ParentItem\'");
else nodes.back().parent = strtoul16(c,&c); else nodes.back().parent = strtoul16(c,&c);
} }
// 'ParentObject': deprecated one for older formats // 'ParentObject': deprecated one for older formats
else if (version < 3 && (*it).tokens[0] == "ParentObject") { else if (version < 3 && (*it).tokens[0] == "ParentObject") {
if (nodes.empty()) if (nodes.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'ParentObject\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'ParentObject\'");
else { else {
nodes.back().parent = strtoul10(c,&c) | (1u << 28u); nodes.back().parent = strtoul10(c,&c) | (1u << 28u);
@ -736,7 +736,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'CameraName': set name of currently active camera // 'CameraName': set name of currently active camera
else if ((*it).tokens[0] == "CameraName") { else if ((*it).tokens[0] == "CameraName") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::CAMERA) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::CAMERA)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'CameraName\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'CameraName\'");
else nodes.back().name = c; else nodes.back().name = c;
} }
@ -758,14 +758,14 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightName': set name of currently active light // 'LightName': set name of currently active light
else if ((*it).tokens[0] == "LightName") { else if ((*it).tokens[0] == "LightName") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightName\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightName\'");
else nodes.back().name = c; else nodes.back().name = c;
} }
// 'LightIntensity': set intensity of currently active light // 'LightIntensity': set intensity of currently active light
else if ((*it).tokens[0] == "LightIntensity" || (*it).tokens[0] == "LgtIntensity" ) { else if ((*it).tokens[0] == "LightIntensity" || (*it).tokens[0] == "LgtIntensity" ) {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightIntensity\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightIntensity\'");
else fast_atoreal_move<float>(c, nodes.back().lightIntensity ); else fast_atoreal_move<float>(c, nodes.back().lightIntensity );
@ -781,7 +781,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightFalloffType': set falloff type of currently active light // 'LightFalloffType': set falloff type of currently active light
else if ((*it).tokens[0] == "LightFalloffType") { else if ((*it).tokens[0] == "LightFalloffType") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightFalloffType\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightFalloffType\'");
else nodes.back().lightFalloffType = strtoul10(c); else nodes.back().lightFalloffType = strtoul10(c);
@ -789,7 +789,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightConeAngle': set cone angle of currently active light // 'LightConeAngle': set cone angle of currently active light
else if ((*it).tokens[0] == "LightConeAngle") { else if ((*it).tokens[0] == "LightConeAngle") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightConeAngle\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightConeAngle\'");
else nodes.back().lightConeAngle = fast_atof(c); else nodes.back().lightConeAngle = fast_atof(c);
@ -797,7 +797,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightEdgeAngle': set area where we're smoothing from min to max intensity // 'LightEdgeAngle': set area where we're smoothing from min to max intensity
else if ((*it).tokens[0] == "LightEdgeAngle") { else if ((*it).tokens[0] == "LightEdgeAngle") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightEdgeAngle\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightEdgeAngle\'");
else nodes.back().lightEdgeAngle = fast_atof(c); else nodes.back().lightEdgeAngle = fast_atof(c);
@ -805,7 +805,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'LightColor': set color of currently active light // 'LightColor': set color of currently active light
else if ((*it).tokens[0] == "LightColor") { else if ((*it).tokens[0] == "LightColor") {
if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT)
DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightColor\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'LightColor\'");
else { else {
c = fast_atoreal_move<float>(c, (float&) nodes.back().lightColor.r ); c = fast_atoreal_move<float>(c, (float&) nodes.back().lightColor.r );
@ -819,7 +819,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
// 'PivotPosition': position of local transformation origin // 'PivotPosition': position of local transformation origin
else if ((*it).tokens[0] == "PivotPosition" || (*it).tokens[0] == "PivotPoint") { else if ((*it).tokens[0] == "PivotPosition" || (*it).tokens[0] == "PivotPoint") {
if (nodes.empty()) if (nodes.empty())
DefaultLogger::get()->error("LWS: Unexpected keyword: \'PivotPosition\'"); ASSIMP_LOG_ERROR("LWS: Unexpected keyword: \'PivotPosition\'");
else { else {
c = fast_atoreal_move<float>(c, (float&) nodes.back().pivotPos.x ); c = fast_atoreal_move<float>(c, (float&) nodes.back().pivotPos.x );
SkipSpaces(&c); SkipSpaces(&c);
@ -840,7 +840,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
if (dit != it && *it == (*dit).parent) { if (dit != it && *it == (*dit).parent) {
if ((*dit).parent_resolved) { if ((*dit).parent_resolved) {
// fixme: it's still possible to produce an overflow due to cross references .. // fixme: it's still possible to produce an overflow due to cross references ..
DefaultLogger::get()->error("LWS: Found cross reference in scenegraph"); ASSIMP_LOG_ERROR("LWS: Found cross reference in scene-graph");
continue; continue;
} }

View File

@ -83,7 +83,7 @@ void MD2::LookupNormalIndex(uint8_t iNormalIndex,aiVector3D& vOut)
{ {
// make sure the normal index has a valid value // make sure the normal index has a valid value
if (iNormalIndex >= ARRAYSIZE(g_avNormals)) { if (iNormalIndex >= ARRAYSIZE(g_avNormals)) {
DefaultLogger::get()->warn("Index overflow in Quake II normal vector list"); ASSIMP_LOG_WARN("Index overflow in Quake II normal vector list");
iNormalIndex = ARRAYSIZE(g_avNormals) - 1; iNormalIndex = ARRAYSIZE(g_avNormals) - 1;
} }
vOut = *((const aiVector3D*)(&g_avNormals[iNormalIndex])); vOut = *((const aiVector3D*)(&g_avNormals[iNormalIndex]));
@ -161,7 +161,7 @@ void MD2Importer::ValidateHeader( )
// check file format version // check file format version
if (m_pcHeader->version != 8) if (m_pcHeader->version != 8)
DefaultLogger::get()->warn( "Unsupported md2 file version. Continuing happily ..."); ASSIMP_LOG_WARN( "Unsupported md2 file version. Continuing happily ...");
// check some values whether they are valid // check some values whether they are valid
if (0 == m_pcHeader->numFrames) if (0 == m_pcHeader->numFrames)
@ -203,11 +203,11 @@ void MD2Importer::ValidateHeader( )
} }
if (m_pcHeader->numSkins > AI_MD2_MAX_SKINS) if (m_pcHeader->numSkins > AI_MD2_MAX_SKINS)
DefaultLogger::get()->warn("The model contains more skins than Quake 2 supports"); ASSIMP_LOG_WARN("The model contains more skins than Quake 2 supports");
if ( m_pcHeader->numFrames > AI_MD2_MAX_FRAMES) if ( m_pcHeader->numFrames > AI_MD2_MAX_FRAMES)
DefaultLogger::get()->warn("The model contains more frames than Quake 2 supports"); ASSIMP_LOG_WARN("The model contains more frames than Quake 2 supports");
if (m_pcHeader->numVertices > AI_MD2_MAX_VERTS) if (m_pcHeader->numVertices > AI_MD2_MAX_VERTS)
DefaultLogger::get()->warn("The model contains more vertices than Quake 2 supports"); ASSIMP_LOG_WARN("The model contains more vertices than Quake 2 supports");
if (m_pcHeader->numFrames <= configFrameID ) if (m_pcHeader->numFrames <= configFrameID )
throw DeadlyImportError("The requested frame is not existing the file"); throw DeadlyImportError("The requested frame is not existing the file");
@ -352,7 +352,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
pcHelper->AddProperty(&szString,AI_MATKEY_TEXTURE_DIFFUSE(0)); pcHelper->AddProperty(&szString,AI_MATKEY_TEXTURE_DIFFUSE(0));
} }
else{ else{
DefaultLogger::get()->warn("Texture file name has zero length. It will be skipped."); ASSIMP_LOG_WARN("Texture file name has zero length. It will be skipped.");
} }
} }
else { else {
@ -390,11 +390,11 @@ void MD2Importer::InternReadFile( const std::string& pFile,
// check whether the skin width or height are zero (this would // check whether the skin width or height are zero (this would
// cause a division through zero) // cause a division through zero)
if (!m_pcHeader->skinWidth) { if (!m_pcHeader->skinWidth) {
DefaultLogger::get()->error("MD2: No valid skin width given"); ASSIMP_LOG_ERROR("MD2: No valid skin width given");
} }
else fDivisorU = (float)m_pcHeader->skinWidth; else fDivisorU = (float)m_pcHeader->skinWidth;
if (!m_pcHeader->skinHeight){ if (!m_pcHeader->skinHeight){
DefaultLogger::get()->error("MD2: No valid skin height given"); ASSIMP_LOG_ERROR("MD2: No valid skin height given");
} }
else fDivisorV = (float)m_pcHeader->skinHeight; else fDivisorV = (float)m_pcHeader->skinHeight;
} }
@ -412,7 +412,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
// validate vertex indices // validate vertex indices
unsigned int iIndex = (unsigned int)pcTriangles[i].vertexIndices[c]; unsigned int iIndex = (unsigned int)pcTriangles[i].vertexIndices[c];
if (iIndex >= m_pcHeader->numVertices) { if (iIndex >= m_pcHeader->numVertices) {
DefaultLogger::get()->error("MD2: Vertex index is outside the allowed range"); ASSIMP_LOG_ERROR("MD2: Vertex index is outside the allowed range");
iIndex = m_pcHeader->numVertices-1; iIndex = m_pcHeader->numVertices-1;
} }
@ -440,7 +440,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
// validate texture coordinates // validate texture coordinates
iIndex = pcTriangles[i].textureIndices[c]; iIndex = pcTriangles[i].textureIndices[c];
if (iIndex >= m_pcHeader->numTexCoords) { if (iIndex >= m_pcHeader->numTexCoords) {
DefaultLogger::get()->error("MD2: UV index is outside the allowed range"); ASSIMP_LOG_ERROR("MD2: UV index is outside the allowed range");
iIndex = m_pcHeader->numTexCoords-1; iIndex = m_pcHeader->numTexCoords-1;
} }

View File

@ -101,7 +101,7 @@ Q3Shader::BlendFunc StringToBlendFunc(const std::string& m)
if (m == "GL_ONE_MINUS_DST_COLOR") { if (m == "GL_ONE_MINUS_DST_COLOR") {
return Q3Shader::BLEND_GL_ONE_MINUS_DST_COLOR; return Q3Shader::BLEND_GL_ONE_MINUS_DST_COLOR;
} }
DefaultLogger::get()->error("Q3Shader: Unknown blend function: " + m); ASSIMP_LOG_ERROR("Q3Shader: Unknown blend function: " + m);
return Q3Shader::BLEND_NONE; return Q3Shader::BLEND_NONE;
} }
@ -113,7 +113,7 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
if (!file.get()) if (!file.get())
return false; // if we can't access the file, don't worry and return return false; // if we can't access the file, don't worry and return
DefaultLogger::get()->info("Loading Quake3 shader file " + pFile); ASSIMP_LOG_INFO_F("Loading Quake3 shader file ", pFile);
// read file in memory // read file in memory
const size_t s = file->FileSize(); const size_t s = file->FileSize();
@ -136,7 +136,7 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
// append to last section, if any // append to last section, if any
if (!curData) { if (!curData) {
DefaultLogger::get()->error("Q3Shader: Unexpected shader section token \'{\'"); ASSIMP_LOG_ERROR("Q3Shader: Unexpected shader section token \'{\'");
return true; // still no failure, the file is there return true; // still no failure, the file is there
} }
@ -206,19 +206,16 @@ bool Q3Shader::LoadShader(ShaderData& fill, const std::string& pFile,IOSystem* i
SkipSpaces(&buff); SkipSpaces(&buff);
if (!ASSIMP_strincmp(buff,"back",4)) { if (!ASSIMP_strincmp(buff,"back",4)) {
curData->cull = Q3Shader::CULL_CCW; curData->cull = Q3Shader::CULL_CCW;
} } else if (!ASSIMP_strincmp(buff,"front",5)) {
else if (!ASSIMP_strincmp(buff,"front",5)) {
curData->cull = Q3Shader::CULL_CW; curData->cull = Q3Shader::CULL_CW;
} } else if (!ASSIMP_strincmp(buff,"none",4) || !ASSIMP_strincmp(buff,"disable",7)) {
else if (!ASSIMP_strincmp(buff,"none",4) || !ASSIMP_strincmp(buff,"disable",7)) {
curData->cull = Q3Shader::CULL_NONE; curData->cull = Q3Shader::CULL_NONE;
} else {
ASSIMP_LOG_ERROR("Q3Shader: Unrecognized cull mode");
} }
else DefaultLogger::get()->error("Q3Shader: Unrecognized cull mode");
} }
} }
} } else {
else {
// add new section // add new section
fill.blocks.push_back(Q3Shader::ShaderDataBlock()); fill.blocks.push_back(Q3Shader::ShaderDataBlock());
curData = &fill.blocks.back(); curData = &fill.blocks.back();
@ -238,7 +235,7 @@ bool Q3Shader::LoadSkin(SkinData& fill, const std::string& pFile,IOSystem* io)
if (!file.get()) if (!file.get())
return false; // if we can't access the file, don't worry and return return false; // if we can't access the file, don't worry and return
DefaultLogger::get()->info("Loading Quake3 skin file " + pFile); ASSIMP_LOG_INFO("Loading Quake3 skin file " + pFile);
// read file in memory // read file in memory
const size_t s = file->FileSize(); const size_t s = file->FileSize();
@ -397,7 +394,7 @@ void MD3Importer::ValidateHeaderOffsets()
// Check file format version // Check file format version
if (pcHeader->VERSION > 15) if (pcHeader->VERSION > 15)
DefaultLogger::get()->warn( "Unsupported MD3 file version. Continuing happily ..."); ASSIMP_LOG_WARN( "Unsupported MD3 file version. Continuing happily ...");
// Check some offset values whether they are valid // Check some offset values whether they are valid
if (!pcHeader->NUM_SURFACES) if (!pcHeader->NUM_SURFACES)
@ -438,25 +435,24 @@ void MD3Importer::ValidateSurfaceHeaderOffsets(const MD3::Surface* pcSurf)
// Check whether all requirements for Q3 files are met. We don't // Check whether all requirements for Q3 files are met. We don't
// care, but probably someone does. // care, but probably someone does.
if (pcSurf->NUM_TRIANGLES > AI_MD3_MAX_TRIANGLES) { if (pcSurf->NUM_TRIANGLES > AI_MD3_MAX_TRIANGLES) {
DefaultLogger::get()->warn("MD3: Quake III triangle limit exceeded"); ASSIMP_LOG_WARN("MD3: Quake III triangle limit exceeded");
} }
if (pcSurf->NUM_SHADER > AI_MD3_MAX_SHADERS) { if (pcSurf->NUM_SHADER > AI_MD3_MAX_SHADERS) {
DefaultLogger::get()->warn("MD3: Quake III shader limit exceeded"); ASSIMP_LOG_WARN("MD3: Quake III shader limit exceeded");
} }
if (pcSurf->NUM_VERTICES > AI_MD3_MAX_VERTS) { if (pcSurf->NUM_VERTICES > AI_MD3_MAX_VERTS) {
DefaultLogger::get()->warn("MD3: Quake III vertex limit exceeded"); ASSIMP_LOG_WARN("MD3: Quake III vertex limit exceeded");
} }
if (pcSurf->NUM_FRAMES > AI_MD3_MAX_FRAMES) { if (pcSurf->NUM_FRAMES > AI_MD3_MAX_FRAMES) {
DefaultLogger::get()->warn("MD3: Quake III frame limit exceeded"); ASSIMP_LOG_WARN("MD3: Quake III frame limit exceeded");
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiImporterDesc* MD3Importer::GetInfo () const const aiImporterDesc* MD3Importer::GetInfo () const {
{
return &desc; return &desc;
} }
@ -579,7 +575,7 @@ bool MD3Importer::ReadMultipartFile()
aiNode* tag_torso, *tag_head; aiNode* tag_torso, *tag_head;
std::vector<AttachmentInfo> attach; std::vector<AttachmentInfo> attach;
DefaultLogger::get()->info("Multi part MD3 player model: lower, upper and head parts are joined"); ASSIMP_LOG_INFO("Multi part MD3 player model: lower, upper and head parts are joined");
// ensure we won't try to load ourselves recursively // ensure we won't try to load ourselves recursively
BatchLoader::PropertyMap props; BatchLoader::PropertyMap props;
@ -600,21 +596,21 @@ bool MD3Importer::ReadMultipartFile()
// ... and get them. We need all of them. // ... and get them. We need all of them.
scene_lower = batch.GetImport(_lower); scene_lower = batch.GetImport(_lower);
if (!scene_lower) { if (!scene_lower) {
DefaultLogger::get()->error("M3D: Failed to read multi part model, lower.md3 fails to load"); ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, lower.md3 fails to load");
failure = "lower"; failure = "lower";
goto error_cleanup; goto error_cleanup;
} }
scene_upper = batch.GetImport(_upper); scene_upper = batch.GetImport(_upper);
if (!scene_upper) { if (!scene_upper) {
DefaultLogger::get()->error("M3D: Failed to read multi part model, upper.md3 fails to load"); ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, upper.md3 fails to load");
failure = "upper"; failure = "upper";
goto error_cleanup; goto error_cleanup;
} }
scene_head = batch.GetImport(_head); scene_head = batch.GetImport(_head);
if (!scene_head) { if (!scene_head) {
DefaultLogger::get()->error("M3D: Failed to read multi part model, head.md3 fails to load"); ASSIMP_LOG_ERROR("M3D: Failed to read multi part model, head.md3 fails to load");
failure = "head"; failure = "head";
goto error_cleanup; goto error_cleanup;
} }
@ -628,7 +624,7 @@ bool MD3Importer::ReadMultipartFile()
// tag_torso // tag_torso
tag_torso = scene_lower->mRootNode->FindNode("tag_torso"); tag_torso = scene_lower->mRootNode->FindNode("tag_torso");
if (!tag_torso) { if (!tag_torso) {
DefaultLogger::get()->error("M3D: Failed to find attachment tag for multi part model: tag_torso expected"); ASSIMP_LOG_ERROR("M3D: Failed to find attachment tag for multi part model: tag_torso expected");
goto error_cleanup; goto error_cleanup;
} }
scene_upper->mRootNode->mName.Set("upper"); scene_upper->mRootNode->mName.Set("upper");
@ -637,7 +633,7 @@ bool MD3Importer::ReadMultipartFile()
// tag_head // tag_head
tag_head = scene_upper->mRootNode->FindNode("tag_head"); tag_head = scene_upper->mRootNode->FindNode("tag_head");
if (!tag_head) { if (!tag_head) {
DefaultLogger::get()->error("M3D: Failed to find attachment tag for multi part model: tag_head expected"); ASSIMP_LOG_ERROR( "M3D: Failed to find attachment tag for multi part model: tag_head expected");
goto error_cleanup; goto error_cleanup;
} }
scene_head->mRootNode->mName.Set("head"); scene_head->mRootNode->mName.Set("head");
@ -919,9 +915,10 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (dit != shaders.blocks.end()) { if (dit != shaders.blocks.end()) {
// Hurra, wir haben einen. Tolle Sache. // Hurra, wir haben einen. Tolle Sache.
shader = &*dit; shader = &*dit;
DefaultLogger::get()->info("Found shader record for " +without_ext ); ASSIMP_LOG_INFO("Found shader record for " +without_ext );
} else {
ASSIMP_LOG_WARN("Unable to find shader record for " + without_ext);
} }
else DefaultLogger::get()->warn("Unable to find shader record for " +without_ext );
} }
aiMaterial* pcHelper = new aiMaterial(); aiMaterial* pcHelper = new aiMaterial();
@ -950,7 +947,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
szString.Set(convertedPath); szString.Set(convertedPath);
} }
else { else {
DefaultLogger::get()->warn("Texture file name has zero length. Using default name"); ASSIMP_LOG_WARN("Texture file name has zero length. Using default name");
szString.Set("dummy_texture.bmp"); szString.Set("dummy_texture.bmp");
} }
pcHelper->AddProperty(&szString,AI_MATKEY_TEXTURE_DIFFUSE(0)); pcHelper->AddProperty(&szString,AI_MATKEY_TEXTURE_DIFFUSE(0));
@ -1040,7 +1037,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
for (std::list< Q3Shader::SkinData::TextureEntry>::const_iterator it = skins.textures.begin();it != skins.textures.end(); ++it) { for (std::list< Q3Shader::SkinData::TextureEntry>::const_iterator it = skins.textures.begin();it != skins.textures.end(); ++it) {
if (!(*it).resolved) { if (!(*it).resolved) {
DefaultLogger::get()->error("MD3: Failed to match skin " + (*it).first + " to surface " + (*it).second); ASSIMP_LOG_ERROR("MD3: Failed to match skin ", (*it).first, " to surface ", (*it).second);
} }
} }
} }

View File

@ -359,7 +359,7 @@ void MD5Importer::LoadMD5MeshFile ()
// Check whether we can read from the file // Check whether we can read from the file
if( file.get() == NULL || !file->FileSize()) { if( file.get() == NULL || !file->FileSize()) {
DefaultLogger::get()->warn("Failed to access MD5MESH file: " + pFile); ASSIMP_LOG_WARN("Failed to access MD5MESH file: " + pFile);
return; return;
} }
bHadMD5Mesh = true; bHadMD5Mesh = true;
@ -482,7 +482,7 @@ void MD5Importer::LoadMD5MeshFile ()
for (unsigned int jub = (*iter).mFirstWeight, w = jub; w < jub + (*iter).mNumWeights;++w) for (unsigned int jub = (*iter).mFirstWeight, w = jub; w < jub + (*iter).mNumWeights;++w)
fSum += meshSrc.mWeights[w].mWeight; fSum += meshSrc.mWeights[w].mWeight;
if (!fSum) { if (!fSum) {
DefaultLogger::get()->error("MD5MESH: The sum of all vertex bone weights is 0"); ASSIMP_LOG_ERROR("MD5MESH: The sum of all vertex bone weights is 0");
continue; continue;
} }
@ -574,7 +574,7 @@ void MD5Importer::LoadMD5AnimFile ()
// Check whether we can read from the file // Check whether we can read from the file
if( !file.get() || !file->FileSize()) { if( !file.get() || !file->FileSize()) {
DefaultLogger::get()->warn("Failed to read MD5ANIM file: " + pFile); ASSIMP_LOG_WARN("Failed to read MD5ANIM file: " + pFile);
return; return;
} }
LoadFileIntoMemory(file.get()); LoadFileIntoMemory(file.get());
@ -588,8 +588,7 @@ void MD5Importer::LoadMD5AnimFile ()
// generate and fill the output animation // generate and fill the output animation
if (animParser.mAnimatedBones.empty() || animParser.mFrames.empty() || if (animParser.mAnimatedBones.empty() || animParser.mFrames.empty() ||
animParser.mBaseFrames.size() != animParser.mAnimatedBones.size()) { animParser.mBaseFrames.size() != animParser.mAnimatedBones.size()) {
ASSIMP_LOG_ERROR("MD5ANIM: No frames or animated bones loaded");
DefaultLogger::get()->error("MD5ANIM: No frames or animated bones loaded");
} }
else { else {
bHadMD5Anim = true; bHadMD5Anim = true;

View File

@ -107,7 +107,7 @@ MD5Parser::MD5Parser(char* _buffer, unsigned int _fileSize )
{ {
char szBuffer[1024]; char szBuffer[1024];
::sprintf(szBuffer,"[MD5] Line %u: %s",line,warn); ::sprintf(szBuffer,"[MD5] Line %u: %s",line,warn);
DefaultLogger::get()->warn(szBuffer); ASSIMP_LOG_WARN(szBuffer);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -160,7 +160,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial* pMat,
break; break;
} }
if ( !IsSpace(*cur) ) { if ( !IsSpace(*cur) ) {
DefaultLogger::get()->error("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property" + std::string(pKey) +
" is a string; failed to parse a float array out of it."); " is a string; failed to parse a float array out of it.");
return AI_FAILURE; return AI_FAILURE;
} }
@ -233,7 +233,7 @@ aiReturn aiGetMaterialIntegerArray(const aiMaterial* pMat,
break; break;
} }
if(!IsSpace(*cur)) { if(!IsSpace(*cur)) {
DefaultLogger::get()->error("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property" + std::string(pKey) +
" is a string; failed to parse an integer array out of it."); " is a string; failed to parse an integer array out of it.");
return AI_FAILURE; return AI_FAILURE;
} }
@ -305,7 +305,7 @@ aiReturn aiGetMaterialString(const aiMaterial* pMat,
} }
else { else {
// TODO - implement lexical cast as well // TODO - implement lexical cast as well
DefaultLogger::get()->error("Material property" + std::string(pKey) + ASSIMP_LOG_ERROR("Material property" + std::string(pKey) +
" was found, but is no string" ); " was found, but is no string" );
return AI_FAILURE; return AI_FAILURE;
} }

View File

@ -177,7 +177,7 @@ void CatmullClarkSubdivider::Subdivide (
aiMesh* i = smesh[s]; aiMesh* i = smesh[s];
// FIX - mPrimitiveTypes might not yet be initialized // FIX - mPrimitiveTypes might not yet be initialized
if (i->mPrimitiveTypes && (i->mPrimitiveTypes & (aiPrimitiveType_LINE|aiPrimitiveType_POINT))==i->mPrimitiveTypes) { if (i->mPrimitiveTypes && (i->mPrimitiveTypes & (aiPrimitiveType_LINE|aiPrimitiveType_POINT))==i->mPrimitiveTypes) {
DefaultLogger::get()->debug("Catmull-Clark Subdivider: Skipping pure line/point mesh"); ASSIMP_LOG_DEBUG("Catmull-Clark Subdivider: Skipping pure line/point mesh");
if (discard_input) { if (discard_input) {
out[s] = i; out[s] = i;
@ -198,12 +198,12 @@ void CatmullClarkSubdivider::Subdivide (
// checking any ranges. // checking any ranges.
ai_assert(inmeshes.size()==outmeshes.size()&&inmeshes.size()==maptbl.size()); ai_assert(inmeshes.size()==outmeshes.size()&&inmeshes.size()==maptbl.size());
if (inmeshes.empty()) { if (inmeshes.empty()) {
DefaultLogger::get()->warn("Catmull-Clark Subdivider: Pure point/line scene, I can't do anything"); ASSIMP_LOG_WARN("Catmull-Clark Subdivider: Pure point/line scene, I can't do anything");
return; return;
} }
InternSubdivide(&inmeshes.front(),inmeshes.size(),&outmeshes.front(),num); InternSubdivide(&inmeshes.front(),inmeshes.size(),&outmeshes.front(),num);
for (unsigned int i = 0; i < maptbl.size(); ++i) { for (unsigned int i = 0; i < maptbl.size(); ++i) {
ai_assert(outmeshes[i]); ai_assert(nullptr != outmeshes[i]);
out[maptbl[i]] = outmeshes[i]; out[maptbl[i]] = outmeshes[i];
} }
@ -563,7 +563,7 @@ void CatmullClarkSubdivider::InternSubdivide (
// this invariant *must* hold if the vertex-to-face adjacency table is valid // this invariant *must* hold if the vertex-to-face adjacency table is valid
ai_assert(haveit); ai_assert(haveit);
if ( !haveit ) { if ( !haveit ) {
DefaultLogger::get()->warn( "OBJ: no name for material library specified." ); ASSIMP_LOG_WARN( "OBJ: no name for material library specified." );
} }
} }

View File

@ -869,7 +869,7 @@ inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
if(comp_data == nullptr) throw DeadlyImportError("GLTF: \"Open3DGC-compression\" must has \"compressedData\"."); if(comp_data == nullptr) throw DeadlyImportError("GLTF: \"Open3DGC-compression\" must has \"compressedData\".");
DefaultLogger::get()->info("GLTF: Decompressing Open3DGC data."); ASSIMP_LOG_INFO("GLTF: Decompressing Open3DGC data.");
/************** Read data from JSON-document **************/ /************** Read data from JSON-document **************/
#define MESH_READ_COMPRESSEDDATA_MEMBER(pFieldName, pOut) \ #define MESH_READ_COMPRESSEDDATA_MEMBER(pFieldName, pOut) \

View File

@ -568,7 +568,7 @@ void glTFExporter::ExportMeshes()
else else
msg = "mesh must has vertices and faces."; msg = "mesh must has vertices and faces.";
DefaultLogger::get()->warn("GLTF: can not use Open3DGC-compression: " + msg); ASSIMP_LOG_WARN_F("GLTF: can not use Open3DGC-compression: ", msg);
comp_allow = false; comp_allow = false;
} }

View File

@ -199,7 +199,7 @@ uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_ino
// numeric overflow, we rely on you // numeric overflow, we rely on you
if ( new_value < value ) { if ( new_value < value ) {
DefaultLogger::get()->warn( std::string( "Converting the string \"" ) + in + "\" into a value resulted in overflow." ); ASSIMP_LOG_WARN_F( "Converting the string \"", in, "\" into a value resulted in overflow." );
return 0; return 0;
} }