52 #ifndef __OBJREADER_HH__ 
   53 #define __OBJREADER_HH__ 
   63 #include <OpenMesh/Core/System/config.h> 
   64 #include <OpenMesh/Core/Utils/SingletonT.hh> 
   65 #include <OpenMesh/Core/IO/importer/BaseImporter.hh> 
   66 #include <OpenMesh/Core/IO/reader/BaseReader.hh> 
   93   bool read(
const std::string& _filename,
 
   97   bool read(std::istream& _in,
 
  103 #ifndef DOXY_IGNORE_THIS 
  108     Material():Tr_(0),index_Kd_(0) { cleanup(); }
 
  116       map_Kd_is_set_ = 
false;
 
  119     bool is_valid(
void)
 const 
  120     { 
return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_ || map_Kd_is_set_; }
 
  122     bool has_Kd(
void)     { 
return Kd_is_set_;     }
 
  123     bool has_Ka(
void)     { 
return Ka_is_set_;     }
 
  124     bool has_Ks(
void)     { 
return Ks_is_set_;     }
 
  125     bool has_Tr(
void)     { 
return Tr_is_set_;     }
 
  126     bool has_map_Kd(
void) { 
return map_Kd_is_set_; }
 
  128     void set_Kd( 
float r, 
float g, 
float b )
 
  129     { Kd_=
Vec3f(r,g,b); Kd_is_set_=
true; }
 
  131     void set_Ka( 
float r, 
float g, 
float b )
 
  132     { Ka_=
Vec3f(r,g,b); Ka_is_set_=
true; }
 
  134     void set_Ks( 
float r, 
float g, 
float b )
 
  135     { Ks_=
Vec3f(r,g,b); Ks_is_set_=
true; }
 
  137     void set_Tr( 
float t )
 
  138     { Tr_=t;            Tr_is_set_=
true; }
 
  140     void set_map_Kd( 
const std::string& _name, 
int _index_Kd )
 
  141     { map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = 
true; };
 
  143     const Vec3f& Kd( 
void )
 const { 
return Kd_; }
 
  144     const Vec3f& Ka( 
void )
 const { 
return Ka_; }
 
  145     const Vec3f& Ks( 
void )
 const { 
return Ks_; }
 
  146     float  Tr( 
void )
 const { 
return Tr_; }
 
  147     const std::string& map_Kd( 
void ) { 
return map_Kd_ ; }
 
  148     const int& map_Kd_index( 
void ) { 
return index_Kd_ ; }
 
  152     Vec3f Kd_;                          
bool Kd_is_set_; 
 
  153     Vec3f Ka_;                          
bool Ka_is_set_; 
 
  154     Vec3f Ks_;                          
bool Ks_is_set_; 
 
  155     float Tr_;                          
bool Tr_is_set_; 
 
  157     std::string map_Kd_; 
int index_Kd_; 
bool map_Kd_is_set_; 
 
  162   typedef std::map<std::string, Material> MaterialList;
 
  164   MaterialList materials_;
 
  166   bool read_material( std::fstream& _in );
 
  171   bool read_vertices(std::istream& _in, BaseImporter& _bi, Options& _opt,
 
  172                      std::vector<Vec3f> & normals,
 
  173                      std::vector<Vec3f> & colors,
 
  174                      std::vector<Vec3f> & texcoords3d,
 
  175                      std::vector<Vec2f> & texcoords,
 
  176                      std::vector<VertexHandle> & vertexHandles,
 
  177                      Options & fileOptions);
 
  187 extern _OBJReader_  __OBJReaderInstance;
 
  188 OPENMESHDLLEXPORT _OBJReader_& OBJReader();
 
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
 
VectorT< float, 3 > Vec3f
3-float vector
Definition: Vector11T.hh:850
 
Base class for importer modules.
Definition: BaseImporter.hh:84
 
Set options for reader/writer modules.
Definition: Options.hh:91
 
Base class for reader modules.
Definition: BaseReader.hh:87
 
Implementation of the OBJ format reader.
Definition: OBJReader.hh:83
 
std::string get_extensions() const override
Returns a string with the accepted file extensions separated by a whitespace and in small caps.
Definition: OBJReader.hh:91
 
std::string get_description() const override
Returns a brief description of the file type that can be parsed.
Definition: OBJReader.hh:90