c46a21dfd26bc6e1be69ead43fc739d5b9018a0c
[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 #define NUM_MTL_TEXTURES        MTL_TEX_UNKNOWN
20
21 class Material {
22 public:
23         std::string name;
24         Vec3 diffuse, specular;
25         float shininess;
26         float alpha;
27
28         Texture *stdtex[NUM_MTL_TEXTURES];
29         std::vector<Texture*> textures;
30
31         Material();
32         void setup() const;
33
34         void add_texture(Texture *tex, int type = MTL_TEX_UNKNOWN);
35         void remove_texture(Texture *tex);
36 };
37
38 // returns MTL_TEX_whatever by name
39 int mtl_parse_type(const char *str);
40 // returns the name of a material type
41 const char *mtl_type_string(int type);
42
43 #endif  // MATERIAL_H_