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);
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);
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,
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);
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
//////////////////////////////////////////////////////////////////////
virtual osg::Group* createAnimationGroup(osg::Group& parent);
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Translate animation installer
//////////////////////////////////////////////////////////////////////
double _initialValue;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Rotate/Spin animation installer
//////////////////////////////////////////////////////////////////////
SGPropertyNode* modelRoot);
virtual osg::Group* createAnimationGroup(osg::Group& parent);
private:
- class UpdateCallback;
- class SpinUpdateCallback;
SGSharedPtr<const SGCondition> _condition;
SGSharedPtr<const SGExpressiond> _animationValue;
SGVec3d _axis;
bool _isSpin;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Scale animation installer
//////////////////////////////////////////////////////////////////////
SGVec3d _center;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// dist scale animation installer
//////////////////////////////////////////////////////////////////////
class Transform;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// dist scale animation installer
//////////////////////////////////////////////////////////////////////
class Transform;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// dist scale animation installer
//////////////////////////////////////////////////////////////////////
class Transform;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Range animation installer
//////////////////////////////////////////////////////////////////////
SGVec2d _initialValue;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Select animation installer
//////////////////////////////////////////////////////////////////////
virtual osg::Group* createAnimationGroup(osg::Group& parent);
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Alpha test animation installer
//////////////////////////////////////////////////////////////////////
virtual void install(osg::Node& node);
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Blend animation installer
//////////////////////////////////////////////////////////////////////
SGSharedPtr<SGExpressiond> _animationValue;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Timed animation installer
//////////////////////////////////////////////////////////////////////
class UpdateCallback;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Shadow animation installer
//////////////////////////////////////////////////////////////////////
class UpdateCallback;
};
-\f
+
//////////////////////////////////////////////////////////////////////
// TextureTransform animation
//////////////////////////////////////////////////////////////////////
UpdateCallback* updateCallback);
};
-\f
+
//////////////////////////////////////////////////////////////////////
// Shader animation
//////////////////////////////////////////////////////////////////////
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
//////////////////////////////////////////////////////////////////////
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;
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