]> 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 31696192a44f4fba2c829669d807f2927f57abd4..048d991f513a9ce31b0e341b48d673f59d5c9511 100644 (file)
 SGExpressiond*
 read_value(const SGPropertyNode* configNode, SGPropertyNode* modelRoot,
            const char* unit, double defMin, double defMax);
-\f
-//////////////////////////////////////////////////////////////////////
-// Base class for animation installers
-//////////////////////////////////////////////////////////////////////
 
+SGVec3d readTranslateAxis(const SGPropertyNode* configNode);
+
+/**
+ * Base class for animation installers
+ */
 class SGAnimation : protected osg::NodeVisitor {
 public:
   SGAnimation(const SGPropertyNode* configNode, SGPropertyNode* modelRoot);
@@ -47,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);
@@ -57,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,
@@ -76,6 +94,7 @@ protected:
 
   const SGCondition* getCondition() const;
 
+  std::list<std::string> _objectNames;
 private:
   void installInGroup(const std::string& name, osg::Group& group,
                       osg::ref_ptr<osg::Group>& animationGroup);
@@ -91,13 +110,12 @@ private:
   std::string _name;
   SGSharedPtr<SGPropertyNode const> _configNode;
   SGPropertyNode* _modelRoot;
-  std::list<std::string> _objectNames;
+  
   std::list<osg::ref_ptr<osg::Node> > _installedAnimations;
   bool _enableHOT;
-  bool _disableShadow;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Null animation installer
 //////////////////////////////////////////////////////////////////////
@@ -108,7 +126,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Translate animation installer
 //////////////////////////////////////////////////////////////////////
@@ -126,7 +144,7 @@ private:
   double _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Rotate/Spin animation installer
 //////////////////////////////////////////////////////////////////////
@@ -137,8 +155,6 @@ public:
                     SGPropertyNode* modelRoot);
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 private:
-  class UpdateCallback;
-  class SpinUpdateCallback;
   SGSharedPtr<const SGCondition> _condition;
   SGSharedPtr<const SGExpressiond> _animationValue;
   SGVec3d _axis;
@@ -147,7 +163,7 @@ private:
   bool _isSpin;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -165,7 +181,7 @@ private:
   SGVec3d _center;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -178,7 +194,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -192,7 +208,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -205,7 +221,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Range animation installer
 //////////////////////////////////////////////////////////////////////
@@ -223,7 +239,7 @@ private:
   SGVec2d _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Select animation installer
 //////////////////////////////////////////////////////////////////////
@@ -235,7 +251,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Alpha test animation installer
 //////////////////////////////////////////////////////////////////////
@@ -247,7 +263,7 @@ public:
   virtual void install(osg::Node& node);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Blend animation installer
 //////////////////////////////////////////////////////////////////////
@@ -264,7 +280,7 @@ private:
   SGSharedPtr<SGExpressiond> _animationValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Timed animation installer
 //////////////////////////////////////////////////////////////////////
@@ -278,7 +294,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shadow animation installer
 //////////////////////////////////////////////////////////////////////
@@ -292,7 +308,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // TextureTransform animation
 //////////////////////////////////////////////////////////////////////
@@ -313,7 +329,7 @@ private:
                        UpdateCallback* updateCallback);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shader animation
 //////////////////////////////////////////////////////////////////////
@@ -329,22 +345,6 @@ private:
   osg::ref_ptr<osg::Texture2D> _effect_texture;
 };
 
-\f
-//////////////////////////////////////////////////////////////////////
-// Pick animation
-//////////////////////////////////////////////////////////////////////
-
-class SGPickAnimation : public SGAnimation {
-public:
-  SGPickAnimation(const SGPropertyNode* configNode,
-                  SGPropertyNode* modelRoot);
-  virtual osg::Group* createAnimationGroup(osg::Group& parent);
-private:
-  class PickCallback;
-  class VncCallback;
-};
-
-\f
 //////////////////////////////////////////////////////////////////////
 // Light animation
 //////////////////////////////////////////////////////////////////////
@@ -353,11 +353,12 @@ class SGLightAnimation : public SGAnimation {
 public:
   SGLightAnimation(const SGPropertyNode* configNode,
                    SGPropertyNode* modelRoot,
-                   const string &path, int i);
+                   const osgDB::Options* options,
+                   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;
@@ -368,7 +369,11 @@ private:
   double _cutoff;
   double _near;
   double _far;
-  string _key;
+  std::string _key;
+  class UpdateCallback;
+  friend class UpdateCallback;
+  SGSharedPtr<SGExpressiond> _animationValue;
+  osg::ref_ptr<const osgDB::Options> _options;
 };
 
 #endif // _SG_ANIMATION_HXX