diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-10-21 17:00:12 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-10-21 17:00:29 +0400 |
commit | 64dc1fd4082baaf7064505d8aff679ffabede8c3 (patch) | |
tree | 76f0b2ae6bfda598864654635551468f39faa4a4 /source/blender/gpu/intern | |
parent | bae0f904eece736e27ab379d73d78ffd90de626e (diff) |
Simplify GLSL in bump mapping, use gl_NormalMatrix where appropriate.
tangents are directions and should be transformed like directions.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 322d37055db..4182f51561b 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -665,7 +665,7 @@ static char *code_generate_vertex(ListBase *nodes) for (input=node->inputs.first; input; input=input->next) if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { if (input->attribtype == CD_TANGENT) { /* silly exception */ - BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize(gl_NormalMatrix * att%d.xyz);\n", input->attribid, input->attribid); BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid); } else diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index f91fd7a8c1e..32d7e04aeea 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1169,7 +1169,7 @@ static void do_material_tex(GPUShadeInput *shi) } 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); + GPU_link(mat, "mtex_nspace_object", tnor, &newnor); } else if (mtex->normapspace == MTEX_NSPACE_WORLD) { /* transform normal by view matrix */ |