From 7b671e6899949d095698425a9b33387e7eb13894 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 15 Aug 2012 22:31:03 +0300 Subject: [PATCH] Add a function to query if a Technique has any shaders Also make PassMap public since it's exposed through get_passes --- source/technique.cpp | 8 ++++++++ source/technique.h | 3 +++ 2 files changed, 11 insertions(+) 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 -- 2.43.0