]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
add DRAWFLAG_SCREEN (which basically is like invert-modulate-invert, equivalent to...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Oct 2008 15:06:28 +0000 (15:06 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Oct 2008 15:06:28 +0000 (15:06 +0000)
Just like modulate always darkens, screen always brightens.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8528 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
draw.h
gl_draw.c

index 656fbc4e1076153f4d5ab3682a12fdd1a2806ec6..0d30689c41dd3cc00780318b5825d155ef4d7e3a 100644 (file)
@@ -2480,12 +2480,16 @@ static void VM_DrawPolygonCallback (const entity_render_t *ent, const rtlight_t
                int numtriangles = 0;
                rtexture_t *tex = polys->data_triangles[surfacelist[surfacelistindex]].texture;
                int drawflag = polys->data_triangles[surfacelist[surfacelistindex]].drawflag;
+               // this can't call _DrawQ_ProcessDrawFlag, but should be in sync with it
+               // FIXME factor this out
                if(drawflag == DRAWFLAG_ADDITIVE)
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
                else if(drawflag == DRAWFLAG_MODULATE)
                        GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
                else if(drawflag == DRAWFLAG_2XMODULATE)
                        GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+               else if(drawflag == DRAWFLAG_SCREEN)
+                       GL_BlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ONE);
                else
                        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                R_Mesh_TexBind(0, R_GetTexture(tex));
diff --git a/draw.h b/draw.h
index c9c8b745b949d7369b3933a70cff34c0a6e17cd8..88b3d5a11f1e8f5c850cb4f854f875b54d107fb0 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -76,6 +76,7 @@ DRAWFLAG_NORMAL,
 DRAWFLAG_ADDITIVE,
 DRAWFLAG_MODULATE,
 DRAWFLAG_2XMODULATE,
+DRAWFLAG_SCREEN,
 DRAWFLAG_NUMFLAGS,
 DRAWFLAG_MASK = 0xFF,   // ONLY R_BeginPolygon()
 DRAWFLAG_MIPMAP = 0x100 // ONLY R_BeginPolygon()
index 468a1624aff5de1a416d5c45f7545df57bf8c51e..9d3d47b531deb7b14b87d4b978717657f6f6223f 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -813,6 +813,8 @@ static void _DrawQ_ProcessDrawFlag(int flags)
                GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
        else if(flags == DRAWFLAG_2XMODULATE)
                GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+       else if(flags == DRAWFLAG_SCREEN)
+               GL_BlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ONE);
        else
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }