Commit bfe2f1a8 authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed warnings in obj reader

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13368 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e292b01b
......@@ -539,12 +539,16 @@ void FileOBJPlugin::readOBJFile(QString _filename, OBJImporter& _importer)
std::string keyWrd;
std::string nextKeyWrd = "";
#ifdef ENABLE_BSPLINECURVE_SUPPORT
unsigned int curveCount = 0;
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
unsigned int surfaceCount = 0;
#endif
float x, y, z, u, v;
int deg, index;
double knot;
int deg;
std::vector<VertexHandle> vhandles;
std::vector<int> face_texcoords;
......@@ -875,6 +879,8 @@ void FileOBJPlugin::readOBJFile(QString _filename, OBJImporter& _importer)
while ( !lineData.eof() && !lineData.fail() )
{
double knot;
lineData >> knot;
if ( !lineData.fail() )
......@@ -918,9 +924,13 @@ void FileOBJPlugin::readOBJFile(QString _filename, OBJImporter& _importer)
lineData >> trash;
}
// work on the line until nothing left to read
while ( !lineData.eof() && !lineData.fail() )
{
int index = 0;
lineData >> index;
if ( index < 0 ) {
......@@ -1000,6 +1010,8 @@ void FileOBJPlugin::readOBJFile(QString _filename, OBJImporter& _importer)
// work on the line until nothing left to read
while ( !lineData.eof() && !lineData.fail() )
{
double knot;
lineData >> knot;
......@@ -1041,6 +1053,8 @@ void FileOBJPlugin::readOBJFile(QString _filename, OBJImporter& _importer)
// work on the line until nothing left to read
while ( !lineData.eof() && !lineData.fail() )
{
int index = 0;
lineData >> index;
if ( index < 0 ) {
......@@ -1122,11 +1136,15 @@ void FileOBJPlugin::checkTypes(QString _filename, OBJImporter& _importer, QStrin
std::string keyWrd;
std::string nextKeyWrd = "";
#ifdef ENABLE_BSPLINECURVE_SUPPORT
unsigned int curveCount = 0;
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
unsigned int surfaceCount = 0;
#endif
float x, y, z;
int index;
int faceCount = 0;
int PolyMeshCount = 0;
......@@ -1324,6 +1342,8 @@ void FileOBJPlugin::checkTypes(QString _filename, OBJImporter& _importer, QStrin
// work on the line until nothing left to read
while ( !lineData.eof() && !lineData.fail() )
{
int index = 0;
lineData >> index;
if ( !lineData.fail() ){
......@@ -1384,6 +1404,8 @@ void FileOBJPlugin::checkTypes(QString _filename, OBJImporter& _importer, QStrin
// work on the line until nothing left to read
while ( !lineData.eof() && !lineData.fail() )
{
int index = 0;
lineData >> index;
if ( !lineData.fail() ){
......
......@@ -47,8 +47,6 @@
#include <iomanip>
typedef OpenMesh::Vec3f Vec3f;
/** \brief Material
*
* This class provides means to store materials
......@@ -58,16 +56,31 @@ class Material
{
public:
Material() { cleanup(); }
Material() :
localNum_(0),
Kd_is_set_(false),
Ka_is_set_(false),
Ks_is_set_(false),
Tr_(0.0),
Tr_is_set_(false),
map_Kd_(""),
index_Kd_(0),
map_Kd_is_set_(false)
{
}
void cleanup() {
localNum_ = 0;
Kd_is_set_ = false;
Ka_is_set_ = false;
Ks_is_set_ = false;
Tr_ = 0.0;
Tr_is_set_ = false;
map_Kd_ = "";
index_Kd_ = 0;
map_Kd_is_set_ = false;
localNum_ = 0;
}
bool is_valid(void) const
......@@ -109,15 +122,15 @@ class Material
/// Set diffuse color
void set_Kd( float r, float g, float b )
{ Kd_=Vec3f(r,g,b); Kd_is_set_=true; }
{ Kd_=OpenMesh::Vec3f(r,g,b); Kd_is_set_=true; }
/// Set ambient color
void set_Ka( float r, float g, float b )
{ Ka_=Vec3f(r,g,b); Ka_is_set_=true; }
{ Ka_=OpenMesh::Vec3f(r,g,b); Ka_is_set_=true; }
/// Set specular color
void set_Ks( float r, float g, float b )
{ Ks_=Vec3f(r,g,b); Ks_is_set_=true; }
{ Ks_=OpenMesh::Vec3f(r,g,b); Ks_is_set_=true; }
/// Set transparency value (between 0 and 1)
void set_Tr( float t )
......@@ -128,13 +141,13 @@ class Material
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
/// Get diffuse color
const Vec3f& Kd( void ) const { return Kd_; }
const OpenMesh::Vec3f& Kd( void ) const { return Kd_; }
/// Get ambient color
const Vec3f& Ka( void ) const { return Ka_; }
const OpenMesh::Vec3f& Ka( void ) const { return Ka_; }
/// Get specular color
const Vec3f& Ks( void ) const { return Ks_; }
const OpenMesh::Vec3f& Ks( void ) const { return Ks_; }
/// Get transparency value
float Tr( void ) const { return Tr_; }
......@@ -148,10 +161,10 @@ class Material
private:
unsigned int localNum_;
Vec3f Kd_; bool Kd_is_set_; // diffuse
Vec3f Ka_; bool Ka_is_set_; // ambient
Vec3f Ks_; bool Ks_is_set_; // specular
float Tr_; bool Tr_is_set_; // transperency
OpenMesh::Vec3f Kd_; bool Kd_is_set_; // diffuse
OpenMesh::Vec3f Ka_; bool Ka_is_set_; // ambient
OpenMesh::Vec3f Ks_; bool Ks_is_set_; // specular
float Tr_; bool Tr_is_set_; // transperency
std::string map_Kd_; int index_Kd_; bool map_Kd_is_set_; // Texture
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment