mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Remove Gfx_SetAlphaTestFunc.
It's not actually supported in the modern GL backend at all, and only ever set internally to discard pixels with alpha > 128.
This commit is contained in:
parent
7eaa434f8e
commit
e267d43976
@ -113,7 +113,7 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec;
|
||||
#define CC_BUILD_GLMODERN
|
||||
#define CC_BUILD_GLES
|
||||
#define CC_BUILD_EGL
|
||||
#define CC_BUILD_LIBUNWIND
|
||||
#define CC_BUILD_UNWIND
|
||||
#elif defined __linux__
|
||||
#define CC_BUILD_LINUX
|
||||
#define CC_BUILD_POSIX
|
||||
|
@ -482,7 +482,6 @@ static void Game_Load(void) {
|
||||
Gfx_SetDepthTestFunc(COMPARE_FUNC_LESSEQUAL);
|
||||
/* Gfx_SetDepthWrite(true) */
|
||||
Gfx_SetAlphaBlendFunc(BLEND_FUNC_SRC_ALPHA, BLEND_FUNC_INV_SRC_ALPHA);
|
||||
Gfx_SetAlphaTestFunc(COMPARE_FUNC_GREATER, 0.5f);
|
||||
|
||||
Game_AddComponent(&PickedPosRenderer_Component);
|
||||
Game_AddComponent(&Audio_Component);
|
||||
|
@ -568,8 +568,6 @@ static float gfx_fogDensity = -1.0f, gfx_fogEnd = -1.0f;
|
||||
static D3DFOGMODE gfx_fogMode = D3DFOG_NONE;
|
||||
|
||||
static bool gfx_alphaTesting, gfx_alphaBlending;
|
||||
static int gfx_alphaTestRef;
|
||||
static D3DCMPFUNC gfx_alphaTestFunc = D3DCMP_ALWAYS;
|
||||
static D3DBLEND gfx_srcBlendFunc = D3DBLEND_ONE, gfx_dstBlendFunc = D3DBLEND_ZERO;
|
||||
|
||||
static PackedColUnion gfx_clearCol;
|
||||
@ -633,13 +631,6 @@ void Gfx_SetAlphaTest(bool enabled) {
|
||||
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, enabled, "D3D9_SetAlphaTest");
|
||||
}
|
||||
|
||||
void Gfx_SetAlphaTestFunc(CompareFunc func, float refValue) {
|
||||
gfx_alphaTestFunc = d3d9_compareFuncs[func];
|
||||
D3D9_SetRenderState(D3DRS_ALPHAFUNC, gfx_alphaTestFunc, "D3D9_SetAlphaTest_Func");
|
||||
gfx_alphaTestRef = (int)(refValue * 255);
|
||||
D3D9_SetRenderState2(D3DRS_ALPHAREF, gfx_alphaTestRef, "D3D9_SetAlphaTest_Ref");
|
||||
}
|
||||
|
||||
void Gfx_SetAlphaBlending(bool enabled) {
|
||||
if (gfx_alphaBlending == enabled) return;
|
||||
gfx_alphaBlending = enabled;
|
||||
@ -674,7 +665,7 @@ void Gfx_SetDepthTest(bool enabled) {
|
||||
|
||||
void Gfx_SetDepthTestFunc(CompareFunc func) {
|
||||
gfx_depthTestFunc = d3d9_compareFuncs[func];
|
||||
D3D9_SetRenderState(D3DRS_ZFUNC, gfx_alphaTestFunc, "D3D9_SetDepthTestFunc");
|
||||
D3D9_SetRenderState(D3DRS_ZFUNC, gfx_depthTestFunc, "D3D9_SetDepthTestFunc");
|
||||
}
|
||||
|
||||
void Gfx_SetDepthWrite(bool enabled) {
|
||||
@ -690,14 +681,16 @@ static void D3D9_SetDefaultRenderStates(void) {
|
||||
D3D9_SetRenderState2(D3DRS_SPECULARENABLE, false, "D3D9_SpecularEnable");
|
||||
D3D9_SetRenderState2(D3DRS_LOCALVIEWER, false, "D3D9_LocalViewer");
|
||||
D3D9_SetRenderState2(D3DRS_DEBUGMONITORTOKEN, false, "D3D9_DebugMonitor");
|
||||
|
||||
/* States relevant to the game */
|
||||
D3D9_SetRenderState2(D3DRS_ALPHAFUNC, D3DCMP_GREATER, "D3D9_AlphaTestFunc");
|
||||
D3D9_SetRenderState2(D3DRS_ALPHAREF, 127, "D3D9_AlphaRefFunc");
|
||||
}
|
||||
|
||||
static void D3D9_RestoreRenderStates(void) {
|
||||
union IntAndFloat raw;
|
||||
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, gfx_alphaTesting, "D3D9_AlphaTest");
|
||||
D3D9_SetRenderState2(D3DRS_ALPHABLENDENABLE, gfx_alphaBlending, "D3D9_AlphaBlend");
|
||||
D3D9_SetRenderState2(D3DRS_ALPHAFUNC, gfx_alphaTestFunc, "D3D9_AlphaTestFunc");
|
||||
D3D9_SetRenderState2(D3DRS_ALPHAREF, gfx_alphaTestRef, "D3D9_AlphaRefFunc");
|
||||
D3D9_SetRenderState2(D3DRS_SRCBLEND, gfx_srcBlendFunc, "D3D9_AlphaSrcBlend");
|
||||
D3D9_SetRenderState2(D3DRS_DESTBLEND, gfx_dstBlendFunc, "D3D9_AlphaDstBlend");
|
||||
|
||||
@ -1629,7 +1622,6 @@ void Gfx_SetFogMode(FogFunc func) {
|
||||
|
||||
void Gfx_SetTexturing(bool enabled) { }
|
||||
void Gfx_SetAlphaTest(bool enabled) { gfx_alphaTest = enabled; Gfx_SwitchProgram(); }
|
||||
void Gfx_SetAlphaTestFunc(CompareFunc func, float refValue) { }
|
||||
|
||||
void Gfx_LoadMatrix(MatrixType type, struct Matrix* matrix) {
|
||||
if (type == MATRIX_VIEW || type == MATRIX_PROJECTION) {
|
||||
@ -1775,9 +1767,6 @@ void Gfx_SetFogMode(FogFunc func) {
|
||||
|
||||
void Gfx_SetTexturing(bool enabled) { gl_Toggle(GL_TEXTURE_2D); }
|
||||
void Gfx_SetAlphaTest(bool enabled) { gl_Toggle(GL_ALPHA_TEST); }
|
||||
void Gfx_SetAlphaTestFunc(CompareFunc func, float value) {
|
||||
glAlphaFunc(gl_compare[func], value);
|
||||
}
|
||||
|
||||
static GLenum matrix_modes[3] = { GL_PROJECTION, GL_MODELVIEW, GL_TEXTURE };
|
||||
static int lastMatrix;
|
||||
@ -1796,6 +1785,7 @@ static void GL_InitState(void) {
|
||||
glHint(GL_FOG_HINT, GL_NICEST);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glAlphaFunc(GL_GREATER, 0.5f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,10 +91,8 @@ CC_API void Gfx_SetFogMode(FogFunc func);
|
||||
|
||||
/* Sets whether backface culling is performed. */
|
||||
CC_API void Gfx_SetFaceCulling(bool enabled);
|
||||
/* Sets whether new pixels may be discarded based on their alpha. */
|
||||
/* Sets whether pixels with an alpha of less than 128 are discarded. */
|
||||
CC_API void Gfx_SetAlphaTest(bool enabled);
|
||||
/* Sets in what way pixels may be discarded based on their alpha. */
|
||||
CC_API void Gfx_SetAlphaTestFunc(CompareFunc func, float refValue);
|
||||
/* Sets whether existing and new pixels are blended together. */
|
||||
CC_API void Gfx_SetAlphaBlending(bool enabled);
|
||||
/* Sets in what way existing and new pixels are blended. */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#endif
|
||||
|
||||
/* POSIX can be shared between unix-ish systems */
|
||||
/* NOTE: Android's bionic libc doesn't provide backtrace (execinfo.h) */
|
||||
#ifdef CC_BUILD_POSIX
|
||||
#if defined CC_BUILD_OPENBSD
|
||||
#include <signal.h>
|
||||
@ -35,10 +36,6 @@
|
||||
#include <ucontext.h>
|
||||
#endif
|
||||
#endif
|
||||
/* android's bionic libc doesn't provide backtrace */
|
||||
#ifdef CC_BUILD_ANDROID
|
||||
#define CC_BUILD_UNWIND
|
||||
#endif
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
|
Loading…
x
Reference in New Issue
Block a user