00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_METABALLS_H 00026 #define __SYNFIG_METABALLS_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include <synfig/layer_composite.h> 00031 #include <synfig/gradient.h> 00032 #include <synfig/vector.h> 00033 #include <synfig/value.h> 00034 #include <vector> 00035 00036 /* === M A C R O S ========================================================= */ 00037 00038 /* === T Y P E D E F S ===================================================== */ 00039 00040 /* === C L A S S E S & S T R U C T S ======================================= */ 00041 class Metaballs : public synfig::Layer_Composite 00042 { 00043 SYNFIG_LAYER_MODULE_EXT 00044 00045 private: 00046 00047 synfig::Gradient gradient; 00048 00049 std::vector<synfig::Point> centers; 00050 std::vector<synfig::Real> radii; 00051 std::vector<synfig::Real> weights; 00052 00053 synfig::Real threshold; 00054 synfig::Real threshold2; 00055 00056 bool positive; 00057 00058 synfig::Real densityfunc(const synfig::Point &p, const synfig::Point &c, synfig::Real R)const; 00059 00060 synfig::Real totaldensity(const synfig::Point &pos)const; 00061 00062 public: 00063 00064 Metaballs(); 00065 00066 virtual bool set_param(const synfig::String & param, const synfig::ValueBase &value); 00067 00068 virtual synfig::ValueBase get_param(const synfig::String & param)const; 00069 00070 virtual synfig::Color get_color(synfig::Context context, const synfig::Point &pos)const; 00071 00072 virtual bool accelerated_render(synfig::Context context,synfig::Surface *surface,int quality, const synfig::RendDesc &renddesc, synfig::ProgressCallback *cb)const; 00073 00074 virtual Vocab get_param_vocab()const; 00075 00076 virtual synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const; 00077 }; // END of class Metaballs 00078 00079 /* === E N D =============================================================== */ 00080 00081 #endif