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:
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 0ca929da65d..ed7a2f4ede0 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1127,7 +1127,16 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), shi->vn, tnor, &newnor);
}
}
+ else if (mtex->normapspace == MTEX_NSPACE_OBJECT) {
+ /* transform normal by object then view matrix */
+ GPU_link(mat, "mtex_nspace_object", GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), tnor, &newnor);
+ }
+ else if (mtex->normapspace == MTEX_NSPACE_WORLD) {
+ /* transform normal by view matrix */
+ GPU_link(mat, "mtex_nspace_world", GPU_builtin(GPU_VIEW_MATRIX), tnor, &newnor);
+ }
else {
+ /* no transform, normal in camera space */
newnor = tnor;
}