diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-08 20:33:54 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-08 21:13:32 +0300 |
commit | 7e380fd46a6f5353eceaec383c40f20bf6c1551f (patch) | |
tree | 5d16028b66ff2886752f5515dd524625a648d48e /source/blender/nodes | |
parent | 24aeb479be2b87d406196240c1a4c20e1688514e (diff) |
GPU: Remove GPU_INVERSE_NORMAL_MATRIX
The end goal for this is to lower the number of needed matrices.
This also cleanup some uneeded transformation.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_coord.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_image.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c index fd62e8ce960..eed53f5c286 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c @@ -60,7 +60,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, in, out, GPU_builtin(GPU_VIEW_POSITION), - GPU_builtin(GPU_VIEW_NORMAL), + GPU_builtin(GPU_WORLD_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), inv_obmat, GPU_builtin(GPU_CAMERA_TEXCO_FACTORS), diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index 91d58bc41d0..109690cf423 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -111,7 +111,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, } GPUNodeLink *norm, *col1, *col2, *col3, *input_coords, *gpu_image; - GPUNodeLink *vnor, *nor_mat_inv, *blend; + GPUNodeLink *vnor, *ob_mat, *blend; GPUNodeLink **texco = &in[0].link; int isdata = tex->color_space == SHD_COLORSPACE_NONE; @@ -146,12 +146,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, break; case SHD_PROJ_BOX: - vnor = GPU_builtin(GPU_VIEW_NORMAL); - nor_mat_inv = GPU_builtin(GPU_INVERSE_NORMAL_MATRIX); + vnor = GPU_builtin(GPU_WORLD_NORMAL); + ob_mat = GPU_builtin(GPU_OBJECT_MATRIX); blend = GPU_uniform(&tex->projection_blend); gpu_image = GPU_image(ima, iuser, isdata); - GPU_link(mat, "mat3_mul", vnor, nor_mat_inv, &norm); + /* equivalent to transform_normal_world_to_object */ + GPU_link(mat, "normal_transform_transposed_m4v3", vnor, ob_mat, &norm); GPU_link( mat, gpu_node_name, *texco, norm, GPU_image(ima, iuser, isdata), &col1, &col2, &col3); if (do_color_correction) { |