Browse Source

New RenderPath APIs

    /// Return true of any of render targets or commands with specified tag are enabled.
    bool IsEnabled(const String& tag) const;
    /// Return true if renderpath or command with given tag exists.
    bool IsAdded(const String& tag) const;
Rokas Kupstys 8 years ago
parent
commit
6045a86345
2 changed files with 40 additions and 0 deletions
  1. 36 0
      Source/Urho3D/Graphics/RenderPath.cpp
  2. 4 0
      Source/Urho3D/Graphics/RenderPath.h

+ 36 - 0
Source/Urho3D/Graphics/RenderPath.cpp

@@ -379,6 +379,42 @@ void RenderPath::SetEnabled(const String& tag, bool active)
     }
 }
 
+bool RenderPath::IsEnabled(const String& tag) const
+{
+    bool enabled = false;
+    for (unsigned i = 0; i < renderTargets_.Size() && !enabled; ++i)
+    {
+        if (!renderTargets_[i].tag_.Compare(tag, false))
+            enabled |= renderTargets_[i].enabled_;
+    }
+
+    for (unsigned i = 0; i < commands_.Size() && !enabled; ++i)
+    {
+        if (!commands_[i].tag_.Compare(tag, false))
+            enabled |= commands_[i].enabled_;
+    }
+
+    return enabled;
+}
+
+bool RenderPath::IsAdded(const String& tag) const
+{
+    bool enabled = false;
+    for (unsigned i = 0; i < renderTargets_.Size() && !enabled; ++i)
+    {
+        if (!renderTargets_[i].tag_.Compare(tag, false))
+            enabled |= true;
+    }
+
+    for (unsigned i = 0; i < commands_.Size() && !enabled; ++i)
+    {
+        if (!commands_[i].tag_.Compare(tag, false))
+            enabled |= true;
+    }
+
+    return enabled;
+}
+
 void RenderPath::ToggleEnabled(const String& tag)
 {
     for (unsigned i = 0; i < renderTargets_.Size(); ++i)

+ 4 - 0
Source/Urho3D/Graphics/RenderPath.h

@@ -227,6 +227,10 @@ public:
     bool Append(XMLFile* file);
     /// Enable/disable commands and rendertargets by tag.
     void SetEnabled(const String& tag, bool active);
+    /// Return true of any of render targets or commands with specified tag are enabled.
+    bool IsEnabled(const String& tag) const;
+    /// Return true if renderpath or command with given tag exists.
+    bool IsAdded(const String& tag) const;
     /// Toggle enabled state of commands and rendertargets by tag.
     void ToggleEnabled(const String& tag);
     /// Assign rendertarget at index.