diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-09 19:45:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-09 19:45:46 +0400 |
commit | f39758cddca1d6eeec299e8cd3eef9a2a1852e32 (patch) | |
tree | f0fea31777404174be524ab6feca2f30ec05bf99 /source/blender/src | |
parent | 610b877f60083ef064058efc7011a5b35c5e96b7 (diff) |
adding clip alpha (binary alpha) to the 3D view and game engine.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_editing.c | 1 | ||||
-rw-r--r-- | source/blender/src/drawmesh.c | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 6250b69345b..7e154d6c341 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -6235,6 +6235,7 @@ static void editing_panel_mesh_texface(void) uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color"); uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face"); uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture"); + uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha", 780,80,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)"); } else uiDefBut(block,LABEL,B_NOP, "(No Active Face)", 10,200,150,19,0,0,0,0,0,""); diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index b72cd3f56f8..dd512595ebc 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -228,13 +228,14 @@ int set_tpage(MTFace *tface) alphamode= tface->transp; if(alphamode) { - glEnable(GL_BLEND); - if(alphamode==TF_ADD) { + glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); + glDisable ( GL_ALPHA_TEST ); /* glBlendEquationEXT(GL_FUNC_ADD_EXT); */ } else if(alphamode==TF_ALPHA) { + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* added after 2.45 to clip alpha */ @@ -245,9 +246,12 @@ int set_tpage(MTFace *tface) glEnable ( GL_ALPHA_TEST ); glAlphaFunc ( GL_GREATER, U.glalphaclip ); } - - /* glBlendEquationEXT(GL_FUNC_ADD_EXT); */ + } else if (alphamode==TF_CLIP){ + glDisable(GL_BLEND); + glEnable ( GL_ALPHA_TEST ); + glAlphaFunc(GL_GREATER, 0.5f); } + /* glBlendEquationEXT(GL_FUNC_ADD_EXT); */ /* else { */ /* glBlendFunc(GL_ONE, GL_ONE); */ /* glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); */ |