a1244d4bd46f844bc0d8434a83af804f4936925e
[laserbrain_demo] / src / material.h
1 #ifndef MATERIAL_H_
2 #define MATERIAL_H_
3
4 #include <vector>
5 #include <string>
6 #include <gmath/gmath.h>
7 #include "texture.h"
8
9 enum {
10         MTL_TEX_DIFFUSE,
11         MTL_TEX_SPECULAR,
12         MTL_TEX_NORMALMAP,
13         MTL_TEX_LIGHTMAP,
14         MTL_TEX_ENVMAP,
15
16         MTL_TEX_UNKNOWN
17 };
18
19 enum {
20         MTL_MIRROR_NONE,
21         MTL_MIRROR_AUTO,                // determine mirror plane automatically
22         MTL_MIRROR_AABB_PX,             // plane = AABB +X side
23         MTL_MIRROR_AABB_NX,             // plane = AABB -X side
24         MTL_MIRROR_AABB_PY,             // plane = AABB +Y side
25         MTL_MIRROR_AABB_NY,             // plane = AABB -Y side
26         MTL_MIRROR_AABB_PZ,             // plane = AABB +Z side
27         MTL_MIRROR_AABB_NZ              // plane = AABB -Z side
28 };
29
30 #define NUM_MTL_TEXTURES        MTL_TEX_UNKNOWN
31
32 class Material {
33 public:
34         std::string name;
35         Vec3 diffuse, specular;
36         float shininess;
37         float alpha;
38
39         float reflect;
40         int flat_mirror;        // see MTL_MIRROR_* enumerations above
41
42         Texture *stdtex[NUM_MTL_TEXTURES];
43         std::vector<Texture*> textures;
44
45         Material();
46         void setup() const;
47
48         void add_texture(Texture *tex, int type = MTL_TEX_UNKNOWN);
49         void remove_texture(Texture *tex);
50 };
51
52 // returns MTL_TEX_whatever by name
53 int mtl_parse_type(const char *str);
54 // returns the name of a material type
55 const char *mtl_type_string(int type);
56
57 #endif  // MATERIAL_H_