From f8ce4ebf073cec4224a29c3ac9d3961814f93c4d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 Jan 2019 18:18:11 +0100 Subject: Fix wrong grease pencil shader FX usage of object location. It should use the evaluated object location, and not add any unnecessary dependency on geometry data. --- source/blender/draw/engines/gpencil/gpencil_shader_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/draw/engines/gpencil/gpencil_shader_fx.c') diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index 225dc1a58d7..db080b0626b 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -310,7 +310,7 @@ static void DRW_gpencil_fx_light( DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1); /* location of the light using obj location as origin */ - copy_v3_v3(fxd->loc, &fxd->object->loc[0]); + copy_v3_v3(fxd->loc, fxd->object->obmat[3]); /* Calc distance to strokes plane * The w component of location is used to transfer the distance to drawing plane @@ -323,7 +323,7 @@ static void DRW_gpencil_fx_light( } mul_mat3_m4_v3(cache->obmat, r_normal); /* only rotation component */ plane_from_point_normal_v3(r_plane, r_point, r_normal); - float dt = dist_to_plane_v3(fxd->object->loc, r_plane); + float dt = dist_to_plane_v3(fxd->object->obmat[3], r_plane); fxd->loc[3] = dt; /* use last element to save it */ DRW_shgroup_uniform_vec4(fx_shgrp, "loc", &fxd->loc[0], 1); @@ -469,7 +469,7 @@ static void DRW_gpencil_fx_shadow( DRW_shgroup_uniform_vec4(fx_shgrp, "shadow_color", &fxd->shadow_rgba[0], 1); if ((fxd->object) && (fxd->flag & FX_SHADOW_USE_OBJECT)) { - DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &fxd->object->loc[0], 1); + DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->object->obmat[3], 1); } else { DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1); @@ -609,7 +609,7 @@ static void DRW_gpencil_fx_swirl( DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1); - DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &fxd->object->loc[0], 1); + DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->object->obmat[3], 1); DRW_shgroup_uniform_int(fx_shgrp, "radius", &fxd->radius, 1); DRW_shgroup_uniform_float(fx_shgrp, "angle", &fxd->angle, 1); -- cgit v1.2.3