- enabled texture and model matrices for shader-less rendering and fixed the sky cap color application.

This commit is contained in:
Christoph Oelckers 2016-04-26 20:45:56 +02:00
parent 9d71c91f01
commit 89f36fb963
2 changed files with 39 additions and 3 deletions

View file

@ -197,6 +197,8 @@ static bool ffFogEnabled;
static PalEntry ffFogColor;
static int ffSpecialEffect;
static float ffFogDensity;
static bool currentTextureMatrixState;
static bool currentModelMatrixState;
void FRenderState::ApplyFixedFunction()
{
@ -282,13 +284,42 @@ void FRenderState::ApplyFixedFunction()
if (mAlphaThreshold > 0)
{
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, mAlphaThreshold);
glAlphaFunc(GL_GREATER, mAlphaThreshold * col.vec[3]);
}
else
{
glDisable(GL_ALPHA_TEST);
}
if (mTextureMatrixEnabled)
{
glMatrixMode(GL_TEXTURE);
glLoadMatrixf(mTextureMatrix.get());
currentTextureMatrixState = true;
}
else if (currentTextureMatrixState)
{
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
currentTextureMatrixState = false;
}
if (mModelMatrixEnabled)
{
VSMatrix mult = mViewMatrix;
mult.multMatrix(mModelMatrix);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(mult.get());
currentModelMatrixState = true;
}
else if (currentModelMatrixState)
{
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(mViewMatrix.get());
currentModelMatrixState = false;
}
}
void gl_FillScreen();

View file

@ -104,7 +104,7 @@ void FSkyVertexBuffer::BindVBO()
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(FSkyVertex), &VSO->color);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
}
@ -254,6 +254,11 @@ void FSkyVertexBuffer::RenderDome(FMaterial *tex, int mode)
gl_RenderState.Apply();
RenderRow(GL_TRIANGLE_FAN, rc);
gl_RenderState.EnableTexture(true);
// The color array can only be activated now if this is drawn without shader
if (gl.glslversion == 0)
{
glEnableClientState(GL_COLOR_ARRAY);
}
}
gl_RenderState.SetObjectColor(0xffffffff);
gl_RenderState.Apply();
@ -523,7 +528,7 @@ void GLSkyPortal::DrawContents()
gl_RenderState.SetTextureMode(TM_MODULATE);
}
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.05f);
gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
if (origin->doublesky && origin->texture[1])
{