X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_particle%2Frandom.cpp;h=c72c76343eed08cb0075528fa080a5e2d0afba55;hb=14c4d99cbeedaba4c2f13bf8256458e326a8ecf3;hp=ad2e896256f1c07fbb893c9fab6190fe564cadcb;hpb=5258ea3fc1fc9e3b45627fd217e5229fc53f305a;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_particle/random.cpp b/synfig-core/trunk/src/modules/mod_particle/random.cpp index ad2e896..c72c763 100644 --- a/synfig-core/trunk/src/modules/mod_particle/random.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/random.cpp @@ -70,7 +70,7 @@ Random::operator()(const int salt,const int x,const int y,const int t)const } float -Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const +Random::operator()(SmoothType smooth,int subseed,float xf,float yf,float tf)const { int x((int)floor(xf)); int y((int)floor(yf)); @@ -78,10 +78,11 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const switch(smooth) { - case 4: // cubic + case SMOOTH_CUBIC: // cubic { #define f(j,i,k) ((*this)(subseed,i,j,k)) //Using catmull rom interpolation because it doesn't blur at all + // ( http://www.gamedev.net/reference/articles/article1497.asp ) //bezier curve with intermediate ctrl pts: 0.5/3(p(i+1) - p(i-1)) and similar float xfa [4], tfa[4]; @@ -138,7 +139,7 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const break; - case 5: // Fast Spline (non-animated) + case SMOOTH_FAST_SPLINE: // Fast Spline (non-animated) { #define P(x) (((x)>0)?((x)*(x)*(x)):0.0f) #define R(x) ( P(x+2) - 4.0f*P(x+1) + 6.0f*P(x) - 4.0f*P(x-1) )*(1.0f/6.0f) @@ -161,7 +162,7 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const return ret; } - case 3: // Spline (animated) + case SMOOTH_SPLINE: // Spline (animated) { float a(xf-x), b(yf-y), c(tf-t); @@ -211,7 +212,7 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const #undef P #undef R - case 2: // Cosine + case SMOOTH_COSINE: if((float)t==tf) { int x((int)floor(xf)); @@ -258,7 +259,7 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const (*this)(subseed,x,y2,t2)*(d*b*c)+ (*this)(subseed,x2,y2,t2)*(a*b*c); } - case 1: // Linear + case SMOOTH_LINEAR: if((float)t==tf) { int x((int)floor(xf)); @@ -298,7 +299,7 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const (*this)(subseed,x2,y2,t2)*(a*b*c); } default: - case 0: + case SMOOTH_DEFAULT: return (*this)(subseed,x,y,t); } }