]> git.tdb.fi Git - libs/gl.git/blobdiff - source/object.cpp
Drop Id tags and copyright notices from files
[libs/gl.git] / source / object.cpp
index f710a7a9c8c5ced2f2e6647c54a16848a90a7fe7..d573fdd4975695eddfd3d164eca0128d97936937 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2011  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include <msp/datafile/collection.h>
 #include <msp/strings/formatter.h>
 #include "except.h"
@@ -43,6 +36,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;
@@ -119,24 +120,25 @@ void Object::Loader::init()
 {
        allow_pointer_reload = false;
 
-       add("mesh",     static_cast<void (Loader::*)()>(&Loader::mesh));
-       add("mesh",     static_cast<void (Loader::*)(unsigned)>(&Loader::mesh));
-       add("mesh",     static_cast<void (Loader::*)(const std::string &)>(&Loader::mesh));
-       add("mesh",     static_cast<void (Loader::*)(unsigned, const std::string &)>(&Loader::mesh));
+       add("mesh",     &Loader::mesh_inline);
+       add("mesh",     &Loader::mesh_inline_lod);
+       add("mesh",     &Loader::mesh);
+       add("mesh",     &Loader::mesh_lod);
+       add("technique", &Loader::technique_inline);
+       add("technique", &Loader::technique);
+
        // Deprecated alias, will be removed
-       add("lod_mesh", static_cast<void (Loader::*)(unsigned, const std::string &)>(&Loader::mesh));
-       add("technique", static_cast<void (Loader::*)()>(&Loader::technique));
-       add("technique", static_cast<void (Loader::*)(const std::string &)>(&Loader::technique));
+       add("lod_mesh", &Loader::mesh_lod);
 }
 
-void Object::Loader::mesh()
+void Object::Loader::mesh_inline()
 {
        RefPtr<Mesh> msh = new Mesh;
        load_sub(*msh);
        obj.meshes.front() = msh;
 }
 
-void Object::Loader::mesh(unsigned l)
+void Object::Loader::mesh_inline_lod(unsigned l)
 {
        if(l>obj.meshes.size())
                throw InvalidParameterValue("LODs must be continuous");
@@ -154,12 +156,12 @@ void Object::Loader::mesh(const std::string &n)
        obj.set_mesh(get_collection().get<Mesh>(n));
 }
 
-void Object::Loader::mesh(unsigned l, const string &n)
+void Object::Loader::mesh_lod(unsigned l, const string &n)
 {
        obj.set_mesh(l, get_collection().get<Mesh>(n));
 }
 
-void Object::Loader::technique()
+void Object::Loader::technique_inline()
 {
        RefPtr<Technique> tech = new Technique;
        if(coll)