diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-12-12 07:33:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-12 07:33:19 +0100 |
commit | 371de5132ce6315e0b60cc74ebd47c134c275361 (patch) | |
tree | 3c7c4be7733cb0310dad3d944c5ee21d0f837836 /drivers/gles3 | |
parent | f676d7509e301620fc72421e85e8d5e03555f8c1 (diff) | |
parent | eec77027115c94603de1671533dd6b56cdef250e (diff) |
Merge pull request #34251 from bojidar-bg/32993-lightoccluder-flip
Flip cull mode when rendering flipped Light2D and LightOccluder2D
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index c798dff839..1803a3dbbe 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1887,9 +1887,20 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons } state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::WORLD_MATRIX, instance->xform_cache); - if (cull != instance->cull_cache) { - cull = instance->cull_cache; + VS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache; + + if (transformed_cull_cache != VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED && + (p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) { + transformed_cull_cache = + transformed_cull_cache == VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ? + VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE : + VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE; + } + + if (cull != transformed_cull_cache) { + + cull = transformed_cull_cache; switch (cull) { case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: { |