]> 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 d6c1863352ee8d8b776a908ba5774e08d6493ff1..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);
@@ -46,7 +47,8 @@ public:
 
   static bool animate(osg::Node* node, const SGPropertyNode* configNode,
                       SGPropertyNode* modelRoot,
-                      const osgDB::Options* options);
+                      const osgDB::Options* options,
+                      const std::string &path, int i);
 
 protected:
   void apply(osg::Node* node);
@@ -56,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,
@@ -75,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);
@@ -90,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
 //////////////////////////////////////////////////////////////////////
@@ -107,7 +126,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Translate animation installer
 //////////////////////////////////////////////////////////////////////
@@ -125,7 +144,7 @@ private:
   double _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Rotate/Spin animation installer
 //////////////////////////////////////////////////////////////////////
@@ -136,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;
@@ -146,7 +163,7 @@ private:
   bool _isSpin;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -164,7 +181,7 @@ private:
   SGVec3d _center;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -177,7 +194,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -191,7 +208,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // dist scale animation installer
 //////////////////////////////////////////////////////////////////////
@@ -204,7 +221,7 @@ public:
   class Transform;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Range animation installer
 //////////////////////////////////////////////////////////////////////
@@ -222,7 +239,7 @@ private:
   SGVec2d _initialValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Select animation installer
 //////////////////////////////////////////////////////////////////////
@@ -234,7 +251,7 @@ public:
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Alpha test animation installer
 //////////////////////////////////////////////////////////////////////
@@ -246,7 +263,7 @@ public:
   virtual void install(osg::Node& node);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Blend animation installer
 //////////////////////////////////////////////////////////////////////
@@ -263,7 +280,7 @@ private:
   SGSharedPtr<SGExpressiond> _animationValue;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Timed animation installer
 //////////////////////////////////////////////////////////////////////
@@ -277,7 +294,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shadow animation installer
 //////////////////////////////////////////////////////////////////////
@@ -291,7 +308,7 @@ private:
   class UpdateCallback;
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // TextureTransform animation
 //////////////////////////////////////////////////////////////////////
@@ -312,7 +329,7 @@ private:
                        UpdateCallback* updateCallback);
 };
 
-\f
+
 //////////////////////////////////////////////////////////////////////
 // Shader animation
 //////////////////////////////////////////////////////////////////////
@@ -328,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
 //////////////////////////////////////////////////////////////////////
@@ -351,10 +352,28 @@ private:
 class SGLightAnimation : public SGAnimation {
 public:
   SGLightAnimation(const SGPropertyNode* configNode,
-                  SGPropertyNode* modelRoot);
+                   SGPropertyNode* modelRoot,
+                   const osgDB::Options* options,
+                   const std::string &path, int i);
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
   virtual void install(osg::Node& node);
 private:
+  std::string _light_type;
+  SGVec3d _position;
+  SGVec3d _direction;
+  SGVec4d _ambient;
+  SGVec4d _diffuse;
+  SGVec4d _specular;
+  SGVec3d _attenuation;
+  double _exponent;
+  double _cutoff;
+  double _near;
+  double _far;
+  std::string _key;
+  class UpdateCallback;
+  friend class UpdateCallback;
+  SGSharedPtr<SGExpressiond> _animationValue;
+  osg::ref_ptr<const osgDB::Options> _options;
 };
 
 #endif // _SG_ANIMATION_HXX