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:
authorMorten Mikkelsen <mikkelsen7@gmail.com>2011-09-22 09:36:52 +0400
committerMorten Mikkelsen <mikkelsen7@gmail.com>2011-09-22 09:36:52 +0400
commit68a9450dd19a228312756c7a653255c6f34d1913 (patch)
treecf6e7e22bffa2af267feb43027636e277c623dbb /source/blender/gpu
parentdc09774fb62ca3b8fe7e8b0da32d50636884a14b (diff)
addendum to prev bugfix on texture space bump
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_material.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 40186c5a187..c3cbcb61622 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1091,6 +1091,9 @@ static void do_material_tex(GPUShadeInput *shi)
float ima_x, ima_y;
float hScale = 0.1f; // compatibility adjustment factor for all bumpspace types
float hScaleTex = 13.0f; // factor for scaling texspace bumps
+
+ float imag_tspace_dimension_x = 1024.0f; // only used for texture space variant
+ float aspect = 1.0f;
GPUNodeLink *surf_pos = GPU_builtin(GPU_VIEW_POSITION);
GPUNodeLink *vR1, *vR2;
@@ -1154,6 +1157,7 @@ static void do_material_tex(GPUShadeInput *shi)
if(ibuf) {
ima_x= ibuf->x;
ima_y= ibuf->y;
+ aspect = ((float) ima_y) / ima_x;
}
}
@@ -1174,10 +1178,11 @@ static void do_material_tex(GPUShadeInput *shi)
if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
-
+ float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
GPU_link( mat, "mtex_bump_apply_texspace",
fDet, dBs, dBt, vR1, vR2,
- GPU_image(tex->ima, &tex->iuser), texco, GPU_uniform(&ima_x), GPU_uniform(&ima_y), vNacc,
+ GPU_image(tex->ima, &tex->iuser), texco,
+ GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
&vNacc, &shi->vn );
} else
GPU_link( mat, "mtex_bump_apply",