This commit add the clock wipe effect to the sweep menu in the sequence editor

This commit is contained in:
Johnny Matthews 2004-07-12 17:59:42 +00:00
parent f32b8e6b7f
commit ab200e3f92
3 changed files with 67 additions and 9 deletions

@ -97,7 +97,7 @@ void do_mul_effect(float facf0, float facf1,
unsigned int *out);
/* Sweep effect */
enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
DO_IRIS_WIPE};
DO_IRIS_WIPE,DO_CLOCK_WIPE};
float in_band(float width,float dist, float perc,int side,int dir);
float check_zone(int x, int y, int xo, int yo, struct Sequence *seq, float facf0);
void init_sweep_effect(struct Sequence *seq);

@ -713,11 +713,17 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES
if(last_seq->type==SEQ_SWEEP){
SweepVars *sweep = (SweepVars *)last_seq->effectdata;
char formatstring[1024];
strcpy(formatstring, "Select Sweep Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4");
strcpy(formatstring, "Select Sweep Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4|Clock Wipe %x5");
uiDefButS(block, MENU,SEQ_BUT_EFFECT | B_NOP, formatstring, 10,90,220,22, &sweep->sweeptype, 0, 0, 0, 0, "What type of sweep should be performed");
uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Blur:", 10,65,220,22, &sweep->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
if(sweep->sweeptype != DO_IRIS_WIPE)
uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Angle:", 10,40,220,22, &sweep->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
switch(sweep->sweeptype){ /*Skip Types that do not require angle*/
case DO_IRIS_WIPE:
case DO_CLOCK_WIPE:
break;
default:
uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Angle:", 10,40,220,22, &sweep->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
}
uiDefButS(block, TOG,SEQ_BUT_EFFECT| B_NOP,"Wipe In", 10,15,220,22, &sweep->forward,0,0, 0, 0, "Controls Primary Direction of Sweep");
}
else if(last_seq->type==SEQ_GLOW){

@ -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 */