SYNFIG_LAYER_SET_LOCAL_NAME(Metaballs,_("Metaballs"));
SYNFIG_LAYER_SET_CATEGORY(Metaballs,_("Default"));
SYNFIG_LAYER_SET_VERSION(Metaballs,"0.1");
SYNFIG_LAYER_SET_LOCAL_NAME(Metaballs,_("Metaballs"));
SYNFIG_LAYER_SET_CATEGORY(Metaballs,_("Default"));
SYNFIG_LAYER_SET_VERSION(Metaballs,"0.1");
//sum up weighted functions
for(unsigned int i=0;i<centers.size();i++)
{
density += weights[i] * densityfunc(pos,centers[i], radii[i]);
}
//sum up weighted functions
for(unsigned int i=0;i<centers.size();i++)
{
density += weights[i] * densityfunc(pos,centers[i], radii[i]);
}
Metaballs::get_color(Context context, const Point &pos)const
{
Real dens = totaldensity(pos);
Metaballs::get_color(Context context, const Point &pos)const
{
Real dens = totaldensity(pos);
bool
Metaballs::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
bool
Metaballs::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
SuperCallback supercb(cb,0,9000,10000);
SuperCallback supercb(cb,0,9000,10000);
if(!context.accelerated_render(surface,quality,renddesc,&supercb))
{
if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
if(!context.accelerated_render(surface,quality,renddesc,&supercb))
{
if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
if(!context.accelerated_render(surface,quality,renddesc,&supercb))
{
if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
if(!context.accelerated_render(surface,quality,renddesc,&supercb))
{
if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
for(int y = 0; y < h; y++, pos[1] += ph)
{
pos[0] = tl[0];
for(int x = 0; x < w; x++, pos[0] += pw)
{
dens = totaldensity(pos);
for(int y = 0; y < h; y++, pos[1] += ph)
{
pos[0] = tl[0];
for(int x = 0; x < w; x++, pos[0] += pw)
{
dens = totaldensity(pos);
if(dens >= threshold)
{
(*surface)[y][x] = Color::blend(color,(*surface)[y][x],get_amount(),get_blend_method());
}
if(dens >= threshold)
{
(*surface)[y][x] = Color::blend(color,(*surface)[y][x],get_amount(),get_blend_method());
}