SYNFIG_LAYER_SET_LOCAL_NAME(Plant,_("Plant"));
SYNFIG_LAYER_SET_CATEGORY(Plant,_("Particle Systems"));
SYNFIG_LAYER_SET_VERSION(Plant,"0.1");
SYNFIG_LAYER_SET_LOCAL_NAME(Plant,_("Plant"));
SYNFIG_LAYER_SET_CATEGORY(Plant,_("Particle Systems"));
SYNFIG_LAYER_SET_VERSION(Plant,"0.1");
bline.push_back(BLinePoint());
bline.push_back(BLinePoint());
bline.push_back(BLinePoint());
bline.push_back(BLinePoint());
bline.push_back(BLinePoint());
bline.push_back(BLinePoint());
- bline[0].set_vertex(Point(0,1));
- bline[1].set_vertex(Point(0,-1));
+ bline[0].set_vertex(Point(0,1));
+ bline[1].set_vertex(Point(0,-1));
- bline[0].set_tangent(bline[1].get_vertex()-bline[2].get_vertex()*0.5f);
- bline[1].set_tangent(bline[2].get_vertex()-bline[0].get_vertex()*0.5f);
- bline[2].set_tangent(bline[0].get_vertex()-bline[1].get_vertex()*0.5f);
- bline[0].set_width(1.0f);
- bline[1].set_width(1.0f);
- bline[2].set_width(1.0f);
+ bline[0].set_tangent(bline[1].get_vertex()-bline[2].get_vertex()*0.5f);
+ bline[1].set_tangent(bline[2].get_vertex()-bline[0].get_vertex()*0.5f);
+ bline[2].set_tangent(bline[0].get_vertex()-bline[1].get_vertex()*0.5f);
+ bline[0].set_width(1.0f);
+ bline[1].set_width(1.0f);
+ bline[2].set_width(1.0f);
if(t>=1.0-stunt_growth)return;
synfig::Real sin_v=synfig::Angle::cos(split_angle).get();
synfig::Real cos_v=synfig::Angle::sin(split_angle).get();
if(t>=1.0-stunt_growth)return;
synfig::Real sin_v=synfig::Angle::cos(split_angle).get();
synfig::Real cos_v=synfig::Angle::sin(split_angle).get();
synfig::Vector velocity1(vel[0]*sin_v-vel[1]*cos_v+random_factor*random(2,30+n+depth,t*splits,0.0f,0.0f),vel[0]*cos_v+vel[1]*sin_v+random_factor*random(2,32+n+depth,t*splits,0.0f,0.0f));
synfig::Vector velocity2(vel[0]*sin_v+vel[1]*cos_v+random_factor*random(2,31+n+depth,t*splits,0.0f,0.0f),-vel[0]*cos_v+vel[1]*sin_v+random_factor*random(2,33+n+depth,t*splits,0.0f,0.0f));
synfig::Vector velocity1(vel[0]*sin_v-vel[1]*cos_v+random_factor*random(2,30+n+depth,t*splits,0.0f,0.0f),vel[0]*cos_v+vel[1]*sin_v+random_factor*random(2,32+n+depth,t*splits,0.0f,0.0f));
synfig::Vector velocity2(vel[0]*sin_v+vel[1]*cos_v+random_factor*random(2,31+n+depth,t*splits,0.0f,0.0f),-vel[0]*cos_v+vel[1]*sin_v+random_factor*random(2,33+n+depth,t*splits,0.0f,0.0f));
Plant::branch(n,depth+1,t,stunt_growth,position,velocity1);
Plant::branch(n,depth+1,t,stunt_growth,position,velocity2);
}
Plant::branch(n,depth+1,t,stunt_growth,position,velocity1);
Plant::branch(n,depth+1,t,stunt_growth,position,velocity2);
}
std::vector<synfig::BLinePoint>::const_iterator iter,next;
etl::hermite<Vector> curve;
std::vector<synfig::BLinePoint>::const_iterator iter,next;
etl::hermite<Vector> curve;
for(;next!=bline.end();iter=next++,seg++)
{
curve.p1()=iter->get_vertex();
for(;next!=bline.end();iter=next++,seg++)
{
curve.p1()=iter->get_vertex();
Real f;
int i(0), b(round_to_int((1.0/step)/(float)sprouts-1));
if(b<=0)b=1;
for(f=0.0;f<1.0;f+=step,i++)
{
Point point(curve(f));
Real f;
int i(0), b(round_to_int((1.0/step)/(float)sprouts-1));
if(b<=0)b=1;
for(f=0.0;f<1.0;f+=step,i++)
{
Point point(curve(f));
Real stunt_growth(random(2,i,f+seg,0.0f,0.0f)/2.0+0.5);
stunt_growth*=stunt_growth;
Real stunt_growth(random(2,i,f+seg,0.0f,0.0f)/2.0+0.5);
stunt_growth*=stunt_growth;
branch_velocity[0]+=random_factor*random(2,1,f*splits,0.0f,0.0f);
branch_velocity[1]+=random_factor*random(2,2,f*splits,0.0f,0.0f);
branch_velocity[0]+=random_factor*random(2,1,f*splits,0.0f,0.0f);
branch_velocity[1]+=random_factor*random(2,2,f*splits,0.0f,0.0f);
bool
Plant::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
bool
Plant::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
bool ret(context.accelerated_render(surface,quality,renddesc,cb));
if(is_disabled() || !ret)
return ret;
bool ret(context.accelerated_render(surface,quality,renddesc,cb));
if(is_disabled() || !ret)
return ret;
x1=ceil_to_int((iter->point[0]-tl[0])/pw-(radius*0.5));
y1=ceil_to_int((iter->point[1]-tl[1])/ph-(radius*0.5));
x2=x1+round_to_int(radius);
y2=y1+round_to_int(radius);
x1=ceil_to_int((iter->point[0]-tl[0])/pw-(radius*0.5));
y1=ceil_to_int((iter->point[1]-tl[1])/ph-(radius*0.5));
x2=x1+round_to_int(radius);
y2=y1+round_to_int(radius);
int w(min(round_to_int(radius),x2-x1));
int h(min(round_to_int(radius),y2-y1));
int w(min(round_to_int(radius),x2-x1));
int h(min(round_to_int(radius),y2-y1));
dest_surface.fill(color,surface_pen,w,h);
}
}
dest_surface.fill(color,surface_pen,w,h);
}
}
Surface::alpha_pen pen(surface->get_pen(0,0),get_amount(),get_blend_method());
dest_surface.blit_to(pen);
Surface::alpha_pen pen(surface->get_pen(0,0),get_amount(),get_blend_method());
dest_surface.blit_to(pen);