Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/bad_level_call_stubs/stubs.c3
-rw-r--r--source/blender/blenkernel/intern/node.c5
-rw-r--r--source/blender/blenkernel/intern/node_composite.c11
-rw-r--r--source/blender/blenloader/intern/readfile.c9
-rw-r--r--source/blender/makesdna/DNA_node_types.h3
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h3
-rw-r--r--source/blender/render/intern/source/zbuf.c9
-rw-r--r--source/blender/src/drawnode.c14
8 files changed, 37 insertions, 20 deletions
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
index 3b2e21f0e74..e200c6a88ad 100644
--- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c
+++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
@@ -39,6 +39,7 @@
#include "BPI_script.h"
#include "DNA_texture_types.h"
#include "DNA_material_types.h"
+#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "RE_render_ext.h"
@@ -221,4 +222,4 @@ float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype) {return NULL;}
float RE_filter_value(int type, float x) {return 0.0f;}
/* node_composite.c */
-void zbuf_accumulate_vecblur(int samples, int maxspeed, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect) {}
+void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect) {}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index ebfdb4213a3..c4025caca06 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -779,7 +779,10 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup)
else if(type==CMP_NODE_BLUR)
node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data");
else if(type==CMP_NODE_VECBLUR) {
- node->custom1= 32;
+ NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur data");
+ node->storage= nbd;
+ nbd->samples= 32;
+ nbd->fac= 1.0f;
}
}
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c
index e1aa5349b25..2c78db7c405 100644
--- a/source/blender/blenkernel/intern/node_composite.c
+++ b/source/blender/blenkernel/intern/node_composite.c
@@ -2152,9 +2152,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= {
static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
- extern void zbuf_accumulate_vecblur(int samples, int maxspeed, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect);
-
-// NodeBlurData nbd;
+ NodeBlurData *nbd= node->storage;
CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data;
if(img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0)
@@ -2176,13 +2174,10 @@ static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in,
return;
}
- //new= alloc_compbuf(img->x, img->y, img->type, 1);
new= dupalloc_compbuf(img);
-// do_filter3(vecbuf, vecbuf, soft, 1.0f);
-
/* call special zbuffer version */
- zbuf_accumulate_vecblur(node->custom1, node->custom2, img->x, img->y, new->rect, img->rect, vecbuf->rect, zbuf->rect);
+ RE_zbuf_accumulate_vecblur(nbd, img->x, img->y, new->rect, img->rect, vecbuf->rect, zbuf->rect);
out[0]->data= new;
}
@@ -2195,7 +2190,7 @@ static bNodeType cmp_node_vecblur= {
/* class+opts */ NODE_CLASS_OPERATOR, NODE_OPTIONS,
/* input sock */ cmp_node_vecblur_in,
/* output sock */ cmp_node_vecblur_out,
- /* storage */ "",
+ /* storage */ "NodeBlurData",
/* execfunc */ node_composit_exec_vecblur
};
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5600b87d835..f219e74057a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3610,6 +3610,15 @@ static void ntree_version_241(bNodeTree *ntree)
node->storage= nbd;
}
}
+ else if(node->type==CMP_NODE_VECBLUR) {
+ if(node->storage==NULL) {
+ NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
+ nbd->samples= node->custom1;
+ nbd->maxspeed= node->custom2;
+ nbd->fac= 1.0f;
+ node->storage= nbd;
+ }
+ }
}
}
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 340f000316a..86b13466af9 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -186,7 +186,8 @@ typedef struct NodeImageAnim {
} NodeImageAnim;
typedef struct NodeBlurData {
- short sizex, sizey;
+ short sizex, sizey, samples, maxspeed;
+ float fac;
short filtertype;
char bokeh, gamma;
} NodeBlurData;
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index dc19862e1a9..c82b5677683 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -36,6 +36,7 @@
struct Scene;
struct RenderData;
+struct NodeBlurData;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* this include is what is exposed of render to outside world */
@@ -174,6 +175,8 @@ void RE_error_cb (struct Render *re, void (*f)(const char *str));
/* should move to kernel once... still unsure on how/where */
float RE_filter_value(int type, float x);
+/* vector blur zbuffer method */
+void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect);
#endif /* RE_PIPELINE_H */
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 7623360c913..aa935e1815a 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -46,6 +46,7 @@
#include "DNA_lamp_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_node_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_global.h"
@@ -2062,14 +2063,14 @@ static void antialias_tagbuf(int xsize, int ysize, char *rectmove)
}
-void zbuf_accumulate_vecblur(int samples, int maxspeed, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect)
+void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect)
{
ZSpan zspan;
float jit[16][2];
float v1[3], v2[3], v3[3], v4[3], fx, fy;
float *rectdraw, *rectvz, *dvz, *dimg, *dvec1, *dvec2, *dz1, *dz2, *rectz;
- float maxspeedsq= (float)maxspeed*maxspeed;
- int y, x, step;
+ float maxspeedsq= (float)nbd->maxspeed*nbd->maxspeed;
+ int y, x, step, maxspeed= nbd->maxspeed, samples= nbd->samples;
char *rectmove, *dm;
zbuf_alloc_span(&zspan, xsize, ysize);
@@ -2214,7 +2215,7 @@ void zbuf_accumulate_vecblur(int samples, int maxspeed, int xsize, int ysize, fl
/* accumulate */
samples/= 2;
for(step= 1; step<=samples; step++) {
- float speedfac= 0.5f*(float)step/(float)(samples+1);
+ float speedfac= 0.5f*nbd->fac*(float)step/(float)(samples+1);
float blendfac= 1.0f/(ABS(step)+1);
float mfac= 1.0f-blendfac;
int side, z= 4;
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index eb456307ee3..1a8470d55cd 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -798,18 +798,22 @@ static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node
static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
+ NodeBlurData *nbd= node->storage;
short dy= butr->ymin;
short dx= (butr->xmax-butr->xmin);
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
- butr->xmin, dy+19, dx, 19,
- &node->custom1, 1, 256, 0, 0, "Amount of samples");
+ butr->xmin, dy+38, dx, 19,
+ &nbd->samples, 1, 256, 0, 0, "Amount of samples");
uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MaxSpeed:",
- butr->xmin, dy, dx, 19,
- &node->custom2, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
+ butr->xmin, dy+19, dx, 19,
+ &nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
+ uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:",
+ butr->xmin, dy, dx, 19,
+ &nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
}
- return 38;
+ return 57;
}
static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)