TDME2  1.9.200
SpecularMaterialProperties.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
6 #include <tdme/engine/fwd-tdme.h>
8 #include <tdme/engine/Color4.h>
9 #include <tdme/math/Matrix3x3.h>
10 
11 using std::string;
12 
16 
17 /**
18  * Represents specular material properties
19  * @author andreas.drewke
20  */
22 {
23 
24 private:
29  float shininess;
30  float reflection;
47 
48  /**
49  * Checks and set ups diffuse texture transparency
50  */
52 
53 public:
54  // forbid class copy
56 
57  /**
58  * Public constructor
59  */
61 
62  /**
63  * Destructor
64  */
66 
67  /**
68  * @return ambient color
69  */
70  inline const Color4& getAmbientColor() const {
71  return ambientColor;
72  }
73 
74  /**
75  * Set ambient color component
76  * @param ambientColor ambient color
77  */
78  inline void setAmbientColor(const Color4& ambientColor) {
79  this->ambientColor = ambientColor;
80  }
81 
82  /**
83  * @return diffuse color
84  */
85  inline const Color4& getDiffuseColor() const {
86  return diffuseColor;
87  }
88 
89  /**
90  * Set diffuse color component
91  * @param diffuseColor diffuse color
92  */
93  inline void setDiffuseColor(const Color4& diffuseColor) {
94  this->diffuseColor = diffuseColor;
95  }
96 
97  /**
98  * @return specular color
99  */
100  inline const Color4& getSpecularColor() const {
101  return specularColor;
102  }
103 
104  /**
105  * Set specular color component
106  * @param specularColor specular color
107  */
108  inline void setSpecularColor(const Color4& specularColor) {
109  this->specularColor = specularColor;
110  }
111 
112  /**
113  * @return emission color
114  */
115  inline const Color4& getEmissionColor() const {
116  return emissionColor;
117  }
118 
119  /**
120  * Set emission color component
121  * @param emissionColor emission color
122  */
123  inline void setEmissionColor(const Color4& emissionColor) {
124  this->emissionColor = emissionColor;
125  }
126 
127  /**
128  * @return shininess
129  */
130  inline float getShininess() const {
131  return shininess;
132  }
133 
134  /**
135  * Set up material shininess
136  * @param shininess shininess
137  */
138  inline void setShininess(float shininess) {
139  this->shininess = shininess;
140  }
141 
142  /**
143  * @return reflection
144  */
145  inline float getReflection() const {
146  return reflection;
147  }
148 
149  /**
150  * Set up material reflection
151  * @param reflection reflection
152  */
153  inline void setReflection(float reflection) {
154  this->reflection = reflection;
155  }
156 
157  /**
158  * @return texture atlas size
159  */
160  inline int32_t getTextureAtlasSize() const {
161  return textureAtlasSize;
162  }
163 
164  /**
165  * Set texture atlas size
166  * @param textureAtlasSize texture atlas size
167  */
168  inline void setTextureAtlasSize(int32_t textureAtlasSize) {
169  this->textureAtlasSize = textureAtlasSize;
170  }
171 
172  /**
173  * @return diffuse texture path name
174  */
175  inline const string& getDiffuseTexturePathName() const {
176  return diffuseTexturePathName;
177  }
178 
179  /**
180  * Set diffuse texture path name
181  * @param diffuseTexturePathName diffuse texture path name
182  */
184  this->diffuseTexturePathName = diffuseTexturePathName;
185  }
186 
187  /**
188  * @return diffuse texture file name
189  */
190  inline const string& getDiffuseTextureFileName() const {
191  return diffuseTextureFileName;
192  }
193 
194  /**
195  * Set diffuse texture file name
196  * @return diffuseTextureFileName diffuse texture file name
197  */
199  this->diffuseTextureFileName = diffuseTextureFileName;
200  }
201 
202  /**
203  * @return diffuse transparency texture path name
204  */
205  inline const string& getDiffuseTransparencyTexturePathName() const {
207  }
208 
209  /**
210  * @return diffuse transparency texture file name
211  */
212  inline const string& getDiffuseTransparencyTextureFileName() const {
214  }
215 
216  /**
217  * Set up a diffuse texture by the texture itself
218  * @param diffuseTexture diffuse texture
219  */
221 
222  /**
223  * Set up a diffuse texture
224  * @param pathName path name
225  * @param fileName file name
226  * @param transparencyPathName transparency path name
227  * @param transparencyFileName transparency file name
228  */
229  void setDiffuseTexture(const string& pathName, const string& fileName, const string& transparencyPathName = string(), const string& transparencyFileName = string());
230 
231  /**
232  * @return if material has a diffuse texture
233  */
234  inline bool hasDiffuseTexture() const {
235  return diffuseTexture != nullptr;
236  }
237 
238  /**
239  * @return the material's diffuse texture
240  */
241  inline Texture* getDiffuseTexture() const {
242  return diffuseTexture;
243  }
244 
245  /**
246  * @return diffuse texture has transparent pixels
247  */
248  inline bool hasDiffuseTextureTransparency() const {
250  }
251 
252  /**
253  * @return diffuse texture has masked transparency, means pixel are eighter opaque or not visible
254  */
257  }
258 
259  /**
260  * Set if diffuse texture uses masked transparency(means pixel are eighter opaque or not visible)
261  * @param maskedTransparency masked transparency
262  */
263  inline void setDiffuseTextureMaskedTransparency(bool maskedTransparency) {
264  diffuseTextureMaskedTransparency = maskedTransparency;
265  }
266 
267  /**
268  * @return diffuse masked transparency threshold
269  */
272  }
273 
274  /**
275  * Set diffuse texture masked transparency threshold
276  * @param maskedTransparencyThreshold diffuse texture masked transparency threshold
277  */
278  inline void setDiffuseTextureMaskedTransparencyThreshold(float maskedTransparencyThreshold) {
279  diffuseTextureMaskedTransparencyThreshold = maskedTransparencyThreshold;
280  }
281 
282  /**
283  * @return specular texture path name
284  */
285  inline const string& getSpecularTexturePathName() const {
287  }
288 
289  /**
290  * Set specular texture path name
291  * @param specularTexturePathName specular texture path name
292  */
294  this->specularTexturePathName = specularTexturePathName;
295  }
296 
297  /**
298  * @return specular texture file name
299  */
300  inline const string& getSpecularTextureFileName() const {
302  }
303 
304  /**
305  * Set specular texture file name
306  * @return specularTextureFileName specular texture file name
307  */
309  this->specularTextureFileName = specularTextureFileName;
310  }
311 
312  /**
313  * Set up a specular texture by the texture itself
314  * @param specularTexture specular texture
315  */
317 
318  /**
319  * Set up a specular texture
320  * @param pathName path name
321  * @param fileName file name
322  */
323  void setSpecularTexture(const string& pathName, const string& fileName);
324 
325  /**
326  * @return if material has a specular texture
327  */
328  inline bool hasSpecularTexture() const {
329  return specularTexture != nullptr;
330  }
331 
332  /**
333  * @return the material's specular texture
334  */
335  inline Texture* getSpecularTexture() const {
336  return specularTexture;
337  }
338 
339  /**
340  * @return normal texture path name
341  */
342  inline const string& getNormalTexturePathName() const {
343  return normalTexturePathName;
344  }
345 
346  /**
347  * Set normal texture path name
348  * @param normalTexturePathName normal texture path name
349  */
350  inline void setNormalTexturePathName(const string& normalTexturePathName) {
351  this->normalTexturePathName = normalTexturePathName;
352  }
353 
354  /**
355  * @return normal texture file name
356  */
357  inline const string& getNormalTextureFileName() const {
358  return normalTextureFileName;
359  }
360 
361  /**
362  * Set normal texture file name
363  * @return normalTextureFileName normal texture file name
364  */
365  inline void setNormalTextureFileName(const string& normalTextureFileName) {
366  this->normalTextureFileName = specularTextureFileName;
367  }
368 
369  /**
370  * Set up a normal texture by the texture itself
371  * @param normalTexture normal texture
372  */
374 
375  /**
376  * Set up a normal texture
377  * @param pathName path name
378  * @param fileName file name
379  */
380  void setNormalTexture(const string& pathName, const string& fileName);
381 
382  /**
383  * @return if material has a normal texture
384  */
385  inline bool hasNormalTexture() const {
386  return normalTexture != nullptr;
387  }
388 
389  /**
390  * @return the material's normal texture
391  */
392  inline Texture* getNormalTexture() const {
393  return normalTexture;
394  }
395 
396  /**
397  * @return if color is transparent
398  */
399  inline bool hasColorTransparency() const {
400  return diffuseColor.getAlpha() < 1.0f - Math::EPSILON;
401  }
402 
403  /**
404  * @return diffuse texture has transparency
405  */
408  }
409 
410  /**
411  * Set diffuse texture transparency
412  * @param diffuseTextureTransparency diffuse texture has transparency
413  */
414  inline void setDiffuseTextureTransparency(bool textureTransparency) {
415  diffuseTextureTransparency = textureTransparency;
416  }
417 
418  /**
419  * @return if texture has transparency with masked transparency disabled
420  */
421  inline bool hasTextureTransparency() const {
423  }
424 
425  /**
426  * @return texture matrix
427  */
428  const Matrix3x3& getTextureMatrix() const {
429  return textureMatrix;
430  }
431 
432  /**
433  * Set texture matrix
434  * @param texture matrix
435  */
437  this->textureMatrix = textureMatrix;
438  }
439 
440 };
Color 4 definition class.
Definition: Color4.h:18
float getAlpha() const
Definition: Color4.h:137
Texture entity.
Definition: Texture.h:24
Represents specular material properties.
void setAmbientColor(const Color4 &ambientColor)
Set ambient color component.
void checkDiffuseTextureTransparency()
Checks and set ups diffuse texture transparency.
void setDiffuseColor(const Color4 &diffuseColor)
Set diffuse color component.
void setDiffuseTextureTransparency(bool textureTransparency)
Set diffuse texture transparency.
void setEmissionColor(const Color4 &emissionColor)
Set emission color component.
void setDiffuseTextureMaskedTransparency(bool maskedTransparency)
Set if diffuse texture uses masked transparency(means pixel are eighter opaque or not visible)
void setDiffuseTexturePathName(const string &diffuseTexturePathName)
Set diffuse texture path name.
void setSpecularColor(const Color4 &specularColor)
Set specular color component.
void setNormalTextureFileName(const string &normalTextureFileName)
Set normal texture file name.
void setNormalTexturePathName(const string &normalTexturePathName)
Set normal texture path name.
void setSpecularTextureFileName(const string &specularTextureFileName)
Set specular texture file name.
void setDiffuseTextureMaskedTransparencyThreshold(float maskedTransparencyThreshold)
Set diffuse texture masked transparency threshold.
void setDiffuseTextureFileName(const string &diffuseTextureFileName)
Set diffuse texture file name.
void setSpecularTexture(Texture *specularTexture)
Set up a specular texture by the texture itself.
void setDiffuseTexture(Texture *diffuseTexture)
Set up a diffuse texture by the texture itself.
void setNormalTexture(Texture *normalTexture)
Set up a normal texture by the texture itself.
void setSpecularTexturePathName(const string &specularTexturePathName)
Set specular texture path name.
void setTextureAtlasSize(int32_t textureAtlasSize)
Set texture atlas size.
void setReflection(float reflection)
Set up material reflection.
void setTextureMatrix(const Matrix3x3 &textureMatrix)
Set texture matrix.
void setShininess(float shininess)
Set up material shininess.
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Definition: Matrix3x3.h:20
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6