simple ubershader system, reflection debugging
[laserbrain_demo] / src / material.h
index f5c26ae..4ca5c7d 100644 (file)
@@ -1,16 +1,57 @@
 #ifndef MATERIAL_H_
 #define MATERIAL_H_
 
+#include <vector>
+#include <string>
 #include <gmath/gmath.h>
+#include "texture.h"
+
+enum {
+       MTL_TEX_DIFFUSE,
+       MTL_TEX_SPECULAR,
+       MTL_TEX_NORMALMAP,
+       MTL_TEX_LIGHTMAP,
+       MTL_TEX_REFLECT,
+
+       MTL_TEX_UNKNOWN
+};
+
+enum {
+       MTL_MIRROR_NONE,
+       MTL_MIRROR_AUTO,                // determine mirror plane automatically
+       MTL_MIRROR_AABB_PX,             // plane = AABB +X side
+       MTL_MIRROR_AABB_NX,             // plane = AABB -X side
+       MTL_MIRROR_AABB_PY,             // plane = AABB +Y side
+       MTL_MIRROR_AABB_NY,             // plane = AABB -Y side
+       MTL_MIRROR_AABB_PZ,             // plane = AABB +Z side
+       MTL_MIRROR_AABB_NZ              // plane = AABB -Z side
+};
+
+#define NUM_MTL_TEXTURES       MTL_TEX_UNKNOWN
 
 class Material {
 public:
+       std::string name;
        Vec3 diffuse, specular;
        float shininess;
        float alpha;
 
+       float reflect;
+       int flat_mirror;        // see MTL_MIRROR_* enumerations above
+
+       Texture *stdtex[NUM_MTL_TEXTURES];
+       std::vector<Texture*> textures;
+
        Material();
        void setup() const;
+
+       void add_texture(Texture *tex, int type = MTL_TEX_UNKNOWN);
+       void remove_texture(Texture *tex);
 };
 
+// returns MTL_TEX_whatever by name
+int mtl_parse_type(const char *str);
+// returns the name of a material type
+const char *mtl_type_string(int type);
+
 #endif // MATERIAL_H_