[Bf-blender-cvs] [264b1e1e15f] master: Cleanup: GPU: Encapsulate glFrontFace
Clément Foucault
noreply at git.blender.org
Sat Jul 18 03:08:17 CEST 2020
Commit: 264b1e1e15ff3a6971166c8b93b3f0a06a60cc83
Author: Clément Foucault
Date: Fri Jul 17 20:13:11 2020 +0200
Branches: master
https://developer.blender.org/rB264b1e1e15ff3a6971166c8b93b3f0a06a60cc83
Cleanup: GPU: Encapsulate glFrontFace
===================================================================
M source/blender/editors/space_view3d/drawobject.c
M source/blender/gpu/GPU_state.h
M source/blender/gpu/intern/gpu_state.c
===================================================================
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 5959052b0ab..f17d7ccd136 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -126,7 +126,7 @@ void ED_draw_object_facemap(Depsgraph *depsgraph,
}
}
- glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
+ GPU_front_facing(ob->transflag & OB_NEG_SCALE);
/* Just to create the data to pass to immediate mode, grr! */
const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP);
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index 0a97016e06d..c9f745a680d 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -59,6 +59,7 @@ void GPU_blend_set_func_separate(eGPUBlendFunction src_rgb,
eGPUBlendFunction src_alpha,
eGPUBlendFunction dst_alpha);
void GPU_face_culling(eGPUFaceCull culling);
+void GPU_front_facing(bool invert);
void GPU_depth_range(float near, float far);
void GPU_depth_test(bool enable);
bool GPU_depth_test_enabled(void);
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
index 6d707161e97..c8f51b14343 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -89,6 +89,11 @@ void GPU_face_culling(eGPUFaceCull culling)
}
}
+void GPU_front_facing(bool invert)
+{
+ glFrontFace((invert) ? GL_CW : GL_CCW);
+}
+
void GPU_depth_range(float near, float far)
{
/* glDepthRangef is only for OpenGL 4.1 or higher */
More information about the Bf-blender-cvs
mailing list