X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_particle%2Fplant.cpp;h=2a9393563a935de2746e5428df80f7314663259f;hb=5258ea3fc1fc9e3b45627fd217e5229fc53f305a;hp=66d78b8762f5653cc273966d936752932b6d753d;hpb=ad5f0566c633041148043fc60cb0103a7516a5e3;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index 66d78b8..2a93935 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -102,6 +102,7 @@ Plant::Plant(): splits=5; drag=0.1; size=0.015; + needs_sync_=true; sync(); size_as_alpha=false; } @@ -130,8 +131,10 @@ Plant::branch(int n,int depth,float t, float stunt_growth, synfig::Point positio 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); @@ -145,7 +148,7 @@ Plant::calc_bounding_rect()const bounding_rect=Rect::zero(); // Bline must have at least 2 points in it - if(bline.size()<=2) + if(bline.size()<2) return; next=bline.begin(); @@ -172,12 +175,14 @@ Plant::calc_bounding_rect()const void Plant::sync()const { + Mutex::Lock lock(mutex); + if (!needs_sync_) return; particle_list.clear(); bounding_rect=Rect::zero(); // Bline must have at least 2 points in it - if(bline.size()<=2) + if(bline.size()<2) return; std::vector::const_iterator iter,next;