From: Mikko Rasa Date: Mon, 4 Apr 2011 16:45:35 +0000 (+0000) Subject: Add a method to get the mesh of an Object X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=188d9377dd077d495ce99b7751fecefbe2d6491a;p=libs%2Fgl.git Add a method to get the mesh of an Object --- diff --git a/source/object.cpp b/source/object.cpp index 86857a98..b66d2fd1 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -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; diff --git a/source/object.h b/source/object.h index 52338a16..af9d2d26 100644 --- a/source/object.h +++ b/source/object.h @@ -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(); }