From: Mikko Rasa Date: Wed, 15 Aug 2012 19:31:03 +0000 (+0300) Subject: Add a function to query if a Technique has any shaders X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=7b671e6899949d095698425a9b33387e7eb13894 Add a function to query if a Technique has any shaders Also make PassMap public since it's exposed through get_passes --- diff --git a/source/technique.cpp b/source/technique.cpp index fcb2ffe5..aa27d99c 100644 --- a/source/technique.cpp +++ b/source/technique.cpp @@ -28,6 +28,14 @@ const RenderPass &Technique::get_pass(const GL::Tag &tag) const return get_item(passes, tag); } +bool Technique::has_shaders() const +{ + for(PassMap::const_iterator i=passes.begin(); i!=passes.end(); ++i) + if(i->second.get_shader_program()) + return true; + return false; +} + Technique::Loader::Loader(Technique &t): DataFile::CollectionObjectLoader(t, 0) diff --git a/source/technique.h b/source/technique.h index f908fe86..ad988c27 100644 --- a/source/technique.h +++ b/source/technique.h @@ -37,8 +37,10 @@ private: void texture(const std::string &, const std::string &); }; +public: typedef std::map PassMap; +private: PassMap passes; public: @@ -46,6 +48,7 @@ public: bool has_pass(const GL::Tag &) const; const RenderPass &get_pass(const GL::Tag &) const; const PassMap &get_passes() const { return passes; } + bool has_shaders() const; }; } // namespace GL