features & fixes:
- Enabled Groups to execute in Compositor. They were ignored still. Note; inside of groups nothing is cached, so a change of a group input will recalculate it fully. This is needed because groups are linked data (instances use same internal nodes). - Made Composit node "Viewer" display correctly input for images with 1/2/3/4 channels. - Added pass rendering, tested now with only regular Materials. For Material nodes this is quite more complex... since they cannot be easily separated in passes (each Material does a full shade) In this commit all pass render is disabled though, will continue work on that later. Sneak preview: http://www.blender.org/bf/rt.jpg (temporal image) - What did remain is the 'Normal' pass output. Normal works very nice for relighting effects. Use the "Normal Node" to define where more or less light should be. (Use "Value Map" node to tweak influence of the Normal node 'dot' output.) - EVIL bug fix: I've spend almost a day finding it... when combining AO and mirror render, the event queue was totally screwing up... two things not related at all! Found out error was in ray-mirror code, which was using partially uninitialized 'ShadeInput' data to pass on to render code. - Another fix; made sure that while thread render, the threads don't get events, only the main program will do. Might fix issues reported by people on linux/windows.
This commit is contained in:
@@ -1243,7 +1243,7 @@ void NodeTagChanged(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
if(ntree->type==NTREE_COMPOSIT) {
|
||||
bNodeSocket *sock;
|
||||
|
||||
|
||||
for(sock= node->outputs.first; sock; sock= sock->next) {
|
||||
if(sock->ns.data) {
|
||||
free_compbuf(sock->ns.data);
|
||||
@@ -1447,14 +1447,35 @@ static void composit_end_exec(bNodeTree *ntree)
|
||||
}
|
||||
node->need_exec= 0;
|
||||
}
|
||||
|
||||
|
||||
/* internally, group buffers are not stored */
|
||||
for(ns= ntree->stack, a=0; a<ntree->stacksize; a++, ns++) {
|
||||
if(ns->data) {
|
||||
print_compbuf("error: buf hanging in stack", ns->data);
|
||||
if(ns->data)
|
||||
free_compbuf(ns->data);
|
||||
}
|
||||
}
|
||||
|
||||
static void group_tag_used_outputs(bNode *gnode, bNodeStack *stack)
|
||||
{
|
||||
bNodeTree *ntree= (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
|
||||
stack+= gnode->stack_index;
|
||||
|
||||
for(node= ntree->nodes.first; node; node= node->next) {
|
||||
if(node->typeinfo->execfunc) {
|
||||
bNodeSocket *sock;
|
||||
|
||||
for(sock= node->inputs.first; sock; sock= sock->next) {
|
||||
if(sock->intern) {
|
||||
if(sock->link) {
|
||||
bNodeStack *ns= stack + sock->link->fromsock->stack_index;
|
||||
ns->hasoutput= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* stack indices make sure all nodes only write in allocated data, for making it thread safe */
|
||||
@@ -1481,7 +1502,6 @@ void ntreeBeginExecTree(bNodeTree *ntree)
|
||||
for(a=0; a<ntree->stacksize; a++, ns++) ns->hasinput= 1;
|
||||
|
||||
/* tag used outputs, so we know when we can skip operations */
|
||||
/* hrms... groups... */
|
||||
for(node= ntree->nodes.first; node; node= node->next) {
|
||||
bNodeSocket *sock;
|
||||
for(sock= node->inputs.first; sock; sock= sock->next) {
|
||||
@@ -1490,6 +1510,8 @@ void ntreeBeginExecTree(bNodeTree *ntree)
|
||||
ns->hasoutput= 1;
|
||||
}
|
||||
}
|
||||
if(node->type==NODE_GROUP && node->id)
|
||||
group_tag_used_outputs(node, ntree->stack);
|
||||
}
|
||||
if(ntree->type==NTREE_COMPOSIT)
|
||||
composit_begin_exec(ntree);
|
||||
@@ -1610,48 +1632,46 @@ static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
|
||||
int totnode= 0;
|
||||
|
||||
for(node= ntree->nodes.first; node; node= node->next) {
|
||||
if(node->typeinfo->execfunc) {
|
||||
int a;
|
||||
|
||||
node_get_stack(node, thd->stack, nsin, nsout);
|
||||
|
||||
/* test the inputs */
|
||||
for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
|
||||
/* is sock in use? */
|
||||
if(sock->link) {
|
||||
if(nsin[a]->data==NULL || sock->link->fromnode->need_exec) {
|
||||
node->need_exec= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* test the outputs */
|
||||
for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
|
||||
if(nsout[a]->data==NULL && nsout[a]->hasoutput) {
|
||||
int a;
|
||||
|
||||
node_get_stack(node, thd->stack, nsin, nsout);
|
||||
|
||||
/* test the inputs */
|
||||
for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
|
||||
/* is sock in use? */
|
||||
if(sock->link) {
|
||||
if(nsin[a]->data==NULL || sock->link->fromnode->need_exec) {
|
||||
node->need_exec= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(node->need_exec) {
|
||||
|
||||
/* free output buffers */
|
||||
for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
|
||||
if(nsout[a]->data) {
|
||||
free_compbuf(nsout[a]->data);
|
||||
nsout[a]->data= NULL;
|
||||
}
|
||||
}
|
||||
totnode++;
|
||||
//printf("node needs exec %s\n", node->name);
|
||||
|
||||
/* tag for getExecutableNode() */
|
||||
node->exec= 0;
|
||||
}
|
||||
else
|
||||
/* tag for getExecutableNode() */
|
||||
node->exec= NODE_READY|NODE_FINISHED;
|
||||
}
|
||||
|
||||
/* test the outputs */
|
||||
for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
|
||||
if(nsout[a]->data==NULL && nsout[a]->hasoutput) {
|
||||
node->need_exec= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(node->need_exec) {
|
||||
|
||||
/* free output buffers */
|
||||
for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
|
||||
if(nsout[a]->data) {
|
||||
free_compbuf(nsout[a]->data);
|
||||
nsout[a]->data= NULL;
|
||||
}
|
||||
}
|
||||
totnode++;
|
||||
//printf("node needs exec %s\n", node->name);
|
||||
|
||||
/* tag for getExecutableNode() */
|
||||
node->exec= 0;
|
||||
}
|
||||
else
|
||||
/* tag for getExecutableNode() */
|
||||
node->exec= NODE_READY|NODE_FINISHED;
|
||||
}
|
||||
return totnode;
|
||||
}
|
||||
|
||||
@@ -430,6 +430,18 @@ static void do_copy_rgba(bNode *node, float *out, float *in)
|
||||
{
|
||||
QUATCOPY(out, in);
|
||||
}
|
||||
static void do_copy_rgb(bNode *node, float *out, float *in)
|
||||
{
|
||||
VECCOPY(out, in);
|
||||
out[3]= 1.0f;
|
||||
}
|
||||
static void do_copy_rg(bNode *node, float *out, float *in)
|
||||
{
|
||||
out[0]= in[0];
|
||||
out[1]= in[1];
|
||||
out[2]= 0.0f;
|
||||
out[3]= 1.0f;
|
||||
}
|
||||
static void do_copy_value(bNode *node, float *out, float *in)
|
||||
{
|
||||
out[0]= in[0];
|
||||
@@ -447,7 +459,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
||||
|
||||
if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
|
||||
Image *ima= (Image *)node->id;
|
||||
CompBuf *cbuf;
|
||||
CompBuf *cbuf, *inbuf= in[0]->data;
|
||||
int rectx, recty;
|
||||
|
||||
/* scene size? */
|
||||
@@ -465,10 +477,18 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
||||
cbuf->rect= ima->ibuf->rect_float;
|
||||
|
||||
/* when no alpha, we can simply copy */
|
||||
if(in[1]->data==NULL)
|
||||
composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba);
|
||||
if(in[1]->data==NULL) {
|
||||
void (*func)(bNode *, float *, float *);
|
||||
|
||||
if(inbuf==NULL || inbuf->type==CB_RGBA) func= do_copy_rgba;
|
||||
else if(inbuf->type==CB_VEC3) func= do_copy_rgb;
|
||||
else if(inbuf->type==CB_VEC2) func= do_copy_rg;
|
||||
else func= do_copy_value;
|
||||
|
||||
composit1_pixel_processor(node, cbuf, inbuf, in[0]->vec, func);
|
||||
}
|
||||
else
|
||||
composit2_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba);
|
||||
composit2_pixel_processor(node, cbuf, inbuf, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba);
|
||||
|
||||
if(in[2]->data) {
|
||||
CompBuf *zbuf= alloc_compbuf(rectx, recty, CB_VAL, 0);
|
||||
@@ -493,8 +513,24 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
|
||||
}
|
||||
|
||||
} /* lets make only previews when not done yet, so activating doesnt update */
|
||||
else if(in[0]->data && node->preview && node->preview->rect==NULL)
|
||||
generate_preview(node, in[0]->data);
|
||||
else if(in[0]->data && node->preview && node->preview->rect==NULL) {
|
||||
CompBuf *cbuf, *inbuf= in[0]->data;
|
||||
|
||||
if(inbuf->type!=CB_RGBA) {
|
||||
void (*func)(bNode *, float *, float *);
|
||||
|
||||
if(inbuf->type==CB_VEC3) func= do_copy_rgb;
|
||||
else if(inbuf->type==CB_VEC2) func= do_copy_rg;
|
||||
else func= do_copy_value;
|
||||
|
||||
cbuf= alloc_compbuf(inbuf->x, inbuf->y, CB_RGBA, 1);
|
||||
composit1_pixel_processor(node, cbuf, inbuf, in[0]->vec, func);
|
||||
generate_preview(node, cbuf);
|
||||
free_compbuf(cbuf);
|
||||
}
|
||||
else
|
||||
generate_preview(node, inbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static bNodeType cmp_node_viewer= {
|
||||
@@ -737,14 +773,56 @@ static bNodeType cmp_node_image= {
|
||||
};
|
||||
|
||||
/* **************** RENDER RESULT ******************** */
|
||||
|
||||
/* output socket defines */
|
||||
#define RRES_OUT_IMAGE 0
|
||||
#define RRES_OUT_ALPHA 1
|
||||
#define RRES_OUT_Z 2
|
||||
#define RRES_OUT_NOR 3
|
||||
#define RRES_OUT_VEC 4
|
||||
#define RRES_OUT_COL 5
|
||||
#define RRES_OUT_DIFF 6
|
||||
#define RRES_OUT_SPEC 7
|
||||
#define RRES_OUT_SHAD 8
|
||||
#define RRES_OUT_AO 9
|
||||
#define RRES_OUT_RAY 10
|
||||
|
||||
static bNodeSocketType cmp_node_rresult_out[]= {
|
||||
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "Vec", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "Speed", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "Diffuse", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "Specular", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "Shadow", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "AO", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
// { SOCK_RGBA, 0, "Ray", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static CompBuf *compbuf_from_pass(RenderLayer *rl, int rectx, int recty, int passcode)
|
||||
{
|
||||
float *fp= RE_RenderLayerGetPass(rl, passcode);
|
||||
if(fp) {
|
||||
CompBuf *buf;
|
||||
int buftype= CB_VEC3;
|
||||
|
||||
if(passcode==SCE_PASS_Z)
|
||||
buftype= CB_VAL;
|
||||
else if(passcode==SCE_PASS_VECTOR)
|
||||
buftype= CB_VEC2;
|
||||
else if(passcode==SCE_PASS_RGBA)
|
||||
buftype= CB_RGBA;
|
||||
|
||||
buf= alloc_compbuf(rectx, recty, buftype, 0);
|
||||
buf->rect= fp;
|
||||
return buf;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void node_composit_exec_rresult(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
RenderResult *rr= RE_GetResult(RE_GetRender("Render"));
|
||||
@@ -759,21 +837,30 @@ static void node_composit_exec_rresult(void *data, bNode *node, bNodeStack **in,
|
||||
stackbuf->rect= rl->rectf;
|
||||
|
||||
/* put on stack */
|
||||
out[0]->data= stackbuf;
|
||||
|
||||
if(out[1]->hasoutput)
|
||||
out[1]->data= alphabuf_from_rgbabuf(stackbuf);
|
||||
if(out[2]->hasoutput && rl->rectz) {
|
||||
CompBuf *zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 0);
|
||||
zbuf->rect= rl->rectz;
|
||||
out[2]->data= zbuf;
|
||||
}
|
||||
if(out[3]->hasoutput && rl->rectvec) {
|
||||
CompBuf *vecbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VEC2, 0);
|
||||
vecbuf->rect= rl->rectvec;
|
||||
out[3]->data= vecbuf;
|
||||
}
|
||||
out[RRES_OUT_IMAGE]->data= stackbuf;
|
||||
|
||||
if(out[RRES_OUT_ALPHA]->hasoutput)
|
||||
out[RRES_OUT_ALPHA]->data= alphabuf_from_rgbabuf(stackbuf);
|
||||
if(out[RRES_OUT_Z]->hasoutput)
|
||||
out[RRES_OUT_Z]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_Z);
|
||||
if(out[RRES_OUT_VEC]->hasoutput)
|
||||
out[RRES_OUT_VEC]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_VECTOR);
|
||||
if(out[RRES_OUT_NOR]->hasoutput)
|
||||
out[RRES_OUT_NOR]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_NORMAL);
|
||||
/*
|
||||
if(out[RRES_OUT_COL]->hasoutput)
|
||||
out[RRES_OUT_COL]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_RGBA);
|
||||
if(out[RRES_OUT_DIFF]->hasoutput)
|
||||
out[RRES_OUT_DIFF]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_DIFFUSE);
|
||||
if(out[RRES_OUT_SPEC]->hasoutput)
|
||||
out[RRES_OUT_SPEC]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_SPEC);
|
||||
if(out[RRES_OUT_SHAD]->hasoutput)
|
||||
out[RRES_OUT_SHAD]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_SHADOW);
|
||||
if(out[RRES_OUT_AO]->hasoutput)
|
||||
out[RRES_OUT_AO]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_AO);
|
||||
if(out[RRES_OUT_RAY]->hasoutput)
|
||||
out[RRES_OUT_RAY]->data= compbuf_from_pass(rl, rr->rectx, rr->recty, SCE_PASS_RAY);
|
||||
*/
|
||||
generate_preview(node, stackbuf);
|
||||
}
|
||||
}
|
||||
@@ -804,6 +891,15 @@ static bNodeSocketType cmp_node_normal_out[]= {
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static void do_normal(bNode *node, float *out, float *in)
|
||||
{
|
||||
bNodeSocket *sock= node->outputs.first;
|
||||
float *nor= sock->ns.vec;
|
||||
|
||||
/* render normals point inside... the widget points outside */
|
||||
out[0]= -INPR(nor, in);
|
||||
}
|
||||
|
||||
/* generates normal, does dot product */
|
||||
static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
@@ -811,9 +907,23 @@ static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in,
|
||||
/* stack order input: normal */
|
||||
/* stack order output: normal, value */
|
||||
|
||||
VECCOPY(out[0]->vec, sock->ns.vec);
|
||||
/* render normals point inside... the widget points outside */
|
||||
out[1]->vec[0]= -INPR(out[0]->vec, in[0]->vec);
|
||||
/* input no image? then only vector op */
|
||||
if(in[0]->data==NULL) {
|
||||
VECCOPY(out[0]->vec, sock->ns.vec);
|
||||
/* render normals point inside... the widget points outside */
|
||||
out[1]->vec[0]= -INPR(out[0]->vec, in[0]->vec);
|
||||
}
|
||||
else if(out[1]->hasoutput) {
|
||||
/* make output size of input image */
|
||||
CompBuf *cbuf= in[0]->data;
|
||||
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); // allocs
|
||||
|
||||
composit1_pixel_processor(node, stackbuf, in[0]->data, NULL, do_normal);
|
||||
|
||||
out[1]->data= stackbuf;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static bNodeType cmp_node_normal= {
|
||||
@@ -1843,21 +1953,6 @@ static bNodeSocketType cmp_node_vecblur_out[]= {
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static void fill_rct_in_image(rcti poly, float *rect, int xsize, int ysize, float *col)
|
||||
{
|
||||
float *dest;
|
||||
int x, y;
|
||||
|
||||
for(y=poly.ymin; y<poly.ymax; y++) {
|
||||
for(x=poly.xmin; x<poly.xmax; x++) {
|
||||
dest= rect + 4*(xsize*y + x);
|
||||
QUATCOPY(dest, col);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
CompBuf *new, *img= in[0]->data, *vecbuf= in[1]->data, *wbuf;
|
||||
|
||||
@@ -112,6 +112,13 @@ void BLI_init_threads(ListBase *threadbase, int (*do_thread)(void *), int tot)
|
||||
tslot->do_thread= do_thread;
|
||||
}
|
||||
|
||||
/* weak weak... now only 1 thread system at a time can be used */
|
||||
if(_malloc_lock) {
|
||||
printf("error; multiple locks active\n");
|
||||
SDL_DestroyMutex(_malloc_lock);
|
||||
_malloc_lock= NULL;
|
||||
}
|
||||
|
||||
_malloc_lock = SDL_CreateMutex();
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ typedef struct SceneRenderLayer {
|
||||
#define SCE_PASS_SPEC 16
|
||||
#define SCE_PASS_SHADOW 32
|
||||
#define SCE_PASS_AO 64
|
||||
#define SCE_PASS_MIRROR 128
|
||||
#define SCE_PASS_RAY 128
|
||||
#define SCE_PASS_NORMAL 256
|
||||
#define SCE_PASS_VECTOR 512
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ typedef struct Render Render;
|
||||
and how it's converted
|
||||
*/
|
||||
|
||||
typedef struct RenderPass {
|
||||
struct RenderPass *next, *prev;
|
||||
int passtype;
|
||||
float *rect;
|
||||
} RenderPass;
|
||||
|
||||
/* a renderlayer is a full image, but with all passes and samples */
|
||||
/* size of the rects is defined in RenderResult */
|
||||
typedef struct RenderLayer {
|
||||
@@ -66,8 +72,6 @@ typedef struct RenderLayer {
|
||||
int layflag, passflag;
|
||||
|
||||
float *rectf; /* 4 float, standard rgba buffer */
|
||||
float *rectz; /* 1 float, standard camera coordinate zbuffer */
|
||||
float *rectvec; /* 2 float, screen aligned speed vectors */
|
||||
|
||||
ListBase passes;
|
||||
|
||||
@@ -113,19 +117,20 @@ typedef struct RenderStats {
|
||||
|
||||
/* the name is used as identifier, so elsewhere in blender the result can retrieved */
|
||||
/* calling a new render with same name, frees automatic existing render */
|
||||
Render *RE_NewRender (const char *name);
|
||||
Render *RE_GetRender(const char *name);
|
||||
struct Render *RE_NewRender (const char *name);
|
||||
struct Render *RE_GetRender(const char *name);
|
||||
|
||||
/* use free render as signal to do everything over (previews) */
|
||||
void RE_FreeRender (Render *re);
|
||||
void RE_FreeRender (struct Render *re);
|
||||
/* only called on exit */
|
||||
void RE_FreeAllRender (void);
|
||||
|
||||
/* get results and statistics */
|
||||
RenderResult *RE_GetResult(Render *re);
|
||||
void RE_GetResultImage(Render *re, RenderResult *rr);
|
||||
RenderStats *RE_GetStats(Render *re);
|
||||
void RE_ResultGet32(Render *re, unsigned int *rect);
|
||||
RenderResult *RE_GetResult(struct Render *re);
|
||||
void RE_GetResultImage(struct Render *re, RenderResult *rr);
|
||||
RenderStats *RE_GetStats(struct Render *re);
|
||||
void RE_ResultGet32(struct Render *re, unsigned int *rect);
|
||||
float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype);
|
||||
|
||||
/* obligatory initialize call, disprect is optional */
|
||||
void RE_InitState (struct Render *re, struct RenderData *rd, int winx, int winy, rcti *disprect);
|
||||
@@ -134,37 +139,37 @@ void RE_InitState (struct Render *re, struct RenderData *rd, int winx, int winy,
|
||||
void RE_SetDispRect (struct Render *re, rcti *disprect);
|
||||
|
||||
/* set up the viewplane/perspective matrix, three choices */
|
||||
void RE_SetCamera(Render *re, struct Object *camera);
|
||||
void RE_SetWindow (Render *re, rctf *viewplane, float clipsta, float clipend);
|
||||
void RE_SetOrtho (Render *re, rctf *viewplane, float clipsta, float clipend);
|
||||
void RE_SetCamera(struct Render *re, struct Object *camera);
|
||||
void RE_SetWindow (struct Render *re, rctf *viewplane, float clipsta, float clipend);
|
||||
void RE_SetOrtho (struct Render *re, rctf *viewplane, float clipsta, float clipend);
|
||||
|
||||
/* option to set viewmatrix before making dbase */
|
||||
void RE_SetView (Render *re, float mat[][4]);
|
||||
void RE_SetView (struct Render *re, float mat[][4]);
|
||||
|
||||
/* make or free the dbase */
|
||||
void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view);
|
||||
void RE_Database_Free (Render *re);
|
||||
void RE_Database_FromScene(struct Render *re, struct Scene *scene, int use_camera_view);
|
||||
void RE_Database_Free (struct Render *re);
|
||||
|
||||
/* project dbase again, when viewplane/perspective changed */
|
||||
void RE_DataBase_ApplyWindow(Render *re);
|
||||
void RE_DataBase_ApplyWindow(struct Render *re);
|
||||
|
||||
/* the main processor, assumes all was set OK! */
|
||||
void RE_TileProcessor(Render *re);
|
||||
void RE_TileProcessor(struct Render *re);
|
||||
|
||||
/* only RE_NewRender() needed, main Blender render calls */
|
||||
void RE_BlenderFrame(Render *re, struct Scene *scene, int frame);
|
||||
void RE_BlenderAnim(Render *re, struct Scene *scene, int sfra, int efra);
|
||||
void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame);
|
||||
void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra);
|
||||
|
||||
|
||||
/* display and event callbacks */
|
||||
void RE_display_init_cb (Render *re, void (*f)(RenderResult *rr));
|
||||
void RE_display_clear_cb(Render *re, void (*f)(RenderResult *rr));
|
||||
void RE_display_draw_cb (Render *re, void (*f)(RenderResult *rr, struct rcti *rect));
|
||||
void RE_stats_draw_cb (Render *re, void (*f)(RenderStats *rs));
|
||||
void RE_timecursor_cb (Render *re, void (*f)(int));
|
||||
void RE_test_break_cb (Render *re, int (*f)(void));
|
||||
void RE_test_return_cb (Render *re, int (*f)(void));
|
||||
void RE_error_cb (Render *re, void (*f)(const char *str));
|
||||
void RE_display_init_cb (struct Render *re, void (*f)(RenderResult *rr));
|
||||
void RE_display_clear_cb(struct Render *re, void (*f)(RenderResult *rr));
|
||||
void RE_display_draw_cb (struct Render *re, void (*f)(RenderResult *rr, struct rcti *rect));
|
||||
void RE_stats_draw_cb (struct Render *re, void (*f)(RenderStats *rs));
|
||||
void RE_timecursor_cb (struct Render *re, void (*f)(int));
|
||||
void RE_test_break_cb (struct Render *re, int (*f)(void));
|
||||
void RE_test_return_cb (struct Render *re, int (*f)(void));
|
||||
void RE_error_cb (struct Render *re, void (*f)(const char *str));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,11 +46,15 @@ typedef struct TexResult {
|
||||
typedef struct ShadeResult
|
||||
{
|
||||
float combined[4];
|
||||
float col[4];
|
||||
float alpha;
|
||||
float diff[3];
|
||||
float spec[3];
|
||||
float alpha;
|
||||
float shad[3];
|
||||
float ao[3];
|
||||
float ray[3];
|
||||
float nor[3];
|
||||
float winspeed[2];
|
||||
float winspeed[3];
|
||||
|
||||
} ShadeResult;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
* (float vecs to float vec)
|
||||
*/
|
||||
void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w);
|
||||
void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize);
|
||||
|
||||
/**
|
||||
* Alpha-over blending for floats.
|
||||
|
||||
@@ -85,7 +85,7 @@ void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
|
||||
void zbufshade(void);
|
||||
void zbufshadeDA(void); /* Delta Accum Pixel Struct */
|
||||
|
||||
void *shadepixel(RenderPart *pa, float x, float y, int z, int facenr, int mask, struct ShadeResult *shr, float *rco);
|
||||
void *shadepixel(RenderPart *pa, float x, float y, int z, int facenr, int mask, struct ShadeResult *shr, float *rco, int passflag);
|
||||
|
||||
int count_mask(unsigned short mask);
|
||||
|
||||
|
||||
@@ -133,6 +133,11 @@ void RE_freeN(void *poin)
|
||||
|
||||
/* ********************** */
|
||||
|
||||
static int g_break= 0;
|
||||
static int thread_break(void)
|
||||
{
|
||||
return g_break;
|
||||
}
|
||||
|
||||
/* default callbacks, set in each new render */
|
||||
static void result_nothing(RenderResult *rr) {}
|
||||
@@ -148,9 +153,14 @@ static void free_render_result(RenderResult *res)
|
||||
|
||||
while(res->layers.first) {
|
||||
RenderLayer *rl= res->layers.first;
|
||||
|
||||
if(rl->rectf) RE_freeN(rl->rectf);
|
||||
if(rl->rectz) RE_freeN(rl->rectz);
|
||||
if(rl->rectvec) RE_freeN(rl->rectvec);
|
||||
while(rl->passes.first) {
|
||||
RenderPass *rpass= rl->passes.first;
|
||||
RE_freeN(rpass->rect);
|
||||
BLI_remlink(&rl->passes, rpass);
|
||||
RE_freeN(rpass);
|
||||
}
|
||||
BLI_remlink(&res->layers, rl);
|
||||
RE_freeN(rl);
|
||||
}
|
||||
@@ -165,6 +175,25 @@ static void free_render_result(RenderResult *res)
|
||||
RE_freeN(res);
|
||||
}
|
||||
|
||||
static void render_layer_add_pass(RenderLayer *rl, int rectsize, int passtype, char *mallocstr)
|
||||
{
|
||||
RenderPass *rpass= MEM_mallocN(sizeof(RenderPass), mallocstr);
|
||||
|
||||
BLI_addtail(&rl->passes, rpass);
|
||||
rpass->passtype= passtype;
|
||||
rpass->rect= MEM_callocN(sizeof(float)*rectsize, mallocstr);
|
||||
}
|
||||
|
||||
float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype)
|
||||
{
|
||||
RenderPass *rpass;
|
||||
|
||||
for(rpass=rl->passes.first; rpass; rpass= rpass->next)
|
||||
if(rpass->passtype== passtype)
|
||||
return rpass->rect;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* called by main render as well for parts */
|
||||
/* will read info from Render *re to define layers */
|
||||
/* called in threads */
|
||||
@@ -205,10 +234,25 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop)
|
||||
rl->passflag= srl->passflag;
|
||||
|
||||
rl->rectf= RE_callocN(rectx*recty*sizeof(float)*4, "layer float rgba");
|
||||
|
||||
if(srl->passflag & SCE_PASS_Z)
|
||||
rl->rectz= RE_callocN(rectx*recty*sizeof(float), "layer float Z");
|
||||
render_layer_add_pass(rl, rectx*recty, SCE_PASS_Z, "Layer float Z");
|
||||
if(srl->passflag & SCE_PASS_VECTOR)
|
||||
rl->rectvec= RE_callocN(rectx*recty*sizeof(float)*2, "layer float Vector");
|
||||
render_layer_add_pass(rl, rectx*recty*2, SCE_PASS_VECTOR, "layer float Vector");
|
||||
if(srl->passflag & SCE_PASS_NORMAL)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_NORMAL, "layer float Normal");
|
||||
if(srl->passflag & SCE_PASS_RGBA)
|
||||
render_layer_add_pass(rl, rectx*recty*4, SCE_PASS_RGBA, "layer float Color");
|
||||
if(srl->passflag & SCE_PASS_DIFFUSE)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_DIFFUSE, "layer float Diffuse");
|
||||
if(srl->passflag & SCE_PASS_SPEC)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_SPEC, "layer float Spec");
|
||||
if(srl->passflag & SCE_PASS_SHADOW)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_SHADOW, "layer float Shadow");
|
||||
if(srl->passflag & SCE_PASS_AO)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_AO, "layer float AO");
|
||||
if(srl->passflag & SCE_PASS_RAY)
|
||||
render_layer_add_pass(rl, rectx*recty*3, SCE_PASS_RAY, "layer float Mirror");
|
||||
|
||||
}
|
||||
/* previewrender and envmap don't do layers, so we make a default one */
|
||||
@@ -217,13 +261,11 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop)
|
||||
BLI_addtail(&rr->layers, rl);
|
||||
|
||||
rl->rectf= RE_callocN(rectx*recty*sizeof(float)*4, "prev/env float rgba");
|
||||
rl->rectz= RE_callocN(rectx*recty*sizeof(float), "prev/env float Z");
|
||||
|
||||
/* note, this has to be in sync with scene.c */
|
||||
rl->lay= (1<<20) -1;
|
||||
rl->layflag= 0x7FFF; /* solid ztra halo strand */
|
||||
rl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
|
||||
|
||||
rl->passflag= SCE_PASS_COMBINED;
|
||||
}
|
||||
|
||||
return rr;
|
||||
@@ -277,18 +319,30 @@ static void do_merge_tile(RenderResult *rr, RenderResult *rrpart, float *target,
|
||||
static void merge_render_result(RenderResult *rr, RenderResult *rrpart)
|
||||
{
|
||||
RenderLayer *rl, *rlp;
|
||||
RenderPass *rpass, *rpassp;
|
||||
|
||||
for(rl= rr->layers.first, rlp= rrpart->layers.first; rl && rlp; rl= rl->next, rlp= rlp->next) {
|
||||
|
||||
/* combined */
|
||||
if(rl->rectf && rlp->rectf)
|
||||
do_merge_tile(rr, rrpart, rl->rectf, rlp->rectf, 4);
|
||||
/* z */
|
||||
if(rl->rectz && rlp->rectz)
|
||||
do_merge_tile(rr, rrpart, rl->rectz, rlp->rectz, 1);
|
||||
/* vector */
|
||||
if(rl->rectvec && rlp->rectvec)
|
||||
do_merge_tile(rr, rrpart, rl->rectvec, rlp->rectvec, 2);
|
||||
|
||||
/* passes are allocated in sync */
|
||||
for(rpass= rl->passes.first, rpassp= rlp->passes.first; rpass && rpassp; rpass= rpass->next, rpassp= rpassp->next) {
|
||||
switch(rpass->passtype) {
|
||||
case SCE_PASS_Z:
|
||||
do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, 1);
|
||||
break;
|
||||
case SCE_PASS_VECTOR:
|
||||
do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, 2);
|
||||
break;
|
||||
case SCE_PASS_RGBA:
|
||||
do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, 4);
|
||||
break;
|
||||
default:
|
||||
do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +391,7 @@ void RE_GetResultImage(Render *re, RenderResult *rr)
|
||||
if(rr->rectf==NULL)
|
||||
rr->rectf= rl->rectf;
|
||||
if(rr->rectz==NULL)
|
||||
rr->rectz= rl->rectz;
|
||||
rr->rectz= RE_RenderLayerGetPass(rl, SCE_PASS_Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -683,11 +737,12 @@ static void threaded_tile_processor(Render *re)
|
||||
/* assuming no new data gets added to dbase... */
|
||||
R= *re;
|
||||
|
||||
/* set threadsafety */
|
||||
R.test_break= thread_break;
|
||||
malloc_lock = SDL_CreateMutex();
|
||||
|
||||
while(rendering) {
|
||||
|
||||
/* I noted that test_break() in a thread doesn't make ghost send ESC */
|
||||
if(BLI_available_threads(&threads) && !re->test_break()) {
|
||||
pa= find_nicest_part(re);
|
||||
if(pa) {
|
||||
@@ -728,12 +783,14 @@ static void threaded_tile_processor(Render *re)
|
||||
drawtimer= 0;
|
||||
|
||||
/* on break, wait for all slots to get freed */
|
||||
if(re->test_break() && BLI_available_threads(&threads)==maxthreads)
|
||||
if( (g_break=re->test_break()) && BLI_available_threads(&threads)==maxthreads)
|
||||
rendering= 0;
|
||||
|
||||
}
|
||||
|
||||
/* restore threadsafety */
|
||||
if(malloc_lock) SDL_DestroyMutex(malloc_lock); malloc_lock= NULL;
|
||||
g_break= 0;
|
||||
|
||||
BLI_end_threads(&threads);
|
||||
freeparts(re);
|
||||
|
||||
@@ -212,24 +212,18 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
|
||||
}
|
||||
}
|
||||
|
||||
/* filtered adding to scanlines */
|
||||
void add_filt_fmask_alphaunder(unsigned int mask, float *col, float *rowbuf, int row_w)
|
||||
void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize)
|
||||
{
|
||||
/* calc the value of mask */
|
||||
float **fmask1= R.samples->fmask1, **fmask2=R.samples->fmask2;
|
||||
float *rb1, *rb2, *rb3;
|
||||
float val, r, g, b, al, acol[4];
|
||||
float val;
|
||||
unsigned int a, maskand, maskshift;
|
||||
int j;
|
||||
int i, j;
|
||||
|
||||
r= col[0];
|
||||
g= col[1];
|
||||
b= col[2];
|
||||
al= col[3];
|
||||
|
||||
rb2= rowbuf-4;
|
||||
rb3= rb2-4*row_w;
|
||||
rb1= rb2+4*row_w;
|
||||
rb2= rowbuf-pixsize;
|
||||
rb3= rb2-pixsize*row_w;
|
||||
rb1= rb2+pixsize*row_w;
|
||||
|
||||
maskand= (mask & 255);
|
||||
maskshift= (mask >>8);
|
||||
@@ -240,40 +234,30 @@ void add_filt_fmask_alphaunder(unsigned int mask, float *col, float *rowbuf, int
|
||||
|
||||
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
|
||||
if(val!=0.0) {
|
||||
acol[0]= val*r;
|
||||
acol[1]= val*g;
|
||||
acol[2]= val*b;
|
||||
acol[3]= val*al;
|
||||
addAlphaUnderFloat(rb1, acol);
|
||||
for(i= 0; i<pixsize; i++)
|
||||
rb1[i]+= val*in[i];
|
||||
}
|
||||
a+=3;
|
||||
|
||||
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
|
||||
if(val!=0.0) {
|
||||
acol[0]= val*r;
|
||||
acol[1]= val*g;
|
||||
acol[2]= val*b;
|
||||
acol[3]= val*al;
|
||||
addAlphaUnderFloat(rb2, acol);
|
||||
for(i= 0; i<pixsize; i++)
|
||||
rb2[i]+= val*in[i];
|
||||
}
|
||||
a+=3;
|
||||
|
||||
val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
|
||||
if(val!=0.0) {
|
||||
acol[0]= val*r;
|
||||
acol[1]= val*g;
|
||||
acol[2]= val*b;
|
||||
acol[3]= val*al;
|
||||
addAlphaUnderFloat(rb3, acol);
|
||||
for(i= 0; i<pixsize; i++)
|
||||
rb3[i]+= val*in[i];
|
||||
}
|
||||
|
||||
rb1+= 4;
|
||||
rb2+= 4;
|
||||
rb3+= 4;
|
||||
rb1+= pixsize;
|
||||
rb2+= pixsize;
|
||||
rb3+= pixsize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
void addalphaAddFloat(float *dest, float *source)
|
||||
{
|
||||
|
||||
@@ -1516,7 +1516,7 @@ static void color_combine(float *result, float fac1, float fac2, float *col1, fl
|
||||
#endif
|
||||
|
||||
/* the main recursive tracer itself */
|
||||
static void traceray(short depth, float *start, float *vec, float *col, VlakRen *vlr, int mask, int osatex, int traflag)
|
||||
static void traceray(ShadeInput *origshi, short depth, float *start, float *vec, float *col, VlakRen *vlr, int traflag)
|
||||
{
|
||||
ShadeInput shi;
|
||||
ShadeResult shr;
|
||||
@@ -1533,9 +1533,13 @@ static void traceray(short depth, float *start, float *vec, float *col, VlakRen
|
||||
|
||||
if( d3dda(&isec) ) {
|
||||
|
||||
shi.mask= mask;
|
||||
shi.osatex= osatex;
|
||||
shi.mask= origshi->mask;
|
||||
shi.osatex= origshi->osatex;
|
||||
shi.depth= 1; // only now to indicate tracing
|
||||
shi.thread= origshi->thread;
|
||||
shi.xs= origshi->xs;
|
||||
shi.ys= origshi->ys;
|
||||
shi.do_preview= 0;
|
||||
|
||||
shade_ray(&isec, &shi, &shr);
|
||||
|
||||
@@ -1559,10 +1563,10 @@ static void traceray(short depth, float *start, float *vec, float *col, VlakRen
|
||||
refraction(refract, shi.vn, shi.view, shi.ang);
|
||||
}
|
||||
traflag |= RAY_TRA;
|
||||
traceray(depth-1, shi.co, refract, tracol, shi.vlr, shi.mask, osatex, traflag ^ RAY_TRAFLIP);
|
||||
traceray(origshi, depth-1, shi.co, refract, tracol, shi.vlr, traflag ^ RAY_TRAFLIP);
|
||||
}
|
||||
else
|
||||
traceray(depth-1, shi.co, shi.view, tracol, shi.vlr, shi.mask, osatex, 0);
|
||||
traceray(origshi, depth-1, shi.co, shi.view, tracol, shi.vlr, 0);
|
||||
|
||||
f= shr.alpha; f1= 1.0-f;
|
||||
fr= 1.0+ shi.mat->filter*(shi.r-1.0);
|
||||
@@ -1591,7 +1595,7 @@ static void traceray(short depth, float *start, float *vec, float *col, VlakRen
|
||||
float mircol[4];
|
||||
|
||||
reflection(ref, shi.vn, shi.view, NULL);
|
||||
traceray(depth-1, shi.co, ref, mircol, shi.vlr, shi.mask, osatex, 0);
|
||||
traceray(origshi, depth-1, shi.co, ref, mircol, shi.vlr, 0);
|
||||
|
||||
f1= 1.0-f;
|
||||
|
||||
@@ -1767,10 +1771,10 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
|
||||
|
||||
if(shi->mat->mode & MA_RAYTRANSP) {
|
||||
refraction(refract, shi->vn, shi->view, shi->ang);
|
||||
traceray(shi->mat->ray_depth_tra, shi->co, refract, tracol, shi->vlr, shi->mask, 0, RAY_TRA|RAY_TRAFLIP);
|
||||
traceray(shi, shi->mat->ray_depth_tra, shi->co, refract, tracol, shi->vlr, RAY_TRA|RAY_TRAFLIP);
|
||||
}
|
||||
else
|
||||
traceray(shi->mat->ray_depth_tra, shi->co, shi->view, tracol, shi->vlr, shi->mask, 0, 0);
|
||||
traceray(shi, shi->mat->ray_depth_tra, shi->co, shi->view, tracol, shi->vlr, 0);
|
||||
|
||||
f= shr->alpha; f1= 1.0-f;
|
||||
fr= 1.0+ shi->mat->filter*(shi->r-1.0);
|
||||
@@ -1796,7 +1800,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
|
||||
else
|
||||
reflection(vec, shi->vn, shi->view, NULL);
|
||||
|
||||
traceray(shi->mat->ray_depth, shi->co, vec, mircol, shi->vlr, shi->mask, shi->osatex, 0);
|
||||
traceray(shi, shi->mat->ray_depth, shi->co, vec, mircol, shi->vlr, 0);
|
||||
|
||||
f= i*fr*(1.0-shr->spec[0]); f1= 1.0-i;
|
||||
shr->diff[0]= f*mircol[0] + f1*shr->diff[0];
|
||||
@@ -2073,7 +2077,7 @@ void ray_ao(ShadeInput *shi, float *shadfac)
|
||||
bias= 0.0;
|
||||
nrm= shi->facenor;
|
||||
}
|
||||
|
||||
|
||||
vec= sphere_sampler(R.wrld.aomode, R.wrld.aosamp, shi->thread, shi->xs, shi->ys);
|
||||
|
||||
// warning: since we use full sphere now, and dotproduct is below, we do twice as much
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2049,7 +2049,7 @@ static void shadetrapixel(RenderPart *pa, float x, float y, int z, int facenr, i
|
||||
if(vlr->flag & R_FULL_OSA) {
|
||||
for(a=0; a<R.osa; a++) {
|
||||
if(mask & (1<<a)) {
|
||||
shadepixel(pa, x+R.jit[a][0], y+R.jit[a][1], z, facenr, 1<<a, &shr, rco);
|
||||
shadepixel(pa, x+R.jit[a][0], y+R.jit[a][1], z, facenr, 1<<a, &shr, rco, 0);
|
||||
accumcol[0]+= shr.combined[0];
|
||||
accumcol[1]+= shr.combined[1];
|
||||
accumcol[2]+= shr.combined[2];
|
||||
@@ -2067,12 +2067,12 @@ static void shadetrapixel(RenderPart *pa, float x, float y, int z, int facenr, i
|
||||
int b= R.samples->centmask[mask];
|
||||
x= x+R.samples->centLut[b & 15];
|
||||
y= y+R.samples->centLut[b>>4];
|
||||
shadepixel(pa, x, y, z, facenr, mask, &shr, rco);
|
||||
shadepixel(pa, x, y, z, facenr, mask, &shr, rco, 0);
|
||||
QUATCOPY(fcol, shr.combined);
|
||||
}
|
||||
}
|
||||
else {
|
||||
shadepixel(pa, x, y, z, facenr, mask, &shr, rco);
|
||||
shadepixel(pa, x, y, z, facenr, mask, &shr, rco, 0);
|
||||
QUATCOPY(fcol, shr.combined);
|
||||
}
|
||||
}
|
||||
@@ -2238,15 +2238,21 @@ void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short l
|
||||
/* uses part zbuffer values to convert into distances from camera in renderlayer */
|
||||
void convert_zbuf_to_distbuf(RenderPart *pa, RenderLayer *rl)
|
||||
{
|
||||
RenderPass *rpass;
|
||||
float *rectzf, zco;
|
||||
int a, *rectz, ortho= R.r.mode & R_ORTHO;
|
||||
|
||||
if(pa->rectz==NULL) return;
|
||||
if(rl->rectz==NULL) {
|
||||
for(rpass= rl->passes.first; rpass; rpass= rpass->next)
|
||||
if(rpass->passtype==SCE_PASS_Z)
|
||||
break;
|
||||
|
||||
if(rpass==NULL) {
|
||||
printf("called convert zbuf wrong...\n");
|
||||
return;
|
||||
}
|
||||
rectzf= rl->rectz;
|
||||
|
||||
rectzf= rpass->rect;
|
||||
rectz= pa->rectz;
|
||||
|
||||
for(a=pa->rectx*pa->recty; a>0; a--, rectz++, rectzf++) {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version. The Blender
|
||||
# Foundation also sells licenses for use in proprietary software under
|
||||
# the Blender License. See http://www.blender.org/BL/ for information
|
||||
# about this.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
#
|
||||
# Bounces make to subdirectories.
|
||||
|
||||
SOURCEDIR = source/blender/renderconverter
|
||||
DIRS = intern
|
||||
|
||||
include nan_subdirs.mk
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
* Interface to transform the Blender scene into renderable data.
|
||||
*
|
||||
* @mainpage RE - Blender RE-converter external interface
|
||||
*
|
||||
* @section about About the RE-converter module
|
||||
*
|
||||
* The converter takes a Blender scene, and transforms the data into
|
||||
* renderer-specific data.
|
||||
*
|
||||
* Conversions:
|
||||
*
|
||||
* halos: (world settings) stars ->
|
||||
* some particle effects ->
|
||||
* meshes with halo prop ->
|
||||
* HaloRen (made by inithalo)
|
||||
*
|
||||
*
|
||||
* VlakRen (face render data)
|
||||
* Each vlakren needs several VertRens to make sense.
|
||||
* VertRen (vertex render data)
|
||||
*
|
||||
* @section issues Known issues with RE-converter
|
||||
*
|
||||
*
|
||||
* @section dependencies Dependencies
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
||||
#ifndef RE_RENDERCONVERTER_H
|
||||
#define RE_RENDERCONVERTER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct LampRen;
|
||||
struct Object;
|
||||
struct Lamp;
|
||||
|
||||
/** Transform a blender scene to render data. */
|
||||
void RE_rotateBlenderScene(void);
|
||||
|
||||
/** Free all memory used for the conversion. */
|
||||
void RE_freeRotateBlenderScene(void);
|
||||
|
||||
/**
|
||||
* Used by the preview renderer.
|
||||
*/
|
||||
void RE_add_render_lamp(struct Object *ob, int doshadbuf);
|
||||
|
||||
/**
|
||||
* Strange support for star rendering for drawview.c... For
|
||||
* rendering purposes, these function pointers should be NULL.
|
||||
*/
|
||||
void RE_make_stars(void (*initfunc)(void),
|
||||
void (*vertexfunc)(float*),
|
||||
void (*termfunc)(void));
|
||||
|
||||
/**
|
||||
* called by meshtools
|
||||
*/
|
||||
void RE_make_sticky(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
Import ('user_options_dict')
|
||||
Import ('library_env')
|
||||
|
||||
renderconv_env = library_env.Copy ()
|
||||
|
||||
source_files = ['intern/convertBlenderScene.c']
|
||||
|
||||
renderconv_env.Append (CPPPATH = ['.',
|
||||
'../renderconverter',
|
||||
'../blenlib',
|
||||
'../yafray',
|
||||
'../radiosity/extern/include',
|
||||
'#/intern/guardedalloc',
|
||||
'../makesdna',
|
||||
'../blenkernel',
|
||||
'../include',
|
||||
'../render/extern/include',
|
||||
'../python'])
|
||||
|
||||
renderconv_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_renderconverter', source=source_files)
|
||||
@@ -1,58 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version. The Blender
|
||||
# Foundation also sells licenses for use in proprietary software under
|
||||
# the Blender License. See http://www.blender.org/BL/ for information
|
||||
# about this.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = renderconverter
|
||||
DIR = $(OCGDIR)/blender/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
|
||||
CFLAGS += -funsigned-char
|
||||
endif
|
||||
|
||||
# CFLAGS += $(LEVEL_2_C_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(OPENGL_HEADERS)
|
||||
# path to our own external headerfiles
|
||||
CPPFLAGS += -I..
|
||||
# not very neat: the dirs for external modules
|
||||
CPPFLAGS += -I../../render/extern/include
|
||||
CPPFLAGS += -I../../yafray
|
||||
CPPFLAGS += -I../../radiosity/extern/include
|
||||
CPPFLAGS += -I../../python
|
||||
CPPFLAGS += -I../../blenkernel
|
||||
CPPFLAGS += -I../../blenlib
|
||||
CPPFLAGS += -I../../makesdna
|
||||
CPPFLAGS += -I../../include
|
||||
CPPFLAGS += -I../../
|
||||
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1576,16 +1576,17 @@ static void render_panel_layers(void)
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Passes:", 10,30,150,20, NULL, 0, 0, 0, 0, "");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitS(block, TOG, SCE_PASS_COMBINED, B_NOP,"Combined", 130, 30, 155, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_Z, B_NOP,"Z", 285, 30, 25, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_COMBINED, B_NOP,"Combined", 130, 30, 115, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_Z, B_NOP,"Z", 245, 30, 25, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_VECTOR, B_NOP,"Vec", 270, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Vector pass");
|
||||
|
||||
uiDefButBitS(block, TOG, SCE_PASS_DIFFUSE, B_NOP,"Diff",10, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_SPEC, B_NOP,"Spec", 55, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_SHADOW, B_NOP,"Shad", 100, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_AO, B_NOP,"AO", 145, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_MIRROR, B_NOP,"Mirr", 185, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_NORMAL, B_NOP,"Nor", 230, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_VECTOR, B_NOP,"Vec", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_RGBA, B_NOP,"Col", 10, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver shade-less Color pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_DIFFUSE, B_NOP,"Diff",55, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_SPEC, B_NOP,"Spec", 100, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Specular pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_SHADOW, B_NOP,"Shad", 145, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Shadow pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_AO, B_NOP,"AO", 185, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver AO pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_RAY, B_NOP,"Ray", 225, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Mirror and Transparent pass");
|
||||
uiDefButBitS(block, TOG, SCE_PASS_NORMAL, B_NOP,"Nor", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Normal pass");
|
||||
}
|
||||
|
||||
void render_panels()
|
||||
|
||||
@@ -743,8 +743,8 @@ static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode
|
||||
uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
|
||||
dy-= 19;
|
||||
uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
|
||||
uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC+node->nr, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
|
||||
}
|
||||
return 80;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,18 @@ static void load_node_image(char *str) /* called from fileselect */
|
||||
}
|
||||
}
|
||||
|
||||
static bNode *snode_get_editgroup(SpaceNode *snode)
|
||||
{
|
||||
bNode *gnode;
|
||||
|
||||
/* get the groupnode */
|
||||
for(gnode= snode->nodetree->nodes.first; gnode; gnode= gnode->next)
|
||||
if(gnode->flag & NODE_GROUP_EDIT)
|
||||
break;
|
||||
return gnode;
|
||||
}
|
||||
|
||||
|
||||
static void composit_node_event(SpaceNode *snode, short event)
|
||||
{
|
||||
|
||||
@@ -219,7 +231,12 @@ static void composit_node_event(SpaceNode *snode, short event)
|
||||
/* B_NODE_EXEC */
|
||||
{
|
||||
bNode *node= BLI_findlink(&snode->edittree->nodes, event-B_NODE_EXEC);
|
||||
if(node) NodeTagChanged(snode->edittree, node);
|
||||
if(node) {
|
||||
NodeTagChanged(snode->edittree, node);
|
||||
node= snode_get_editgroup(snode);
|
||||
if(node)
|
||||
NodeTagChanged(snode->nodetree, node);
|
||||
}
|
||||
snode_handle_recalc(snode);
|
||||
}
|
||||
}
|
||||
@@ -385,17 +402,6 @@ static void node_set_active(SpaceNode *snode, bNode *node)
|
||||
}
|
||||
}
|
||||
|
||||
static bNode *snode_get_editgroup(SpaceNode *snode)
|
||||
{
|
||||
bNode *gnode;
|
||||
|
||||
/* get the groupnode */
|
||||
for(gnode= snode->nodetree->nodes.first; gnode; gnode= gnode->next)
|
||||
if(gnode->flag & NODE_GROUP_EDIT)
|
||||
break;
|
||||
return gnode;
|
||||
}
|
||||
|
||||
static void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
Reference in New Issue
Block a user