diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-29 05:47:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-29 05:47:03 +0400 |
commit | e72c278f47d27aef76dc6ca976bfcba668dce260 (patch) | |
tree | 5a93bb5a90e4904865fbb08752123c7e232deeb4 | |
parent | 5f5ec9ec3cdff0fe7b0c3e3c2df791677ab053ec (diff) |
2 fixes for un-initialized memory uses, when running testfile: teapot_envmap.blend
boxsample() expected talpha to be set beforehand, also dont set the int value as a float since its confusing.
-rw-r--r-- | source/blender/nodes/intern/TEX_nodes/TEX_output.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/imagetexture.c | 4 |
3 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c index 63a3a7ae15c..30b5aee7832 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c @@ -65,7 +65,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread); target->tin = (target->tr + target->tg + target->tb) / 3.0f; - target->talpha = 1.0f; + target->talpha = 1; if(target->nor) { if(in[1] && in[1]->hasinput) diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index c4065b30cb0..1e40ab886ae 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -730,6 +730,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe TexResult texr1, texr2; texr1.nor= texr2.nor= NULL; + texr1.talpha= texr2.talpha= texres->talpha; /* boxclip expects this initialized */ add_v3_v3(vec, dxt); face1= envcube_isect(env, vec, sco); diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 36577cb171a..e5afc492c61 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -521,6 +521,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max * clipped-away parts are sampled as well. */ /* note: actually minx etc isnt in the proper range... this due to filter size and offset vectors for bump */ + /* note: talpha must be initialized */ TexResult texr; rctf *rf, stack[8]; float opp, tot, alphaclip= 1.0; @@ -1779,7 +1780,8 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) ibuf->rect+= (ibuf->x*ibuf->y); - + + texres.talpha= 1; /* boxsample expects to be initialized */ boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1); result[0]= texres.tr; result[1]= texres.tg; |