]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/EffectBuilder.cxx
Random buildings - initial commit.
[simgear.git] / simgear / scene / material / EffectBuilder.cxx
index 32168a9c9562b46593175c7b245171ec24233213..635fde3608c7fd82b6111aaa88de2fdca7598339 100644 (file)
@@ -2,6 +2,9 @@
 #  include <simgear_config.h>
 #endif
 
+#include <simgear/scene/util/SGReaderWriterOptions.hxx>
+#include <simgear/scene/tgdb/userdata.hxx>
+
 #include <simgear/math/SGMath.hxx>
 
 #include "EffectBuilder.hxx"
@@ -39,6 +42,34 @@ const SGPropertyNode* getEffectPropertyChild(Effect* effect,
         return getEffectPropertyNode(effect, child);
 }
 
+string getGlobalProperty(const SGPropertyNode* prop,
+                         const SGReaderWriterOptions* options)
+{
+    if (!prop)
+        return string();
+    const SGPropertyNode* useProp = prop->getChild("use");
+    if (!useProp)
+        return string();
+    string propName = useProp->getStringValue();
+    SGPropertyNode_ptr propRoot;
+    if (propName[0] == '/') {
+        return propName;
+    } else if ((propRoot = options->getPropertyNode())) {
+        string result = propRoot->getPath();
+        result.append("/");
+        result.append(propName);
+        return result;
+    } else {
+        throw effect::
+            BuilderException("No property root to use with relative name "
+                             + propName);
+    }
+        
+    return useProp->getStringValue();
+}
+
+namespace effect
+{
 BuilderException::BuilderException()
 {
 }
@@ -56,5 +87,29 @@ BuilderException::BuilderException(const std::string& message,
 
 BuilderException::~BuilderException() throw()
 {
+
+}
 }
+
+bool isAttributeActive(Effect* effect, const SGPropertyNode* prop)
+{
+    const SGPropertyNode* activeProp
+        = getEffectPropertyChild(effect, prop, "active");
+    return !activeProp || activeProp->getValue<bool>();
 }
+
+namespace effect
+{
+const char* colorFields[] = {"red", "green", "blue", "alpha"};
+}
+  
+PassAttributeBuilder::~PassAttributeBuilder()
+{
+}
+  
+} // of namespace simgear
+
+
+
+
+