From 8b9b47e71cfd3ca1a9c3b8f9574ab460c9a8f437 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Aug 2011 22:57:16 +0000 Subject: Improved OBJ reader warning messages, by Thorn --- src/model/objfile.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/model') diff --git a/src/model/objfile.cc b/src/model/objfile.cc index aa6b6cf..56d3692 100644 --- a/src/model/objfile.cc +++ b/src/model/objfile.cc @@ -75,6 +75,7 @@ bool OBJFile::read() math::Vector3f zero; size_t current_m = 0; + size_t index_line = 0; Fragment *fragment = 0; Material *material = 0; @@ -82,6 +83,8 @@ bool OBJFile::read() while (objfile_ifs.getline(data, sizeof(data) - 1)) { std::istringstream line(data); + index_line++; + std::string word; line >> word; @@ -115,7 +118,7 @@ bool OBJFile::read() } } else - con_warn << "Invalid material definition" << std::endl; + con_warn << objfile_name << " invalid material definition at line " << index_line << std::endl; } else if( word.compare("v") == 0) { /* New wertex */ @@ -197,7 +200,7 @@ bool OBJFile::read() } if(points.size() != 4 && points.size() != 3) { - con_warn << "Warning! " << objfile_name << ": Faces without 3 or 4 vertices will be ignored!" << std::endl; + con_warn << objfile_name << " face with " << points.size() << " vertices at line " << index_line << std::endl; points.clear(); continue; } @@ -219,7 +222,7 @@ bool OBJFile::read() if(points.size() == 3) { if(!v0 || !v1 || !v2) { - con_warn << "Warning! " << objfile_name << ": Invalid vertex!" << std::endl; + con_warn << objfile_name << " invalid vertex called from line " << index_line << std::endl; continue; } @@ -243,7 +246,7 @@ bool OBJFile::read() } else if(points.size() == 4) { if(!v0 || !v1 || !v2 || !v3) { - con_warn << "Warning! " << objfile_name << ": Invalid vertex!" << std::endl; + con_warn << objfile_name << " invalid vertex called from line " << index_line << std::endl; continue; } -- cgit v1.2.3