]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a method to get the mesh of an Object
authorMikko Rasa <tdb@tdb.fi>
Mon, 4 Apr 2011 16:45:35 +0000 (16:45 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 4 Apr 2011 16:45:35 +0000 (16:45 +0000)
source/object.cpp
source/object.h

index 86857a9842f10d7523cc1361527df29a07f0941f..b66d2fd117a5b7e0a4bf7465baa76aa1dfacf19a 100644 (file)
@@ -43,6 +43,14 @@ void Object::set_mesh(unsigned i, const Mesh *m)
        meshes[i].keep();
 }
 
+const Mesh *Object::get_mesh(unsigned i) const
+{
+       if(i>=meshes.size())
+               return 0;
+
+       return meshes[i].get();
+}
+
 void Object::set_technique(const Technique *t)
 {
        technique = t;
index 52338a1657b7af5cc0f2df7bd1c989ac224ecb42..af9d2d26e42656a4fd8ad3c5a7115c4f996f686b 100644 (file)
@@ -57,6 +57,7 @@ public:
 
        void set_mesh(const Mesh *m) { set_mesh(0, m); }
        void set_mesh(unsigned, const Mesh *);
+       const Mesh *get_mesh(unsigned = 0) const;
        void set_technique(const Technique *);
        const Technique *get_technique() const { return technique.get(); }