2d Filters updated, now you can use custom filter and write your own GLSL shader program to filter rendering result.
This commit is contained in:
@@ -2820,7 +2820,8 @@ static void lib_link_object(FileData *fd, Main *main)
|
||||
ma->toObject= newlibadr(fd, ob->id.lib, ma->toObject);
|
||||
}
|
||||
else if(act->type==ACT_2DFILTER){
|
||||
/* bTwoDFilterActuator *_2dfa = act->data; */
|
||||
bTwoDFilterActuator *_2dfa = act->data;
|
||||
_2dfa->text= newlibadr(fd, ob->id.lib, _2dfa->text);
|
||||
}
|
||||
act= act->next;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ struct Object;
|
||||
struct Mesh;
|
||||
struct Scene;
|
||||
struct Group;
|
||||
struct Text;
|
||||
|
||||
/* ****************** ACTUATORS ********************* */
|
||||
|
||||
@@ -192,14 +193,16 @@ typedef struct bVisibilityActuator {
|
||||
} bVisibilityActuator;
|
||||
|
||||
typedef struct bTwoDFilterActuator{
|
||||
char pad[4];
|
||||
/* Tells what type of 2D Filter*/
|
||||
short type;
|
||||
/* (flag == 0) means 2D filter is activate and
|
||||
(flag != 0) means 2D filter is inactive*/
|
||||
short flag;
|
||||
int int_arg;
|
||||
/* a float argument */
|
||||
float float_arg;
|
||||
int int_arg;
|
||||
struct Text *text;
|
||||
}bTwoDFilterActuator;
|
||||
|
||||
typedef struct bActuator {
|
||||
@@ -404,19 +407,22 @@ typedef struct FreeCamera {
|
||||
#define ACT_VISIBILITY_INVISIBLE (1 << 0)
|
||||
|
||||
/* twodfilter->type */
|
||||
#define ACT_2DFILTER_NOFILTER -1
|
||||
#define ACT_2DFILTER_MOTIONBLUR 0
|
||||
#define ACT_2DFILTER_BLUR 1
|
||||
#define ACT_2DFILTER_SHARPEN 2
|
||||
#define ACT_2DFILTER_DILATION 3
|
||||
#define ACT_2DFILTER_EROSION 4
|
||||
#define ACT_2DFILTER_LAPLACIAN 5
|
||||
#define ACT_2DFILTER_SOBEL 6
|
||||
#define ACT_2DFILTER_PREWITT 7
|
||||
#define ACT_2DFILTER_GRAYSCALE 8
|
||||
#define ACT_2DFILTER_SEPIA 9
|
||||
#define ACT_2DFILTER_INVERT 10
|
||||
#define ACT_2DFILTER_NUMBER_OF_FILTERS 11
|
||||
#define ACT_2DFILTER_ENABLED -2
|
||||
#define ACT_2DFILTER_DISABLED -1
|
||||
#define ACT_2DFILTER_NOFILTER 0
|
||||
#define ACT_2DFILTER_MOTIONBLUR 1
|
||||
#define ACT_2DFILTER_BLUR 2
|
||||
#define ACT_2DFILTER_SHARPEN 3
|
||||
#define ACT_2DFILTER_DILATION 4
|
||||
#define ACT_2DFILTER_EROSION 5
|
||||
#define ACT_2DFILTER_LAPLACIAN 6
|
||||
#define ACT_2DFILTER_SOBEL 7
|
||||
#define ACT_2DFILTER_PREWITT 8
|
||||
#define ACT_2DFILTER_GRAYSCALE 9
|
||||
#define ACT_2DFILTER_SEPIA 10
|
||||
#define ACT_2DFILTER_INVERT 11
|
||||
#define ACT_2DFILTER_CUSTOMFILTER 12
|
||||
#define ACT_2DFILTER_NUMBER_OF_FILTERS 13
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -2178,7 +2178,11 @@ static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, sho
|
||||
case ACT_2DFILTER:
|
||||
tdfa = act->data;
|
||||
|
||||
ysize= 50;
|
||||
ysize = 50;
|
||||
if(tdfa->type == ACT_2DFILTER_CUSTOMFILTER)
|
||||
{
|
||||
ysize +=20;
|
||||
}
|
||||
glRects( xco, yco-ysize, xco+width, yco );
|
||||
uiEmboss( (float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1 );
|
||||
|
||||
@@ -2206,12 +2210,19 @@ static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, sho
|
||||
case ACT_2DFILTER_SEPIA:
|
||||
case ACT_2DFILTER_INVERT:
|
||||
case ACT_2DFILTER_NOFILTER:
|
||||
uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,-1.0,MAX_RENDER_PASS-1,0.0,0.0,"Set motion blur value");
|
||||
case ACT_2DFILTER_DISABLED:
|
||||
case ACT_2DFILTER_ENABLED:
|
||||
uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set motion blur value");
|
||||
break;
|
||||
case ACT_2DFILTER_CUSTOMFILTER:
|
||||
uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set motion blur value");
|
||||
uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30,yco-64,width-60, 19, &tdfa->text, "");
|
||||
break;
|
||||
}
|
||||
|
||||
str= "2D Filter %t|Motion Blur %x0|Blur %x1|Sharpen %x2|Dilation %x3|Erosion %x4|"
|
||||
"Laplacian %x5|Sobel %x6|Prewitt %x7|Gray Scale %x8|Sepia %x9|Invert %x10|No Filter %x-1|";
|
||||
str= "2D Filter %t|Motion Blur %x1|Blur %x2|Sharpen %x3|Dilation %x4|Erosion %x5|"
|
||||
"Laplacian %x6|Sobel %x7|Prewitt %x8|Gray Scale %x9|Sepia %x10|Invert %x11|Custom Filter %x12|"
|
||||
"Enable Filter %x-2|Disable Filter %x-1|Remove Filter %x0|";
|
||||
uiDefButS(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
|
||||
|
||||
yco -= ysize;
|
||||
|
||||
Reference in New Issue
Block a user