erebus
annotate liberebus/src/material.h @ 48:9971a08f4104
merged
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 24 Feb 2016 00:29:31 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@4 | 1 #ifndef MATERIAL_H_ |
nuclear@4 | 2 #define MATERIAL_H_ |
nuclear@4 | 3 |
nuclear@4 | 4 #include <string> |
nuclear@4 | 5 #include <map> |
nuclear@4 | 6 #include "color.h" |
nuclear@4 | 7 #include "texture.h" |
nuclear@4 | 8 |
nuclear@4 | 9 class MatAttrib { |
nuclear@4 | 10 private: |
nuclear@4 | 11 float value; |
nuclear@4 | 12 Color color; |
nuclear@4 | 13 Texture *map; |
nuclear@4 | 14 |
nuclear@4 | 15 public: |
nuclear@4 | 16 MatAttrib(); |
nuclear@4 | 17 explicit MatAttrib(const Color &color, Texture *tex = 0); |
nuclear@4 | 18 |
nuclear@4 | 19 void set_value(float val); |
nuclear@4 | 20 void set_color(const Color &col); |
nuclear@4 | 21 |
nuclear@4 | 22 void set_map(Texture *tex); |
nuclear@4 | 23 Texture *get_map() const; |
nuclear@4 | 24 |
nuclear@4 | 25 float get_value() const; |
nuclear@4 | 26 float get_value(float u, float v) const; |
nuclear@4 | 27 const Color &get_color() const; |
nuclear@4 | 28 Color get_color(float u, float v) const; |
nuclear@4 | 29 }; |
nuclear@4 | 30 |
nuclear@4 | 31 class Material { |
nuclear@4 | 32 private: |
nuclear@4 | 33 static MatAttrib def_attrib; |
nuclear@4 | 34 std::map<std::string, MatAttrib> attrib; |
nuclear@4 | 35 |
nuclear@4 | 36 public: |
nuclear@4 | 37 Material(); |
nuclear@4 | 38 |
nuclear@4 | 39 void set_attrib(const char *name, const Color &color, Texture *tex = 0); |
nuclear@4 | 40 MatAttrib &get_attrib(const char *name); |
nuclear@4 | 41 const MatAttrib &get_attrib(const char *name) const; |
nuclear@4 | 42 |
nuclear@4 | 43 float get_attrib_value(const char *name) const; |
nuclear@4 | 44 float get_attrib_value(const char *name, float u, float v) const; |
nuclear@4 | 45 Color get_attrib_color(const char *name) const; |
nuclear@4 | 46 Color get_attrib_color(const char *name, float u, float v) const; |
nuclear@4 | 47 }; |
nuclear@4 | 48 |
nuclear@4 | 49 |
nuclear@4 | 50 #endif // MATERIAL_H_ |