diff options
author | Johnny Matthews <johnny.matthews@gmail.com> | 2004-07-12 21:59:42 +0400 |
---|---|---|
committer | Johnny Matthews <johnny.matthews@gmail.com> | 2004-07-12 21:59:42 +0400 |
commit | ab200e3f92a60be1f7b205db891b073016a59e98 (patch) | |
tree | d2041439a3b84daed85164139f306f63c97821fe /source/blender/src/sequence.c | |
parent | f32b8e6b7f2caef90ef83b44864d2499619c4169 (diff) |
This commit add the clock wipe effect to the sweep menu in the sequence editor
Diffstat (limited to 'source/blender/src/sequence.c')
-rw-r--r-- | source/blender/src/sequence.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index 48e84f32c82..3ff185626a0 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -989,12 +989,12 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) { /*some future stuff float hyp3,hyp4,b4,b5 */ - float temp1,temp2; //some placeholder variables + float temp1,temp2,temp3,temp4,hold; //some placeholder variables float halfx = xo/2; float halfy = yo/2; - float output=0; + float widthf,output=0; SweepVars *sweep = (SweepVars *)seq->effectdata; - int width,invert = 0; + int width; angle = sweep->angle; if(angle < 0){ @@ -1019,7 +1019,7 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) { if (angle == 0.0)angle = 0.000001; b1 = posy - (-angle)*posx; b2 = y - (-angle)*x; - hyp = abs(angle*x+y+(-posy-angle*posx))/sqrt(angle*angle+1); + hyp = fabs(angle*x+y+(-posy-angle*posx))/sqrt(angle*angle+1); if(angle < 0){ temp1 = b1; b1 = b2; @@ -1074,7 +1074,59 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) { output = in_band(hwidth,hyp2,facf0,1,1) * in_band(hwidth,hyp,facf0,1,1); } if(!sweep->forward)output = 1-output; - break; + break; + case DO_CLOCK_WIPE: + /* + temp1: angle of effect center in rads + temp2: angle of line through (halfx,halfy) and (x,y) in rads + temp3: angle of low side of blur + temp4: angle of high side of blur + */ + output = 1-facf0; + widthf = sweep->edgeWidth*2*3.14159; + temp1 = 2 * 3.14159 * facf0; + + if(sweep->forward){ + temp1 = 2*3.14159-temp1; + } + + x = x - halfx; + y = y - halfy; + + temp2 = asin(abs(y)/sqrt(x*x + y*y)); + if(x <= 0 && y >= 0) + temp2 = 3.14159 - temp2; + else if(x<=0 && y <= 0) + temp2 += 3.14159; + else if(x >= 0 && y <= 0) + temp2 = 2*3.14159 - temp2; + + if(sweep->forward){ + temp3 = temp1-(widthf/2)*facf0; + temp4 = temp1+(widthf/2)*(1-facf0); + } + else{ + temp3 = temp1-(widthf/2)*(1-facf0); + temp4 = temp1+(widthf/2)*facf0; + } + if (temp3 < 0) temp3 = 0; + if (temp4 > 2*3.14159) temp4 = 2*3.14159; + + + if(temp2 < temp3) + output = 0; + else if (temp2 > temp4) + output = 1; + else + output = (temp2-temp3)/(temp4-temp3); + if(x == 0 && y == 0){ + output = 1; + } + if(output != output) + output = 1; + if(sweep->forward) + output = 1 - output; + break; /* BOX WIPE IS NOT WORKING YET */ /* case DO_CROSS_WIPE: */ /* BOX WIPE IS NOT WORKING YET */ |