*/
static SGPersonalityBranch *current_object;
+ int get_animation_type(void) { return animation_type; }
+
protected:
static double sim_time_sec;
ssgBranch * _branch;
+ int animation_type;
};
SGPropertyNode_ptr factor_prop;
SGPropertyNode_ptr offset_prop;
sgVec4 v;
- bool dirty() {
+ inline bool dirty() {
return red >= 0.0 || green >= 0.0 || blue >= 0.0;
}
- bool live() {
+ inline bool live() {
return red_prop || green_prop || blue_prop
|| factor_prop || offset_prop;
}
- bool operator!=(ColorSpec& a) {
+ inline bool operator!=(ColorSpec& a) {
return red != a.red || green != a.green || blue != a.blue
|| factor != a.factor || offset != a.offset;
}
v[3] = 1.0;
return v;
}
- float clamp(float val) {
+ inline float clamp(float val) {
return val < 0.0 ? 0.0 : val > 1.0 ? 1.0 : val;
}
};
+ struct PropSpec {
+ float value;
+ float factor;
+ float offset;
+ float min;
+ float max;
+ SGPropertyNode_ptr value_prop;
+ SGPropertyNode_ptr factor_prop;
+ SGPropertyNode_ptr offset_prop;
+ inline bool dirty() { return value >= 0.0; }
+ inline bool live() { return value_prop || factor_prop || offset_prop; }
+ inline bool operator!=(PropSpec& a) {
+ return value != a.value || factor != a.factor || offset != a.offset;
+ }
+ };
SGCondition *_condition;
- SGPath _base_dir;
+ bool _last_condition;
+ SGPropertyNode *_prop_root;
+ string _prop_base;
+ SGPath _texture_base;
SGPath _texture;
string _texture_str;
ssgSimpleState* _cached_material;
ssgSimpleState* _cloned_material;
unsigned _read;
unsigned _update;
+ unsigned _static_update;
bool _global;
ColorSpec _diff;
ColorSpec _amb;
ColorSpec _emis;
ColorSpec _spec;
float _shi;
- float _trans;
+ PropSpec _trans;
float _thresh; // alpha_clamp (see man glAlphaFunc)
string _tex;
+ string _tmpstr;
SGPropertyNode_ptr _shi_prop;
- SGPropertyNode_ptr _trans_prop;
SGPropertyNode_ptr _thresh_prop;
SGPropertyNode_ptr _tex_prop;
void cloneMaterials(ssgBranch *b);
void setMaterialBranch(ssgBranch *b);
- float clamp(float val, float min = 0.0, float max = 1.0) {
+ void initColorGroup(SGPropertyNode_ptr, ColorSpec *, int flag);
+ void updateColorGroup(ColorSpec *, int flag);
+ inline float clamp(float val, float min = 0.0, float max = 1.0) {
return val < min ? min : val > max ? max : val;
}
+ const char *path(const char *rel) {
+ return (_tmpstr = _prop_base + rel).c_str();
+ }
};
SGInterpTable * _table;
};
+/**
+ * An animation to tell wich objects don't cast shadows.
+ */
+class SGShadowAnimation : public SGAnimation
+{
+public:
+ SGShadowAnimation ( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props );
+ virtual ~SGShadowAnimation ();
+ virtual int update();
+ bool get_condition_value(void);
+private:
+ SGCondition * _condition;
+ bool _condition_value;
+};
+
+/**
++ * An "animation" that replace fixed opengl pipeline by shaders
++ */
+class SGShaderAnimation : public SGAnimation
+{
+public:
+ SGShaderAnimation ( SGPropertyNode *prop_root,
+ SGPropertyNode_ptr props );
+ virtual ~SGShaderAnimation ();
+ virtual void init();
+ virtual int update();
+ bool get_condition_value(void);
+private:
+ SGCondition * _condition;
+ bool _condition_value;
+ int _shader_type;
+ float _param_1;
+ sgVec4 _param_color;
+public:
+ bool _depth_test;
+ float _factor;
+ SGPropertyNode_ptr _factor_prop;
+ float _speed;
+ SGPropertyNode_ptr _speed_prop;
+ ssgTexture *_effectTexture;
+ unsigned char *_textureData;
+ GLint _texWidth, _texHeight;
+ sgVec4 _envColor;
+};
+
#endif // _SG_ANIMATION_HXX