erebus
view liberebus/src/material.h @ 45:bab25c0ce337
started gmath conversion
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 29 Dec 2015 12:19:53 +0200 |
parents | |
children |
line source
1 #ifndef MATERIAL_H_
2 #define MATERIAL_H_
4 #include <string>
5 #include <map>
6 #include "color.h"
7 #include "texture.h"
9 class MatAttrib {
10 private:
11 float value;
12 Color color;
13 Texture *map;
15 public:
16 MatAttrib();
17 explicit MatAttrib(const Color &color, Texture *tex = 0);
19 void set_value(float val);
20 void set_color(const Color &col);
22 void set_map(Texture *tex);
23 Texture *get_map() const;
25 float get_value() const;
26 float get_value(float u, float v) const;
27 const Color &get_color() const;
28 Color get_color(float u, float v) const;
29 };
31 class Material {
32 private:
33 static MatAttrib def_attrib;
34 std::map<std::string, MatAttrib> attrib;
36 public:
37 Material();
39 void set_attrib(const char *name, const Color &color, Texture *tex = 0);
40 MatAttrib &get_attrib(const char *name);
41 const MatAttrib &get_attrib(const char *name) const;
43 float get_attrib_value(const char *name) const;
44 float get_attrib_value(const char *name, float u, float v) const;
45 Color get_attrib_color(const char *name) const;
46 Color get_attrib_color(const char *name, float u, float v) const;
47 };
50 #endif // MATERIAL_H_