From b67d08c3c77d704e4aba687165974b09ffaaf420 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 6 Jan 2011 14:58:58 +0000 Subject: 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. :) --- .../blender/nodes/intern/CMP_nodes/CMP_texture.c | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'source/blender/nodes/intern/CMP_nodes') diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index b6335d6afe7..d344e9bf959 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -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); } } -- cgit v1.2.3