Todo item:

Compositor: Texture Node now behaves like an image.
- Image always in render output size
- Buffer outputs RGBA and Value both supported
- Works for filter and blur and scaling too.
- Mixing 2 textures works

Implementation note:
The texture node was meant to be 'procedural', not a buffer
but a color-sample method. Unfortunately the node editor 
didn't support this well, blur/filter/scale ignored it too.

For now, its better to drop this procedural concept, then
things work at least as expected. :)
This commit is contained in:
Ton Roosendaal
2011-01-06 14:58:58 +00:00
parent 7b302d5052
commit b67d08c3c7

View File

@@ -90,16 +90,12 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
/* outputs: value, color, normal */
if(node->id) {
/* RenderData *rd= data; */
/* short sizex, sizey; */
RenderData *rd= data;
short sizex, sizey;
/* first make the preview image */
CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */
/* Also take care about the render size! */
/* sizex = (rd->size*rd->xsch)/100; */
/* sizey = (rd->size*rd->ysch)/100; */
prevbuf->rect_procedural= texture_procedural;
prevbuf->node= node;
VECCOPY(prevbuf->procedural_offset, in[0]->vec);
@@ -107,32 +103,39 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
prevbuf->procedural_type= CB_RGBA;
composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
/* texture is procedural node, like RGBA node, we give it fake buffer for nodes that don't check it */
generate_preview(data, node, prevbuf);
free_compbuf(prevbuf);
/* texture procedural buffer type doesnt work well, we now render a buffer in scene size */
sizex = (rd->size*rd->xsch)/100;
sizey = (rd->size*rd->ysch)/100;
if(out[0]->hasoutput) {
CompBuf *stackbuf= dupalloc_compbuf(prevbuf); /* buffer alloc */
CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
stackbuf->rect_procedural= texture_procedural;
stackbuf->node= node;
VECCOPY(stackbuf->procedural_offset, in[0]->vec);
VECCOPY(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_VAL;
composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_value, CB_VAL);
stackbuf->rect_procedural= NULL;
out[0]->data= stackbuf;
}
if(out[1]->hasoutput) {
CompBuf *stackbuf= dupalloc_compbuf(prevbuf); /* buffer alloc */
CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */
stackbuf->rect_procedural= texture_procedural;
stackbuf->node= node;
VECCOPY(stackbuf->procedural_offset, in[0]->vec);
VECCOPY(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_RGBA;
composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
stackbuf->rect_procedural= NULL;
out[1]->data= stackbuf;
}
generate_preview(data, node, prevbuf);
free_compbuf(prevbuf);
}
}