[Bf-blender-cvs] [67cbce0b02f] master: DRW: Fix facing reset when drawing with inverted camera

Clément Foucault noreply at git.blender.org
Thu Feb 20 00:03:30 CET 2020


Commit: 67cbce0b02f097e764c2f582adc868bb7fa37ee5
Author: Clément Foucault
Date:   Thu Feb 20 00:03:18 2020 +0100
Branches: master
https://developer.blender.org/rB67cbce0b02f097e764c2f582adc868bb7fa37ee5

DRW: Fix facing reset when drawing with inverted camera

===================================================================

M	source/blender/draw/intern/draw_manager_exec.c

===================================================================

diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 0ff3e2b1853..807f17a5635 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -1072,7 +1072,12 @@ static void draw_call_resource_bind(DRWCommandsState *state, const DRWResourceHa
   /* Front face is not a resource but it is inside the resource handle. */
   bool neg_scale = DRW_handle_negative_scale_get(handle);
   if (neg_scale != state->neg_scale) {
-    glFrontFace((neg_scale != DST.view_active->is_inverted) ? GL_CW : GL_CCW);
+    if (DST.view_active->is_inverted) {
+      glFrontFace(neg_scale ? GL_CCW : GL_CW);
+    }
+    else {
+      glFrontFace(neg_scale ? GL_CW : GL_CCW);
+    }
     state->neg_scale = neg_scale;
   }
 
@@ -1203,7 +1208,7 @@ static void draw_call_batching_finish(DRWShadingGroup *shgroup, DRWCommandsState
 
   /* Reset state */
   if (state->neg_scale) {
-    glFrontFace(GL_CCW);
+    glFrontFace(DST.view_active->is_inverted ? GL_CW : GL_CCW);
   }
   if (state->obmats_loc != -1) {
     GPU_uniformbuffer_unbind(DST.vmempool->matrices_ubo[state->resource_chunk]);



More information about the Bf-blender-cvs mailing list