From df1f68d366e145716225f1a4dd223b0129280fb2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 10 Jan 2011 18:59:56 +0000 Subject: [PATCH] Rename some Loader methods to avoid having to static_cast the pointers --- source/object.cpp | 23 ++++++++++++----------- source/object.h | 8 ++++---- source/renderpass.cpp | 6 +++--- source/renderpass.h | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/source/object.cpp b/source/object.cpp index f710a7a9..86857a98 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -119,24 +119,25 @@ void Object::Loader::init() { allow_pointer_reload = false; - add("mesh", static_cast(&Loader::mesh)); - add("mesh", static_cast(&Loader::mesh)); - add("mesh", static_cast(&Loader::mesh)); - add("mesh", static_cast(&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(&Loader::mesh)); - add("technique", static_cast(&Loader::technique)); - add("technique", static_cast(&Loader::technique)); + add("lod_mesh", &Loader::mesh_lod); } -void Object::Loader::mesh() +void Object::Loader::mesh_inline() { RefPtr 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 +155,12 @@ void Object::Loader::mesh(const std::string &n) obj.set_mesh(get_collection().get(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(n)); } -void Object::Loader::technique() +void Object::Loader::technique_inline() { RefPtr tech = new Technique; if(coll) diff --git a/source/object.h b/source/object.h index e84bc9cf..52338a16 100644 --- a/source/object.h +++ b/source/object.h @@ -44,11 +44,11 @@ public: void init(); private: - void mesh(); - void mesh(unsigned); + void mesh_inline(); + void mesh_inline_lod(unsigned); void mesh(const std::string &); - void mesh(unsigned, const std::string &); - void technique(); + void mesh_lod(unsigned, const std::string &); + void technique_inline(); void technique(const std::string &); }; diff --git a/source/renderpass.cpp b/source/renderpass.cpp index b67be717..8c4048ca 100644 --- a/source/renderpass.cpp +++ b/source/renderpass.cpp @@ -74,8 +74,8 @@ void RenderPass::Loader::init() allow_pointer_reload = false; add("shader", &RenderPass::shprog); - add("material", static_cast(&Loader::material)); - add("material", static_cast(&Loader::material)); + add("material", &Loader::material_inline); + add("material", &Loader::material); add("texunit", &Loader::texunit); add("uniforms", &Loader::uniforms); } @@ -87,7 +87,7 @@ void RenderPass::Loader::finish() obj.shdata = new ProgramData; } -void RenderPass::Loader::material() +void RenderPass::Loader::material_inline() { RefPtr mat = new Material; load_sub(*mat); diff --git a/source/renderpass.h b/source/renderpass.h index 688327bb..405b813b 100644 --- a/source/renderpass.h +++ b/source/renderpass.h @@ -40,7 +40,7 @@ public: private: void init(); virtual void finish(); - void material(); + void material_inline(); void material(const std::string &); void texunit(unsigned); void uniforms(); -- 2.45.2