]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/animation.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / animation.hxx
index 9262926e13a37c8f27adaa4d66df4487907efdcc..048d991f513a9ce31b0e341b48d673f59d5c9511 100644 (file)
@@ -35,13 +35,11 @@ SGExpressiond*
 read_value(const SGPropertyNode* configNode, SGPropertyNode* modelRoot,
            const char* unit, double defMin, double defMax);
 
-void readRotationCenterAndAxis(const SGPropertyNode* configNode, SGVec3d& center, SGVec3d& axis);
 SGVec3d readTranslateAxis(const SGPropertyNode* configNode);
 
-//////////////////////////////////////////////////////////////////////
-// Base class for animation installers
-//////////////////////////////////////////////////////////////////////
-
+/**
+ * Base class for animation installers
+ */
 class SGAnimation : protected osg::NodeVisitor {
 public:
   SGAnimation(const SGPropertyNode* configNode, SGPropertyNode* modelRoot);
@@ -50,7 +48,7 @@ public:
   static bool animate(osg::Node* node, const SGPropertyNode* configNode,
                       SGPropertyNode* modelRoot,
                       const osgDB::Options* options,
-                      const string &path, int i);
+                      const std::string &path, int i);
 
 protected:
   void apply(osg::Node* node);
@@ -60,6 +58,23 @@ protected:
 
   virtual void apply(osg::Group& group);
 
+  /**
+   * Read a 3d vector from the configuration property node.
+   *
+   * Reads values from @a name/[xyz]@a prefix and defaults to the according
+   * value of @a def for each value which is not set.
+   *
+   * @param name    Name of the root node containing all coordinates
+   * @param suffix  Suffix appended to each child node (x,y,z)
+   * @param def     Vector containing default values
+   */
+  SGVec3d readVec3( const std::string& name,
+                    const std::string& suffix = "",
+                    const SGVec3d& def = SGVec3d::zeros() ) const;
+  void readRotationCenterAndAxis(SGVec3d& center, SGVec3d& axis) const;
+
+  SGExpressiond* readOffsetValue(const char* tag_name) const;
+
   void removeMode(osg::Node& node, osg::StateAttribute::GLMode mode);
   void removeAttribute(osg::Node& node, osg::StateAttribute::Type type);
   void removeTextureMode(osg::Node& node, unsigned unit,
@@ -100,7 +115,7 @@ private:
   bool _enableHOT;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Null animation installer
 //////////////////////////////////////////////////////////////////////
@@ -111,7 +126,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Translate animation installer
 //////////////////////////////////////////////////////////////////////
@@ -129,7 +144,7 @@ private:
   double _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Rotate/Spin animation installer
 //////////////////////////////////////////////////////////////////////
@@ -148,7 +163,7 @@ private:
   bool _isSpin;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -166,7 +181,7 @@ private:
   SGVec3d _center;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -179,7 +194,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -193,7 +208,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -206,7 +221,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Range animation installer
 //////////////////////////////////////////////////////////////////////
@@ -224,7 +239,7 @@ private:
   SGVec2d _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Select animation installer
 //////////////////////////////////////////////////////////////////////
@@ -236,7 +251,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Alpha test animation installer
 //////////////////////////////////////////////////////////////////////
@@ -248,7 +263,7 @@ public:
   virtual void install(osg::Node& node);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Blend animation installer
 //////////////////////////////////////////////////////////////////////
@@ -265,7 +280,7 @@ private:
   SGSharedPtr<SGExpressiond> _animationValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Timed animation installer
 //////////////////////////////////////////////////////////////////////
@@ -279,7 +294,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shadow animation installer
 //////////////////////////////////////////////////////////////////////
@@ -293,7 +308,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // TextureTransform animation
 //////////////////////////////////////////////////////////////////////
@@ -314,7 +329,7 @@ private:
                        UpdateCallback* updateCallback);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shader animation
 //////////////////////////////////////////////////////////////////////
@@ -329,7 +344,7 @@ private:
   class UpdateCallback;
   osg::ref_ptr<osg::Texture2D> _effect_texture;
 };
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Light animation
 //////////////////////////////////////////////////////////////////////
@@ -339,11 +354,11 @@ public:
   SGLightAnimation(const SGPropertyNode* configNode,
                    SGPropertyNode* modelRoot,
                    const osgDB::Options* options,
-                   const string &path, int i);
+                   const std::string &path, int i);
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
   virtual void install(osg::Node& node);
 private:
-  string _light_type;
+  std::string _light_type;
   SGVec3d _position;
   SGVec3d _direction;
   SGVec4d _ambient;
@@ -354,7 +369,7 @@ private:
   double _cutoff;
   double _near;
   double _far;
-  string _key;
+  std::string _key;
   class UpdateCallback;
   friend class UpdateCallback;
   SGSharedPtr<SGExpressiond> _animationValue;