Helios++
Helios software for LiDAR simulations
Material.h
1 #pragma once
2 
3 #include <string>
4 
5 #include <boost/archive/text_iarchive.hpp>
6 #include <boost/archive/text_oarchive.hpp>
7 
11 class Material {
12  // *** SERIALIZATION *** //
13  // *********************** //
14  friend class boost::serialization::access;
15  template<class Archive>
16  void serialize(Archive &ar, const unsigned int version) {
17  ar & name;
18  ar & isGround;
19  ar & useVertexColors;
20  ar & matFilePath;
21  ar & map_Kd;
22  ar & reflectance;
23  ar & specularity;
24  ar & specularExponent;
25  ar & spectra;
26  ar & ka & kd & ks;
27  }
28 public:
29  // *** ATTRIBUTES *** //
30  // ******************** //
34  std::string name = "default";
38  bool isGround = true;
44  bool useVertexColors = false;
48  std::string matFilePath;
53  std::string map_Kd = "";
57  double reflectance = 0;
62  double specularity = 0;
66  double specularExponent = 10;
71  int classification = 0;
72 
79  std::string spectra = "";
80 
84  float ka[4] = { 0, 0, 0, 0 };
88  float kd[4] = { 0, 0, 0, 0 };
92  float ks[4] = { 0, 0, 0, 0 };
93 
94  // *** CONSTRUCTION / DESTRUCTION *** //
95  // ************************************ //
99  Material() = default;
100  Material(const Material &sp);
101  virtual ~Material() {}
102 
103  // *** M E T H O D S *** //
104  // *********************** //
121  float* getKd(float factor);
135  void setSpecularity();
136 
137 #ifdef PYTHON_BINDING
138 
142  inline float getKa0() {return ka[0];}
147  inline void setKa0(double ka0) {ka[0] = ka0;}
152  inline float getKa1() {return ka[1];}
157  inline void setKa1(double ka1) {ka[1] = ka1;}
162  inline float getKa2() {return ka[2];}
167  inline void setKa2(double ka2) {ka[2] = ka2;}
172  inline float getKa3() {return ka[3];}
177  inline void setKa3(double ka3) {ka[3] = ka3;}
182  inline float getKd0() {return kd[0];}
187  inline void setKd0(double kd0) {kd[0] = kd0;}
192  inline float getKd1() {return kd[1];}
197  inline void setKd1(double kd1) {kd[1] = kd1;}
202  inline float getKd2() {return kd[2];}
207  inline void setKd2(double kd2) {kd[2] = kd2;}
212  inline float getKd3() {return kd[3];}
217  inline void setKd3(double kd3) {kd[3] = kd3;}
222  inline float getKs0() {return ks[0];}
227  inline void setKs0(double ks0) {ks[0] = ks0;}
232  inline float getKs1() {return ks[1];}
237  inline void setKs1(double ks1) {ks[1] = ks1;}
242  inline float getKs2() {return ks[2];}
247  inline void setKs2(double ks2) {ks[2] = ks2;}
252  inline float getKs3() {return ks[3];}
257  inline void setKs3(double ks3) {ks[3] = ks3;}
258 #endif
259 
260 };
float getKs3()
PyHelios getter to get fourth specular component.
Definition: Material.h:252
float getKd1()
PyHelios getter to obtain second diffuse component.
Definition: Material.h:192
void setKa1(double ka1)
PyHelios setter to set second ambient component.
Definition: Material.h:157
int classification
Material classification.
Definition: Material.h:71
float getKd3()
PyHelios getter to obtain fourth diffuse component.
Definition: Material.h:212
float getKs1()
PyHelios getter to obtain second specular component.
Definition: Material.h:232
void setKa3(double ka3)
PyHelios setter to set fourth ambient component.
Definition: Material.h:177
double specularExponent
Material specular exponent.
Definition: Material.h:66
std::string name
Material name.
Definition: Material.h:34
void setKs2(double ks2)
PyHelios setter to set third specular component.
Definition: Material.h:247
void setKa2(double ka2)
PyHelios setter to obtain third ambient component.
Definition: Material.h:167
float getKs0()
PyHelios getter to obtain first specular component.
Definition: Material.h:222
bool isGround
Flag specifying if material is ground (true) or not (false)
Definition: Material.h:38
void setKd1(double kd1)
PyHelios setter to obtain second diffuse component.
Definition: Material.h:197
std::string spectra
Material spectra, used to find material reflectance when using spectral library.
Definition: Material.h:79
float getKa3()
PyHelios getter to obtain fourth ambient component.
Definition: Material.h:172
void setKd2(double kd2)
PyHelios setter to set third diffuse component.
Definition: Material.h:207
float getKd2()
PyHelios getter to obtain third diffuse component.
Definition: Material.h:202
float ks[4]
Material specular components.
Definition: Material.h:92
double specularity
Material specularity.
Definition: Material.h:62
double reflectance
Material reflectance.
Definition: Material.h:57
std::string matFilePath
Path to the file containing material definition.
Definition: Material.h:48
float * getKd(float factor)
Obtain specular component.
Definition: Material.cpp:27
float getKd0()
PyHelios getter to obtain first diffuse component.
Definition: Material.h:182
Class representing a material specification.
Definition: Material.h:11
float getKa2()
PyHelios getter to obtain third ambient component.
Definition: Material.h:162
void setKd0(double kd0)
PyHelios setter to set first diffuse component.
Definition: Material.h:187
float getKa0()
PyHelios getter to obtain first ambient component.
Definition: Material.h:142
void setKs3(double ks3)
PyHelios setter to set fourth specular component.
Definition: Material.h:257
void setKa0(double ka0)
PyHelios setter to set first ambient component.
Definition: Material.h:147
void setKs0(double ks0)
PyHelios setter to set first specular component.
Definition: Material.h:227
bool useVertexColors
Flag specifying if use vertex colors (true) or not (false). Color usage is at the moment excluded fro...
Definition: Material.h:44
float getKs2()
PyHelios getter to get third specular component.
Definition: Material.h:242
float kd[4]
Material diffuse components.
Definition: Material.h:88
float getKa1()
PyHelios getter to obtain second ambient component.
Definition: Material.h:152
std::string map_Kd
This attribute is currently not being used and might be discarded in the future.
Definition: Material.h:53
float ka[4]
Material ambient components.
Definition: Material.h:84
void setKs1(double ks1)
PyHelios setter to set second specular component.
Definition: Material.h:237
void setKd3(double kd3)
PyHelios setter to set fourth diffuse component.
Definition: Material.h:217
void setSpecularity()
Compute the specularity .
Definition: Material.cpp:35
Material()=default
Material default constructor.