]> git.tdb.fi Git - libs/gl.git/blobdiff - source/material.h
Disallow drawing batches without an index buffer
[libs/gl.git] / source / material.h
index df55a56767c6318ad9f6f3effed314520604fcd7..5515f29eee539a211059fb15f6869332659c1224 100644 (file)
@@ -6,11 +6,11 @@
 #include <msp/datafile/objectloader.h>
 #include "color.h"
 #include "programdata.h"
+#include "texture.h"
 
 namespace Msp {
 namespace GL {
 
-class Texture;
 class Texturing;
 
 class Material
@@ -82,6 +82,11 @@ protected:
 public:
        virtual ~Material() { }
 
+       virtual Program *create_compatible_shader() const;
+       virtual const Program *create_compatible_shader(DataFile::Collection &) const;
+protected:
+       virtual std::string create_program_source() const = 0;
+
 public:
        /** Returns the uniforms for the material. */
        const ProgramData &get_shader_data() const { return shdata; }
@@ -163,7 +168,9 @@ void Material::LoaderBase<C>::property_value_srgb_alpha(void (C::*set_value)(con
 template<typename C>
 void Material::LoaderBase<C>::property_texture(void (C::*set_texture)(const Texture *), const std::string &name)
 {
-       (static_cast<C &>(obj).*set_texture)(&get_collection().get<GL::Texture>(name));
+       /* The static_cast around get_collection is needed because otherwise Android
+       SDK's g++ 4.9 fails to parse get<Texture> as a template function call */
+       (static_cast<C &>(obj).*set_texture)(&static_cast<Collection &>(get_collection()).get<Texture>(name));
 }