DRW: Fix facing reset when drawing with inverted camera

This commit is contained in:
Clément Foucault 2020-02-20 00:03:18 +01:00
parent 03a4d3c33f
commit 67cbce0b02
1 changed files with 7 additions and 2 deletions

View File

@ -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]);