diff options
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_texture_types.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/texture.c | 39 |
3 files changed, 21 insertions, 24 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 0d2b6747f79..03afa0b1b5a 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1026,9 +1026,7 @@ static void do_material_tex(GPUShadeInput *shi) if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) { if((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP)) { - tex->norfac = mtex->norfac; - - if(tex->norfac < 0.0f) + if(mtex->norfac < 0.0f) GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor); if(mtex->normapspace == MTEX_NSPACE_TANGENT) diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 5747669d015..3212ff7b534 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -236,7 +236,7 @@ typedef struct Tex { int frames, offset, sfra; float checkerdist, nabla; - float norfac; + float pad1; struct ImageUser iuser; diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 17ff1238061..9e89d101215 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -1311,18 +1311,18 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, localmtex.object= NULL; localmtex.texco= TEXCO_ORCO; - VECCOPY(texvec_l, texvec); + copy_v3_v3(texvec_l, texvec); if(dxt && dyt) { - VECCOPY(dxt_l, dxt); - VECCOPY(dyt_l, dyt); + copy_v3_v3(dxt_l, dxt); + copy_v3_v3(dyt_l, dyt); } else { - dxt_l[0]= dxt_l[1]= dxt_l[2]= 0.0f; - dyt_l[0]= dyt_l[1]= dyt_l[2]= 0.0f; + zero_v3(dxt_l); + zero_v3(dyt_l); } do_2d_mapping(&localmtex, texvec_l, NULL, NULL, dxt_l, dyt_l); - rgbnor= multitex(tex, texvec, dxt_l, dyt_l, osatex, texres, thread, which_output); + rgbnor= multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output); } return rgbnor; @@ -2119,19 +2119,18 @@ void do_material_tex(ShadeInput *shi) } if( (mtex->mapto & MAP_NORM) ) { if(texres.nor) { - tex->norfac= mtex->norfac; + float norfac= mtex->norfac; /* we need to code blending modes for normals too once.. now 1 exception hardcoded */ if ((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP)) { /* qdn: for normalmaps, to invert the normalmap vector, it is better to negate x & y instead of subtracting the vector as was done before */ - tex->norfac = mtex->norfac; - if (tex->norfac < 0.0f) { + if (norfac < 0.0f) { texres.nor[0] = -texres.nor[0]; texres.nor[1] = -texres.nor[1]; } - fact = Tnor*fabs(tex->norfac); + fact = Tnor*fabs(norfac); if (fact>1.f) fact = 1.f; facm = 1.f-fact; if(mtex->normapspace == MTEX_NSPACE_TANGENT) { @@ -2179,15 +2178,15 @@ void do_material_tex(ShadeInput *shi) float nor[3], dot; if(shi->mat->mode & MA_TANGENT_V) { - shi->tang[0]+= Tnor*tex->norfac*texres.nor[0]; - shi->tang[1]+= Tnor*tex->norfac*texres.nor[1]; - shi->tang[2]+= Tnor*tex->norfac*texres.nor[2]; + shi->tang[0]+= Tnor*norfac*texres.nor[0]; + shi->tang[1]+= Tnor*norfac*texres.nor[1]; + shi->tang[2]+= Tnor*norfac*texres.nor[2]; } /* prevent bump to become negative normal */ - nor[0]= Tnor*tex->norfac*texres.nor[0]; - nor[1]= Tnor*tex->norfac*texres.nor[1]; - nor[2]= Tnor*tex->norfac*texres.nor[2]; + nor[0]= Tnor*norfac*texres.nor[0]; + nor[1]= Tnor*norfac*texres.nor[1]; + nor[2]= Tnor*norfac*texres.nor[2]; dot= 0.5f + 0.5f*INPR(nor, shi->vn); @@ -2212,11 +2211,11 @@ void do_material_tex(ShadeInput *shi) /* Now that most textures offer both Nor and Intensity, allow */ /* both to work, and let user select with slider. */ if(texres.nor) { - tex->norfac= mtex->norfac; + float norfac= mtex->norfac; - shi->displace[0]+= 0.2f*Tnor*tex->norfac*texres.nor[0]; - shi->displace[1]+= 0.2f*Tnor*tex->norfac*texres.nor[1]; - shi->displace[2]+= 0.2f*Tnor*tex->norfac*texres.nor[2]; + shi->displace[0]+= 0.2f*Tnor*norfac*texres.nor[0]; + shi->displace[1]+= 0.2f*Tnor*norfac*texres.nor[1]; + shi->displace[2]+= 0.2f*Tnor*norfac*texres.nor[2]; } if(rgbnor & TEX_RGB) { |