57 #ifndef __OBJREADER_HH__
58 #define __OBJREADER_HH__
68 #include <OpenMesh/Core/System/config.h>
69 #include <OpenMesh/Core/Utils/SingletonT.hh>
70 #include <OpenMesh/Core/IO/importer/BaseImporter.hh>
71 #include <OpenMesh/Core/IO/reader/BaseReader.hh>
98 bool read(
const std::string& _filename,
102 bool read(std::istream& _in,
108 #ifndef DOXY_IGNORE_THIS
113 Material() { cleanup(); }
121 map_Kd_is_set_ =
false;
124 bool is_valid(
void)
const
125 {
return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_ || map_Kd_is_set_; }
127 bool has_Kd(
void) {
return Kd_is_set_; }
128 bool has_Ka(
void) {
return Ka_is_set_; }
129 bool has_Ks(
void) {
return Ks_is_set_; }
130 bool has_Tr(
void) {
return Tr_is_set_; }
131 bool has_map_Kd(
void) {
return map_Kd_is_set_; }
133 void set_Kd(
float r,
float g,
float b )
134 { Kd_=
Vec3f(r,g,b); Kd_is_set_=
true; }
136 void set_Ka(
float r,
float g,
float b )
137 { Ka_=
Vec3f(r,g,b); Ka_is_set_=
true; }
139 void set_Ks(
float r,
float g,
float b )
140 { Ks_=
Vec3f(r,g,b); Ks_is_set_=
true; }
142 void set_Tr(
float t )
143 { Tr_=t; Tr_is_set_=
true; }
145 void set_map_Kd( std::string _name,
int _index_Kd )
146 { map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ =
true; };
148 const Vec3f& Kd(
void )
const {
return Kd_; }
149 const Vec3f& Ka(
void )
const {
return Ka_; }
150 const Vec3f& Ks(
void )
const {
return Ks_; }
151 float Tr(
void )
const {
return Tr_; }
152 const std::string& map_Kd(
void ) {
return map_Kd_ ; }
153 const int& map_Kd_index(
void ) {
return index_Kd_ ; }
157 Vec3f Kd_;
bool Kd_is_set_;
158 Vec3f Ka_;
bool Ka_is_set_;
159 Vec3f Ks_;
bool Ks_is_set_;
160 float Tr_;
bool Tr_is_set_;
162 std::string map_Kd_;
int index_Kd_;
bool map_Kd_is_set_;
167 typedef std::map<std::string, Material> MaterialList;
169 MaterialList materials_;
171 bool read_material( std::fstream& _in );
183 extern _OBJReader_ __OBJReaderInstance;
184 OPENMESHDLLEXPORT _OBJReader_& OBJReader();
std::string get_extensions() const
Returns a string with the accepted file extensions separated by a whitespace and in small caps...
Definition: OBJReader.hh:96
Set options for reader/writer modules.
Definition: Options.hh:95
VectorT< float, 3 > Vec3f
3-float vector
Definition: Vector11T.hh:769
Base class for reader modules.
Definition: BaseReader.hh:94
std::string get_description() const
Returns a brief description of the file type that can be parsed.
Definition: OBJReader.hh:95
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Implementation of the OBJ format reader.
Definition: OBJReader.hh:87
Base class for importer modules.
Definition: BaseImporter.hh:88