diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-02 20:18:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-02 20:18:11 +0300 |
commit | f8ce4ebf073cec4224a29c3ac9d3961814f93c4d (patch) | |
tree | b7384a4aa60d011e45ba34bd093ca439b5fc4b78 | |
parent | f694d3792941ce24092865cffb038aa0e5cc08f2 (diff) |
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.
4 files changed, 4 insertions, 7 deletions
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); diff --git a/source/blender/shader_fx/intern/FX_shader_light.c b/source/blender/shader_fx/intern/FX_shader_light.c index 9a17ea8ae5f..86715e1a1a7 100644 --- a/source/blender/shader_fx/intern/FX_shader_light.c +++ b/source/blender/shader_fx/intern/FX_shader_light.c @@ -63,7 +63,6 @@ static void updateDepsgraph(ShaderFxData *md, const ModifierUpdateDepsgraphConte { LightShaderFxData *fxd = (LightShaderFxData *)md; if (fxd->object != NULL) { - DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_GEOMETRY, "Light ShaderFx"); DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, "Light ShaderFx"); } DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Light ShaderFx"); diff --git a/source/blender/shader_fx/intern/FX_shader_shadow.c b/source/blender/shader_fx/intern/FX_shader_shadow.c index ba1bd4fe907..aa8808f268b 100644 --- a/source/blender/shader_fx/intern/FX_shader_shadow.c +++ b/source/blender/shader_fx/intern/FX_shader_shadow.c @@ -74,7 +74,6 @@ static void updateDepsgraph(ShaderFxData *fx, const ModifierUpdateDepsgraphConte { ShadowShaderFxData *fxd = (ShadowShaderFxData *)fx; if (fxd->object != NULL) { - DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_GEOMETRY, "Shadow ShaderFx"); DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, "Shadow ShaderFx"); } DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Shadow ShaderFx"); diff --git a/source/blender/shader_fx/intern/FX_shader_swirl.c b/source/blender/shader_fx/intern/FX_shader_swirl.c index 9667f466eec..40fa20e62d5 100644 --- a/source/blender/shader_fx/intern/FX_shader_swirl.c +++ b/source/blender/shader_fx/intern/FX_shader_swirl.c @@ -62,7 +62,6 @@ static void updateDepsgraph(ShaderFxData *fx, const ModifierUpdateDepsgraphConte { SwirlShaderFxData *fxd = (SwirlShaderFxData *)fx; if (fxd->object != NULL) { - DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_GEOMETRY, "Swirl ShaderFx"); DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, "Swirl ShaderFx"); } DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Swirl ShaderFx"); |