Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2011-07-29 10:32:30 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-07-29 10:32:30 +0400
commitb46d8955509e805f06b76a6fd800ecb4edee113b (patch)
tree7ed0b1a3b5d04ab48d3e9062ff02ce54961ecb06 /source/blender/render/intern/source/render_texture.c
parent6960127d2609620d52620539388ada5cb466bab2 (diff)
parent26589497529ca3c8da85391d4976d286a371e258 (diff)
Merging r36529-38806bge_components
Diffstat (limited to 'source/blender/render/intern/source/render_texture.c')
-rw-r--r--source/blender/render/intern/source/render_texture.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 5f5dab94ba3..5aad055a8f6 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -2118,7 +2118,8 @@ void do_material_tex(ShadeInput *shi)
float fact, facm, factt, facmm, stencilTin=1.0;
float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0;
int tex_nr, rgbnor= 0, warpdone=0;
- int use_compat_bump, use_ntap_bump;
+ int use_compat_bump = 0, use_ntap_bump = 0;
+ int found_nmapping = 0;
int iFirstTimeNMap=1;
compatible_bump_init(&compat_bump);
@@ -2192,6 +2193,7 @@ void do_material_tex(ShadeInput *shi)
}
}
else if(mtex->texco==TEXCO_REFL) {
+ calc_R_ref(shi);
co= shi->ref; dx= shi->dxref; dy= shi->dyref;
}
else if(mtex->texco==TEXCO_NORM) {
@@ -2428,6 +2430,9 @@ void do_material_tex(ShadeInput *shi)
/* we need to code blending modes for normals too once.. now 1 exception hardcoded */
if ((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP)) {
+
+ found_nmapping = 1;
+
/* qdn: for normalmaps, to invert the normalmap vector,
it is better to negate x & y instead of subtracting the vector as was done before */
if (norfac < 0.0f) {
@@ -2509,9 +2514,6 @@ void do_material_tex(ShadeInput *shi)
shi->orn[0]= -shi->vn[0];
shi->orn[1]= -shi->vn[1];
shi->orn[2]= -shi->vn[2];
-
- /* reflection vector */
- calc_R_ref(shi);
}
}
@@ -2622,6 +2624,12 @@ void do_material_tex(ShadeInput *shi)
}
}
}
+ if ((use_compat_bump || use_ntap_bump || found_nmapping) && (shi->mat->mode & MA_TANGENT_V)!=0) {
+ const float fnegdot = -dot_v3v3(shi->vn, shi->tang);
+ // apply Gram-Schmidt projection
+ madd_v3_v3fl(shi->tang, shi->vn, fnegdot);
+ normalize_v3(shi->tang);
+ }
}