]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/unlitmaterial.h
Implement an unlit material type
[libs/gl.git] / source / materials / unlitmaterial.h
diff --git a/source/materials/unlitmaterial.h b/source/materials/unlitmaterial.h
new file mode 100644 (file)
index 0000000..b8b2883
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef MSP_GL_UNLITMATERIAL_H_
+#define MSP_GL_UNLITMATERIAL_H_
+
+#include "material.h"
+
+namespace Msp {
+namespace GL {
+
+class UnlitMaterial: public Material
+{
+public:
+       class Loader: public DataFile::DerivedObjectLoader<UnlitMaterial, Material::PropertyLoader<UnlitMaterial> >
+       {
+       private:
+               static ActionMap shared_actions;
+
+       public:
+               Loader(UnlitMaterial &);
+               Loader(UnlitMaterial &, Collection &);
+
+       private:
+               virtual void init_actions();
+
+               void texture(const std::string &);
+       };
+
+private:
+       const Texture *texture;
+       Color tint;
+       bool vertex_color;
+
+public:
+       UnlitMaterial();
+
+protected:
+       virtual std::string create_program_source() const;
+
+public:
+       virtual void attach_textures_to(Texturing &, ProgramData &) const;
+
+       void set_texture(const Texture *);
+       void set_tint(const Color &);
+       void set_vertex_color(bool);
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif