forked from bartvdbraak/blender
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.
This commit is contained in:
parent
5f5ec9ec3c
commit
e72c278f47
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user