Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-06-09 19:45:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-06-09 19:45:46 +0400
commitf39758cddca1d6eeec299e8cd3eef9a2a1852e32 (patch)
treef0fea31777404174be524ab6feca2f30ec05bf99 /source/gameengine
parent610b877f60083ef064058efc7011a5b35c5e96b7 (diff)
adding clip alpha (binary alpha) to the 3D view and game engine.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp9
2 files changed, 17 insertions, 3 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
index 46fe24d8b87..09dd14172c8 100644
--- a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
@@ -154,16 +154,23 @@ int set_tpage(MTFace *tface)
fAlphamode= tface->transp;
if(fAlphamode) {
- glEnable(GL_BLEND);
-
if(fAlphamode==TF_ADD) {
+ glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
+ glDisable ( GL_ALPHA_TEST );
/* glBlendEquationEXT(GL_FUNC_ADD_EXT); */
}
else if(fAlphamode==TF_ALPHA) {
+ glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable ( GL_ALPHA_TEST );
/* glBlendEquationEXT(GL_FUNC_ADD_EXT); */
}
+ else if (alphamode==TF_CLIP){
+ glDisable(GL_BLEND);
+ glEnable ( GL_ALPHA_TEST );
+ glAlphaFunc(GL_GREATER, 0.5f);
+ }
/* else { */
/* glBlendFunc(GL_ONE, GL_ONE); */
/* glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); */
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 44727588106..5efe1ad26ca 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -478,16 +478,23 @@ bool KX_BlenderMaterial::setDefaultBlending()
if( mMaterial->transp &TF_ADD) {
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
+ glDisable ( GL_ALPHA_TEST );
return true;
}
if( mMaterial->transp & TF_ALPHA ) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable ( GL_ALPHA_TEST );
return true;
}
- glDisable(GL_BLEND);
+ if( mMaterial->transp & TF_CLIP ) {
+ glDisable(GL_BLEND);
+ glEnable ( GL_ALPHA_TEST );
+ glAlphaFunc(GL_GREATER, 0.5f);
+ return true;
+ }
return false;
}