[Bf-blender-cvs] [06cc5e49946] blender2.8: DrawManager: Add support for writting to depth without depth testing.

Clément Foucault noreply at git.blender.org
Thu Jun 22 18:54:14 CEST 2017


Commit: 06cc5e499466a9e9085be987b768e453e9c22ad5
Author: Clément Foucault
Date:   Thu Jun 22 18:53:36 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB06cc5e499466a9e9085be987b768e453e9c22ad5

DrawManager: Add support for writting to depth without depth testing.

Disabling depth test will prevent from writting to depth buffer.
Add DRW_STATE_DEPTH_ALWAYS to always pass the depth test and write to depth.

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

M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_manager.c

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

diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 07e9abcbd47..de2099806e3 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -241,18 +241,19 @@ typedef enum {
 	DRW_STATE_DEPTH_LESS    = (1 << 2),
 	DRW_STATE_DEPTH_EQUAL   = (1 << 3),
 	DRW_STATE_DEPTH_GREATER = (1 << 4),
-	DRW_STATE_CULL_BACK     = (1 << 5),
-	DRW_STATE_CULL_FRONT    = (1 << 6),
-	DRW_STATE_WIRE          = (1 << 7),
-	DRW_STATE_WIRE_LARGE    = (1 << 8),
-	DRW_STATE_POINT         = (1 << 9),
-	DRW_STATE_STIPPLE_2     = (1 << 10),
-	DRW_STATE_STIPPLE_3     = (1 << 11),
-	DRW_STATE_STIPPLE_4     = (1 << 12),
-	DRW_STATE_BLEND         = (1 << 13),
-	DRW_STATE_ADDITIVE      = (1 << 14),
-	DRW_STATE_MULTIPLY      = (1 << 15),
-	DRW_STATE_CLIP_PLANES   = (1 << 16),
+	DRW_STATE_DEPTH_ALWAYS  = (1 << 5),
+	DRW_STATE_CULL_BACK     = (1 << 6),
+	DRW_STATE_CULL_FRONT    = (1 << 7),
+	DRW_STATE_WIRE          = (1 << 8),
+	DRW_STATE_WIRE_LARGE    = (1 << 9),
+	DRW_STATE_POINT         = (1 << 10),
+	DRW_STATE_STIPPLE_2     = (1 << 11),
+	DRW_STATE_STIPPLE_3     = (1 << 12),
+	DRW_STATE_STIPPLE_4     = (1 << 13),
+	DRW_STATE_BLEND         = (1 << 14),
+	DRW_STATE_ADDITIVE      = (1 << 15),
+	DRW_STATE_MULTIPLY      = (1 << 16),
+	DRW_STATE_CLIP_PLANES   = (1 << 17),
 
 	DRW_STATE_WRITE_STENCIL_SELECT = (1 << 27),
 	DRW_STATE_WRITE_STENCIL_ACTIVE = (1 << 28),
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 5f73699587c..c8434b114b3 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1340,7 +1340,7 @@ static void DRW_state_set(DRWState state)
 	{
 		DRWState test;
 		if (CHANGED_ANY_STORE_VAR(
-		        DRW_STATE_DEPTH_LESS | DRW_STATE_DEPTH_EQUAL | DRW_STATE_DEPTH_GREATER,
+		        DRW_STATE_DEPTH_LESS | DRW_STATE_DEPTH_EQUAL | DRW_STATE_DEPTH_GREATER | DRW_STATE_DEPTH_ALWAYS,
 		        test))
 		{
 			if (test) {
@@ -1355,6 +1355,9 @@ static void DRW_state_set(DRWState state)
 				else if (state & DRW_STATE_DEPTH_GREATER) {
 					glDepthFunc(GL_GREATER);
 				}
+				else if (state & DRW_STATE_DEPTH_ALWAYS) {
+					glDepthFunc(GL_ALWAYS);
+				}
 				else {
 					BLI_assert(0);
 				}




More information about the Bf-blender-cvs mailing list