]> git.tdb.fi Git - libs/gl.git/commitdiff
Properly handle the case where an object doesn't have a main texture but its techniqu...
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Aug 2009 12:25:44 +0000 (12:25 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 3 Aug 2009 12:25:44 +0000 (12:25 +0000)
source/object.cpp
source/technique.h

index b53a3f0802767e9e6e80b7a6e1d0434aa4d0c474..2026e3d58f3d0b658ed4b3bdba7fe9d211d6ffd1 100644 (file)
@@ -132,6 +132,8 @@ Object::Loader::Loader(Object &o, Collection &c):
 
 void Object::Loader::finish()
 {
+       if(obj.technique && !obj.main_texture)
+               obj.main_texture=obj.technique->get_main_texture();
        for(unsigned i=0; i<obj.textures.size(); ++i)
        {
                if(!obj.textures[i])
index 410e7fb46928ad812cfe39187557fbe984647a6c..711db79dce2af54f4adb45e411caf3b82acd2b50 100644 (file)
@@ -66,6 +66,7 @@ public:
        unsigned get_n_textures() const { return tex_names.size(); }
        unsigned get_texture_index(const std::string &) const;
        const Texture *get_texture(unsigned) const;
+       const Texture *get_main_texture() const { return main_texture; }
        const Material *get_material() const { return material; }
 };