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 656fbc4..0d30689 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;
                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);
                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));
                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 c9c8b74..88b3d5a 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -76,6 +76,7 @@ DRAWFLAG_NORMAL,
 DRAWFLAG_ADDITIVE,
 DRAWFLAG_MODULATE,
 DRAWFLAG_2XMODULATE,
 DRAWFLAG_ADDITIVE,
 DRAWFLAG_MODULATE,
 DRAWFLAG_2XMODULATE,
+DRAWFLAG_SCREEN,
 DRAWFLAG_NUMFLAGS,
 DRAWFLAG_MASK = 0xFF,   // ONLY R_BeginPolygon()
 DRAWFLAG_MIPMAP = 0x100 // ONLY R_BeginPolygon()
 DRAWFLAG_NUMFLAGS,
 DRAWFLAG_MASK = 0xFF,   // ONLY R_BeginPolygon()
 DRAWFLAG_MIPMAP = 0x100 // ONLY R_BeginPolygon()
index 468a162..9d3d47b 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);
                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);
 }
        else
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }