44 #ifndef DOXY_IGNORE_THIS 86 illum_is_set_ =
false;
91 map_Kd_is_set_ =
false;
94 bool is_valid(
void)
const 95 {
return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_; }
98 bool has_Kd(
void) {
return Kd_is_set_; }
101 bool has_Ka(
void) {
return Ka_is_set_; }
104 bool has_Ks(
void) {
return Ks_is_set_; }
107 bool has_Ke(
void) {
return Ke_is_set_; }
110 bool has_Ni(
void) {
return Ni_is_set_; }
113 bool has_Ns(
void) {
return Ns_is_set_; }
116 bool has_illum(
void) {
return illum_is_set_; }
119 bool has_Tr(
void) {
return Tr_is_set_; }
122 bool has_Texture()
const {
return map_Kd_is_set_; }
125 bool operator== (Material& _mat) {
126 if( _mat.Kd_ != Kd_ ||
133 _mat.map_Kd_ != map_Kd_ ||
134 _mat.index_Kd_ != index_Kd_ )
140 bool operator!= (Material& _mat) {
return !(*
this == _mat); }
143 int material_number()
const {
return localNum_; }
144 void material_number(
unsigned int _n) { localNum_ = _n; }
147 void set_Kd(
float r,
float g,
float b )
151 void set_Ka(
float r,
float g,
float b )
155 void set_Ks(
float r,
float g,
float b )
159 void set_Ke(
float r,
float g,
float b )
163 void set_Ni(
float t )
164 { Ni_=t; Ni_is_set_=
true; }
167 void set_Ns(
float t )
168 { Ns_=t; Ns_is_set_=
true; }
171 void set_illum(
int t )
172 { illum_=t; illum_is_set_=
true; }
175 void set_Tr(
float t )
176 { Tr_=t; Tr_is_set_=
true; }
179 void set_map_Kd( std::string _name,
int _index_Kd )
180 { map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ =
true; }
195 float Ni(
void )
const {
return Ni_; }
198 float Ns(
void )
const {
return Ns_; }
201 int illum(
void )
const {
return illum_; }
204 bool isRefractive(
void)
const {
return (illum_ == 4 || illum_ == 6 || illum_ == 7 || illum_ == 9);}
207 float Tr(
void )
const {
return Tr_; }
210 const std::string& map_Kd(
void ) {
return map_Kd_ ; }
213 const int& map_Kd_index(
void ) {
return index_Kd_ ; }
217 unsigned int localNum_;
222 float Ni_;
bool Ni_is_set_;
223 float Ns_;
bool Ns_is_set_;
224 int illum_;
bool illum_is_set_;
225 float Tr_;
bool Tr_is_set_;
227 std::string map_Kd_;
int index_Kd_;
bool map_Kd_is_set_;
231 operator<< (std::ostream& _os,
const Material& _mat) {
232 _os <<
"mat" << std::setfill(
'0') << std::setw(3) << _mat.material_number();
237 typedef std::map<std::string, Material> MaterialList;
VectorT< float, 3 > Vec3f