]> git.tdb.fi Git - libs/gl.git/blobdiff - source/object.cpp
Add a tool to convert a mesh into C code
[libs/gl.git] / source / object.cpp
index b53a3f0802767e9e6e80b7a6e1d0434aa4d0c474..a23aa433b92a8a2611b938af84342c9fce082400 100644 (file)
@@ -111,7 +111,7 @@ void Object::finish_render(const ObjectPass *pass) const
 void Object::render_instance(const ObjectInstance &inst, const Tag &tag) const
 {
        inst.setup_render(tag);
-       unsigned lod=min(inst.get_level_of_detail(), meshes.size()-1);
+       unsigned lod=min<unsigned>(inst.get_level_of_detail(), meshes.size()-1);
        meshes[lod]->draw();
        inst.finish_render(tag);
 }
@@ -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])
@@ -167,7 +169,7 @@ void Object::Loader::shader_texture(const string &n)
        if(!obj.technique)
                throw InvalidState("Can't specify shader textures without a Technique");
 
-       unsigned eqsign=n.find('=');
+       string::size_type eqsign=n.find('=');
        if(eqsign==string::npos)
                throw InvalidParameterValue("Must specify texture slot name");