X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_particle%2Fplant.cpp;h=4f10df9eba00867c56a68f4bcde6e9eea281cb49;hb=0590e8116853b768e027f0ead843e01696458dfc;hp=67f60b4d95f86fd1694207b1e3da0af7a89b4282;hpb=ff59c2a6989602a7bf82a7531836a7ecec5518c4;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 67f60b4..4f10df9 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -78,7 +79,7 @@ Plant::Plant(): split_angle(Angle::deg(10)), gravity(0,-0.1), velocity(0.3), - perp_velocity(0.3), + perp_velocity(0.0), step(0.01), sprouts(10) { @@ -216,6 +217,7 @@ Plant::sync()const Real f; int i=0, branch_count = 0, steps = round_to_int(1.0/step); + if (steps < 1) steps = 1; for(f=0.0;f<1.0;f+=step,i++) { Point point(curve(f)); @@ -272,7 +274,15 @@ Plant::set_param(const String & param, const ValueBase &value) IMPORT_PLUS(gradient,needs_sync_=true); IMPORT_PLUS(velocity,needs_sync_=true); IMPORT_PLUS(perp_velocity,needs_sync_=true); - IMPORT_PLUS(step,needs_sync_=true); + IMPORT_PLUS(step,{ + needs_sync_ = true; + if (step <= 0) + step=0.01; // user is probably clueless - give a good default + else if (step < 0.00001) + step=0.00001; // 100K should be enough for anyone + else if (step > 1) + step=1; + }); IMPORT_PLUS(splits,needs_sync_=true); IMPORT_PLUS(sprouts,needs_sync_=true); IMPORT_PLUS(random_factor,needs_sync_=true); @@ -443,6 +453,7 @@ Plant::accelerated_render(Context context,Surface *surface,int quality, const Re sync(); std::vector::reverse_iterator iter; + float radius(size*sqrt(1.0f/(abs(pw)*abs(ph)))); int x1,y1,x2,y2; @@ -456,6 +467,11 @@ Plant::accelerated_render(Context context,Surface *surface,int quality, const Re color.set_a(1); } + // previously, radius was multiplied by sqrt(step)*12 only if + // the radius came out at less than 1 (pixel): + // if (radius<=1.0f) radius*=sqrt(step)*12.0f; + // seems a little arbitrary - does it help? + // calculate the box that this particle will be drawn as float x1f=(iter->point[0]-tl[0])/pw-(scaled_radius*0.5); float x2f=(iter->point[0]-tl[0])/pw+(scaled_radius*0.5);