]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/Effect.hxx
Improved tile cache priority scheme.
[simgear.git] / simgear / scene / material / Effect.hxx
index 1f33b9e86d61209f7a0b1f6cb5c4a08b7aa64446..59eea81d8027fe18b4d08276d21df493527e9d01 100644 (file)
@@ -45,6 +45,7 @@ namespace simgear
 {
 class Technique;
 class Effect;
+class SGReaderWriterXMLOptions;
 
 /**
  * Object to be initialized at some point after an effect -- and its
@@ -79,6 +80,18 @@ public:
     Effect(const Effect& rhs,
            const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
     osg::StateSet* getDefaultStateSet();
+
+    // Define what needs to be generated for this effect
+    enum Generator
+    {
+        NORMAL,
+        TANGENT,
+        BINORMAL
+    };
+    void setGenerator(Generator what, int where) { generator[what] = where; }
+    int getGenerator(Generator what) const;  // Returns -1 if generator should not be used
+    std::map<Generator, int> generator;  // What is generated into which attribute location
+
     std::vector<osg::ref_ptr<Technique> > techniques;
     SGPropertyNode_ptr root;
     // Pointer to the parameters node, if it exists
@@ -89,7 +102,7 @@ public:
     /**
      * Build the techniques from the effect properties.
      */
-    bool realizeTechniques(const osgDB::ReaderWriter::Options* options = 0);
+    bool realizeTechniques(const SGReaderWriterXMLOptions* options = 0);
     /**
      * Updaters that should be derefed when the effect is
      * deleted. Updaters arrange to be run by listening on properties
@@ -144,7 +157,7 @@ protected:
     Cache* _cache;
     friend size_t hash_value(const Key& key);
     friend Effect* makeEffect(SGPropertyNode* prop, bool realizeTechniques,
-                              const osgDB::ReaderWriter::Options* options);
+                              const SGReaderWriterXMLOptions* options);
     bool _isRealized;
 };
 // Automatic support for boost hash function
@@ -153,11 +166,11 @@ size_t hash_value(const Effect::Key&);
 
 Effect* makeEffect(const std::string& name,
                    bool realizeTechniques,
-                   const osgDB::ReaderWriter::Options* options = 0);
+                   const SGReaderWriterXMLOptions* options = 0);
 
 Effect* makeEffect(SGPropertyNode* prop,
                    bool realizeTechniques,
-                   const osgDB::ReaderWriter::Options* options = 0);
+                   const SGReaderWriterXMLOptions* options = 0);
 
 bool makeParametersFromStateSet(SGPropertyNode* paramRoot,
                                 const osg::StateSet* ss);