* Remy: please rename context.alphaTestEnabled to alphaTestFallOff and make it a float. Also, add FixedFuncBinding.AlphaTestFallOff and make J3MLoader parse it
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9746 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
5b326f4054
commit
13132e10cc
@ -204,12 +204,19 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
||||
glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
if (context.alphaTestFallOff > 0f) {
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, context.alphaTestFallOff);
|
||||
} else {
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset fixed function bindings to default values.
|
||||
*/
|
||||
private void resetFixedFuncBindings(){
|
||||
context.alphaTestFallOff = 0f; // zero means disable alpha test!
|
||||
context.color = null;
|
||||
context.ambient = null;
|
||||
context.diffuse = null;
|
||||
@ -219,6 +226,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
||||
}
|
||||
|
||||
public void setFixedFuncBinding(FixedFuncBinding ffBinding, Object val) {
|
||||
float falloff;
|
||||
switch (ffBinding) {
|
||||
case Color:
|
||||
context.color = (ColorRGBA) val;
|
||||
@ -238,6 +246,9 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
||||
case UseVertexColor:
|
||||
context.useVertexColor = (Boolean) val;
|
||||
break;
|
||||
case AlphaTestFallOff:
|
||||
context.alphaTestFallOff = (Float) val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,15 +270,12 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
||||
context.depthTestEnabled = false;
|
||||
}
|
||||
|
||||
if (state.isAlphaTest() && !context.alphaTestEnabled) {
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, state.getAlphaFallOff());
|
||||
context.alphaTestEnabled = true;
|
||||
} else if (!state.isAlphaTest() && context.alphaTestEnabled) {
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
context.alphaTestEnabled = false;
|
||||
if (state.isAlphaTest()) {
|
||||
setFixedFuncBinding(FixedFuncBinding.AlphaTestFallOff, state.getAlphaFallOff());
|
||||
} else {
|
||||
setFixedFuncBinding(FixedFuncBinding.AlphaTestFallOff, 0f); // disable it
|
||||
}
|
||||
|
||||
|
||||
if (state.isDepthWrite() && !context.depthWriteEnabled) {
|
||||
glDepthMask(true);
|
||||
context.depthWriteEnabled = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user