prevented cast/unused/uninitialized warnings and some indentation work.
This commit is contained in:
parent
939da657a9
commit
08f9b6a4b3
|
|
@ -691,6 +691,8 @@ static Matrix44f getTransfMatrixFromNode(const QDomElement parentNode)
|
|||
|
||||
static int Open(OpenMeshType& m,const char* filename, InfoDAE& info, CallBackPos *cb=0)
|
||||
{
|
||||
(void)cb;
|
||||
|
||||
QDEBUG("----- Starting the processing of %s ------",filename);
|
||||
//AdditionalInfoDAE& inf = new AdditionalInfoDAE();
|
||||
//info = new InfoDAE();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
History
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.19 2008/01/17 18:02:02 cignoni
|
||||
|
|
@ -112,17 +112,17 @@ class ImporterOBJ
|
|||
{
|
||||
public:
|
||||
|
||||
typedef typename OpenMeshType::VertexPointer VertexPointer;
|
||||
typedef typename OpenMeshType::ScalarType ScalarType;
|
||||
typedef typename OpenMeshType::VertexType VertexType;
|
||||
typedef typename OpenMeshType::FaceType FaceType;
|
||||
typedef typename OpenMeshType::VertexIterator VertexIterator;
|
||||
typedef typename OpenMeshType::FaceIterator FaceIterator;
|
||||
typedef typename OpenMeshType::CoordType CoordType;
|
||||
typedef typename OpenMeshType::VertexPointer VertexPointer;
|
||||
typedef typename OpenMeshType::ScalarType ScalarType;
|
||||
typedef typename OpenMeshType::VertexType VertexType;
|
||||
typedef typename OpenMeshType::FaceType FaceType;
|
||||
typedef typename OpenMeshType::VertexIterator VertexIterator;
|
||||
typedef typename OpenMeshType::FaceIterator FaceIterator;
|
||||
typedef typename OpenMeshType::CoordType CoordType;
|
||||
|
||||
class Info
|
||||
{
|
||||
public:
|
||||
class Info
|
||||
{
|
||||
public:
|
||||
|
||||
Info()
|
||||
{
|
||||
|
|
@ -146,19 +146,19 @@ public:
|
|||
/// number of texture coords indexes
|
||||
int numTexCoords;
|
||||
|
||||
}; // end class
|
||||
}; // end class
|
||||
|
||||
|
||||
//struct OBJFacet
|
||||
//{
|
||||
// CoordType n;
|
||||
// CoordType t;
|
||||
// CoordType v[3];
|
||||
//
|
||||
// short attr; // material index
|
||||
//};
|
||||
struct ObjIndexedFace
|
||||
{
|
||||
//struct OBJFacet
|
||||
//{
|
||||
// CoordType n;
|
||||
// CoordType t;
|
||||
// CoordType v[3];
|
||||
//
|
||||
// short attr; // material index
|
||||
//};
|
||||
struct ObjIndexedFace
|
||||
{
|
||||
void set(const int & num){v.resize(num);n.resize(num); t.resize(num);}
|
||||
std::vector<int> v;
|
||||
std::vector<int> n;
|
||||
|
|
@ -166,15 +166,15 @@ struct ObjIndexedFace
|
|||
int tInd;
|
||||
bool edge[3];// useless if the face is a polygon, no need to have variable length array
|
||||
Color4b c;
|
||||
};
|
||||
};
|
||||
|
||||
struct ObjTexCoord
|
||||
{
|
||||
struct ObjTexCoord
|
||||
{
|
||||
float u;
|
||||
float v;
|
||||
};
|
||||
};
|
||||
|
||||
enum OBJError {
|
||||
enum OBJError {
|
||||
// Successfull opening
|
||||
E_NOERROR = 0x000, // 0 (position of correspondig string in the array)
|
||||
|
||||
|
|
@ -198,17 +198,17 @@ enum OBJError {
|
|||
E_BAD_VERT_INDEX = 0x01C, // 14
|
||||
E_BAD_VERT_TEX_INDEX = 0x01E, // 15
|
||||
E_BAD_VERT_NORMAL_INDEX = 0x020 // 16
|
||||
};
|
||||
};
|
||||
|
||||
// to check if a given error is critical or not.
|
||||
static bool ErrorCritical(int err)
|
||||
{
|
||||
// to check if a given error is critical or not.
|
||||
static bool ErrorCritical(int err)
|
||||
{
|
||||
if(err<0x00A && err>=0) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static const char* ErrorMsg(int error)
|
||||
{
|
||||
static const char* ErrorMsg(int error)
|
||||
{
|
||||
static const char* obj_error_msg[] =
|
||||
{
|
||||
"No errors", // 0
|
||||
|
|
@ -238,13 +238,13 @@ static const char* ErrorMsg(int error)
|
|||
|
||||
if(error>15 || error<0) return "Unknown error";
|
||||
else return obj_error_msg[error];
|
||||
};
|
||||
};
|
||||
|
||||
// Helper functions that checks the range of indexes
|
||||
// putting them in the correct range if less than zero (as in the obj style)
|
||||
// Helper functions that checks the range of indexes
|
||||
// putting them in the correct range if less than zero (as in the obj style)
|
||||
|
||||
static bool GoodObjIndex(int &index, const int maxVal)
|
||||
{
|
||||
static bool GoodObjIndex(int &index, const int maxVal)
|
||||
{
|
||||
if (index > maxVal) return false;
|
||||
if (index < 0)
|
||||
{
|
||||
|
|
@ -252,27 +252,27 @@ static bool GoodObjIndex(int &index, const int maxVal)
|
|||
if (index<0 || index > maxVal) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static int Open(OpenMeshType &mesh, const char *filename, int &loadmask, CallBackPos *cb=0)
|
||||
{
|
||||
static int Open(OpenMeshType &mesh, const char *filename, int &loadmask, CallBackPos *cb=0)
|
||||
{
|
||||
Info oi;
|
||||
oi.mask=-1;
|
||||
oi.cb=cb;
|
||||
int ret=Open(mesh,filename,oi);
|
||||
loadmask=oi.mask;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Opens an object file (in ascii format) and populates the mesh passed as first
|
||||
* accordingly to read data
|
||||
* \param m The mesh model to be populated with data stored into the file
|
||||
* \param filename The name of the file to be opened
|
||||
* \param oi A structure containing infos about the object to be opened
|
||||
*/
|
||||
static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||
{
|
||||
/*!
|
||||
* Opens an object file (in ascii format) and populates the mesh passed as first
|
||||
* accordingly to read data
|
||||
* \param m The mesh model to be populated with data stored into the file
|
||||
* \param filename The name of the file to be opened
|
||||
* \param oi A structure containing infos about the object to be opened
|
||||
*/
|
||||
static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||
{
|
||||
int result = E_NOERROR;
|
||||
|
||||
m.Clear();
|
||||
|
|
@ -677,17 +677,17 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
|||
}
|
||||
|
||||
return result;
|
||||
} // end of Open
|
||||
} // end of Open
|
||||
|
||||
|
||||
/*!
|
||||
* Read the next valid line and parses it into "tokens", allowing
|
||||
* the tokens to be read one at a time.
|
||||
* \param stream The object providing the input stream
|
||||
* \param tokens The "tokens" in the next line
|
||||
*/
|
||||
inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< std::string > &tokens)
|
||||
{
|
||||
/*!
|
||||
* Read the next valid line and parses it into "tokens", allowing
|
||||
* the tokens to be read one at a time.
|
||||
* \param stream The object providing the input stream
|
||||
* \param tokens The "tokens" in the next line
|
||||
*/
|
||||
inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< std::string > &tokens)
|
||||
{
|
||||
if(stream.eof()) return;
|
||||
std::string line;
|
||||
do
|
||||
|
|
@ -715,10 +715,10 @@ inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< st
|
|||
}
|
||||
}
|
||||
while (from<length);
|
||||
} // end TokenizeNextLine
|
||||
} // end TokenizeNextLine
|
||||
|
||||
inline static const void SplitToken(std::string token, int &vId, int &nId, int &tId, int mask)
|
||||
{
|
||||
inline static const void SplitToken(std::string token, int &vId, int &nId, int &tId, int mask)
|
||||
{
|
||||
std::string vertex;
|
||||
std::string texcoord;
|
||||
std::string normal;
|
||||
|
|
@ -731,15 +731,15 @@ inline static const void SplitToken(std::string token, int &vId, int &nId, int &
|
|||
vId = atoi(vertex.c_str()) - 1;
|
||||
if(mask & Mask::IOM_WEDGTEXCOORD) tId = atoi(texcoord.c_str()) - 1;
|
||||
if(mask & Mask::IOM_WEDGNORMAL) nId = atoi(normal.c_str()) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const void SplitVToken(std::string token, std::string &vertex)
|
||||
{
|
||||
inline static const void SplitVToken(std::string token, std::string &vertex)
|
||||
{
|
||||
vertex = token;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const void SplitVVTToken(std::string token, std::string &vertex, std::string &texcoord)
|
||||
{
|
||||
inline static const void SplitVVTToken(std::string token, std::string &vertex, std::string &texcoord)
|
||||
{
|
||||
vertex.clear();
|
||||
texcoord.clear();
|
||||
|
||||
|
|
@ -765,10 +765,10 @@ inline static const void SplitVVTToken(std::string token, std::string &vertex, s
|
|||
++to;
|
||||
}
|
||||
}
|
||||
} // end of SplitVVTToken
|
||||
} // end of SplitVVTToken
|
||||
|
||||
inline static const void SplitVVNToken(std::string token, std::string &vertex, std::string &normal)
|
||||
{
|
||||
inline static const void SplitVVNToken(std::string token, std::string &vertex, std::string &normal)
|
||||
{
|
||||
vertex.clear();
|
||||
normal.clear();
|
||||
|
||||
|
|
@ -795,10 +795,10 @@ inline static const void SplitVVNToken(std::string token, std::string &vertex, s
|
|||
++to;
|
||||
}
|
||||
}
|
||||
} // end of SplitVVNToken
|
||||
} // end of SplitVVNToken
|
||||
|
||||
inline static const void SplitVVTVNToken(std::string token, std::string &vertex, std::string &texcoord, std::string &normal)
|
||||
{
|
||||
inline static const void SplitVVTVNToken(std::string token, std::string &vertex, std::string &texcoord, std::string &normal)
|
||||
{
|
||||
vertex.clear();
|
||||
texcoord.clear();
|
||||
normal.clear();
|
||||
|
|
@ -831,7 +831,7 @@ inline static const void SplitVVTVNToken(std::string token, std::string &vertex,
|
|||
++to;
|
||||
}
|
||||
}
|
||||
} // end of SplitVVTVNToken
|
||||
} // end of SplitVVTVNToken
|
||||
|
||||
/*!
|
||||
* Retrieves infos about kind of data stored into the file and fills a mask appropriately
|
||||
|
|
@ -840,8 +840,8 @@ inline static const void SplitVVTVNToken(std::string token, std::string &vertex,
|
|||
* \param oi A structure which will be filled with infos about the object to be opened
|
||||
*/
|
||||
|
||||
static bool LoadMask(const char * filename, Info &oi)
|
||||
{
|
||||
static bool LoadMask(const char * filename, Info &oi)
|
||||
{
|
||||
std::ifstream stream(filename);
|
||||
if (stream.fail()) return false;
|
||||
|
||||
|
|
@ -893,15 +893,15 @@ static bool LoadMask(const char * filename, Info &oi)
|
|||
if (bHasNormals) oi.mask |= vcg::tri::io::Mask::IOM_WEDGNORMAL;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool LoadMask(const char * filename, int &mask)
|
||||
{
|
||||
static bool LoadMask(const char * filename, int &mask)
|
||||
{
|
||||
Info oi;
|
||||
bool ret=LoadMask(filename, oi);
|
||||
mask= oi.mask;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static bool LoadMaterials(const char * filename, std::vector<Material> &materials, std::vector<std::string> &textures)
|
||||
{
|
||||
|
|
@ -916,7 +916,7 @@ static bool LoadMask(const char * filename, int &mask)
|
|||
|
||||
materials.clear();
|
||||
Material currentMaterial;
|
||||
currentMaterial.index = -1;
|
||||
currentMaterial.index = (unsigned int)(-1);
|
||||
|
||||
bool first = true;
|
||||
while (!stream.eof())
|
||||
|
|
@ -935,7 +935,7 @@ static bool LoadMask(const char * filename, int &mask)
|
|||
{
|
||||
materials.push_back(currentMaterial);
|
||||
currentMaterial = Material();
|
||||
currentMaterial.index = -1;
|
||||
currentMaterial.index = (unsigned int)(-1);
|
||||
}
|
||||
else
|
||||
first = false;
|
||||
|
|
|
|||
|
|
@ -638,7 +638,7 @@ namespace io {
|
|||
if(fnameV != nameV) return VMI_INCOMPATIBLE_VERTEX_TYPE;
|
||||
if(fnameF != nameF) return VMI_INCOMPATIBLE_FACE_TYPE;
|
||||
|
||||
int offsetV,offsetF;
|
||||
int offsetV=0,offsetF=0;
|
||||
|
||||
if(vertSize!=0)
|
||||
/* read the address of the first vertex */
|
||||
|
|
|
|||
Loading…
Reference in New Issue