X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fobject.cpp;h=f23f66584880d0bd18a4bf55d9eaf6cc0dba3e7e;hb=b5dd2b141640b2483cc290d99cdc2a0bf72be1b4;hp=b66d2fd117a5b7e0a4bf7465baa76aa1dfacf19a;hpb=188d9377dd077d495ce99b7751fecefbe2d6491a;p=libs%2Fgl.git diff --git a/source/object.cpp b/source/object.cpp index b66d2fd1..f23f6658 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -1,13 +1,5 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007-2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include -#include -#include "except.h" +#include #include "material.h" #include "mesh.h" #include "object.h" @@ -27,6 +19,12 @@ Object::Object(): meshes(1) { } +Object::Object(const Mesh *m, const Technique *t) +{ + set_mesh(m); + set_technique(t); +} + Object::~Object() { } @@ -34,7 +32,7 @@ Object::~Object() void Object::set_mesh(unsigned i, const Mesh *m) { if(i>meshes.size()) - throw InvalidParameterValue("LODs must be continuous"); + throw invalid_argument("Object::set_mesh"); if(i==meshes.size()) meshes.push_back(m); @@ -125,8 +123,6 @@ Object::Loader::Loader(Object &o, Collection &c): void Object::Loader::init() { - allow_pointer_reload = false; - add("mesh", &Loader::mesh_inline); add("mesh", &Loader::mesh_inline_lod); add("mesh", &Loader::mesh); @@ -148,7 +144,7 @@ void Object::Loader::mesh_inline() void Object::Loader::mesh_inline_lod(unsigned l) { if(l>obj.meshes.size()) - throw InvalidParameterValue("LODs must be continuous"); + throw invalid_argument("Object::Loader::mesh_inline_lod"); RefPtr msh = new Mesh; load_sub(*msh); @@ -160,12 +156,12 @@ void Object::Loader::mesh_inline_lod(unsigned l) void Object::Loader::mesh(const std::string &n) { - obj.set_mesh(get_collection().get(n)); + obj.set_mesh(&get_collection().get(n)); } void Object::Loader::mesh_lod(unsigned l, const string &n) { - obj.set_mesh(l, get_collection().get(n)); + obj.set_mesh(l, &get_collection().get(n)); } void Object::Loader::technique_inline() @@ -180,7 +176,7 @@ void Object::Loader::technique_inline() void Object::Loader::technique(const std::string &n) { - obj.set_technique(get_collection().get(n)); + obj.set_technique(&get_collection().get(n)); } } // namespace GL