[Bf-blender-cvs] [9d2ee7998ad] blender2.8: Draw Manager: Add new blend mode for transmission.

Clément Foucault noreply at git.blender.org
Mon Jul 3 22:10:24 CEST 2017


Commit: 9d2ee7998ad1855839fda51a5a748d31159226b3
Author: Clément Foucault
Date:   Mon Jul 3 16:28:20 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB9d2ee7998ad1855839fda51a5a748d31159226b3

Draw Manager: Add new blend mode for transmission.

This blend Mode is doing  Source + Destination * Alpha.

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

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 75608debaac..e6f05542357 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -253,7 +253,8 @@ typedef enum {
 	DRW_STATE_BLEND         = (1 << 14),
 	DRW_STATE_ADDITIVE      = (1 << 15),
 	DRW_STATE_MULTIPLY      = (1 << 16),
-	DRW_STATE_CLIP_PLANES   = (1 << 17),
+	DRW_STATE_TRANSMISSION  = (1 << 17),
+	DRW_STATE_CLIP_PLANES   = (1 << 18),
 
 	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 0dd551562ae..f777b714c63 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1401,7 +1401,7 @@ static void DRW_state_set(DRWState state)
 	{
 		int test;
 		if (CHANGED_ANY_STORE_VAR(
-		        DRW_STATE_BLEND | DRW_STATE_ADDITIVE | DRW_STATE_MULTIPLY,
+		        DRW_STATE_BLEND | DRW_STATE_ADDITIVE | DRW_STATE_MULTIPLY | DRW_STATE_TRANSMISSION,
 		        test))
 		{
 			if (test) {
@@ -1413,6 +1413,9 @@ static void DRW_state_set(DRWState state)
 				else if ((state & DRW_STATE_MULTIPLY) != 0) {
 					glBlendFunc(GL_DST_COLOR, GL_ZERO);
 				}
+				else if ((state & DRW_STATE_TRANSMISSION) != 0) {
+					glBlendFunc(GL_ONE, GL_SRC_ALPHA);
+				}
 				else if ((state & DRW_STATE_ADDITIVE) != 0) {
 					glBlendFunc(GL_ONE, GL_ONE);
 				}




More information about the Bf-blender-cvs mailing list