diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-06 17:58:58 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-06 17:58:58 +0300 |
commit | b67d08c3c77d704e4aba687165974b09ffaaf420 (patch) | |
tree | 83fbab03727626c61af995e1bb712ac02cfea178 /source/blender/nodes/intern/CMP_nodes/CMP_texture.c | |
parent | 7b302d5052f982f233cebd3492a5c4fb6f761994 (diff) |
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. :)
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_texture.c')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_texture.c | 27 |
1 files changed, 15 insertions, 12 deletions
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); } } |