52 #ifndef __OBJREADER_HH__ 53 #define __OBJREADER_HH__ 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() { 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( 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 );
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,
VectorT< float, 3 > Vec3f
std::string get_extensions() const
std::string get_description() const
Returns a brief description of the file type that can be parsed.
Set options for reader/writer modules.