mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
Fix glitching with q3 skies.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3345 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
9f20876069
commit
f5e3d5e499
1 changed files with 55 additions and 31 deletions
|
@ -133,6 +133,7 @@ void GL_Warp_Init(void)
|
||||||
" vec4 clouds = texture2D(transt, tccoord);\n"
|
" vec4 clouds = texture2D(transt, tccoord);\n"
|
||||||
|
|
||||||
" gl_FragColor.rgb = solid*(1-clouds.a) + clouds.rgb*clouds.a;\n"
|
" gl_FragColor.rgb = solid*(1-clouds.a) + clouds.rgb*clouds.a;\n"
|
||||||
|
// " gl_FragColor.rgb = solid+clouds.rgb;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
;
|
;
|
||||||
|
@ -253,7 +254,7 @@ void EmitWaterPolys (msurface_t *fa, float basealpha)
|
||||||
{
|
{
|
||||||
if (waterprogram)
|
if (waterprogram)
|
||||||
{
|
{
|
||||||
GL_DrawProgram_SkyChain(fa);
|
GL_DrawProgram_WaterChain(fa);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
r_waterlayers.value = 3;
|
r_waterlayers.value = 3;
|
||||||
|
@ -388,12 +389,13 @@ void GL_DrawSkyChain (msurface_t *s)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
R_IBrokeTheArrays();
|
||||||
|
qglDisable(GL_BLEND);
|
||||||
|
qglDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
if (r_fastsky.value>0) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
|
if (r_fastsky.value>0) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
|
||||||
{
|
{
|
||||||
R_IBrokeTheArrays();
|
|
||||||
qglDisable(GL_BLEND);
|
|
||||||
qglDisable(GL_TEXTURE_2D);
|
qglDisable(GL_TEXTURE_2D);
|
||||||
qglDisable(GL_ALPHA_TEST);
|
|
||||||
qglColor3f(glskycolor[0], glskycolor[1], glskycolor[2]);
|
qglColor3f(glskycolor[0], glskycolor[1], glskycolor[2]);
|
||||||
qglDisableClientState( GL_COLOR_ARRAY );
|
qglDisableClientState( GL_COLOR_ARRAY );
|
||||||
qglEnableClientState( GL_VERTEX_ARRAY );
|
qglEnableClientState( GL_VERTEX_ARRAY );
|
||||||
|
@ -408,34 +410,43 @@ void GL_DrawSkyChain (msurface_t *s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skyprogram && !usingskybox)
|
if (s->texinfo->texture->shader)
|
||||||
|
{
|
||||||
|
//this is the only pathway that actually uses shaders properly
|
||||||
|
GL_DrawSkySphere(s);
|
||||||
|
}
|
||||||
|
else if (skyprogram && !usingskybox)
|
||||||
{
|
{
|
||||||
GL_DrawProgram_SkyChain(s);
|
GL_DrawProgram_SkyChain(s);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_CalcSkyChainBounds(s);
|
|
||||||
|
|
||||||
#ifdef RGLQUAKE
|
|
||||||
if (usingskybox)
|
|
||||||
if (qrenderer == QR_OPENGL)
|
|
||||||
{
|
|
||||||
GL_DrawSkyBox (s);
|
|
||||||
GL_SkyForceDepth(s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (*r_fastsky.string)
|
|
||||||
{
|
|
||||||
GL_DrawSkyGrid(s->texinfo->texture);
|
|
||||||
GL_SkyForceDepth(s);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GL_DrawSkySphere(s);
|
R_CalcSkyChainBounds(s);
|
||||||
GL_SkyForceDepth(s);
|
|
||||||
|
#ifdef RGLQUAKE
|
||||||
|
if (usingskybox)
|
||||||
|
if (qrenderer == QR_OPENGL)
|
||||||
|
{
|
||||||
|
GL_DrawSkyBox (s);
|
||||||
|
GL_SkyForceDepth(s);
|
||||||
|
R_IBrokeTheArrays();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (*r_fastsky.string)
|
||||||
|
{
|
||||||
|
GL_DrawSkyGrid(s->texinfo->texture);
|
||||||
|
GL_SkyForceDepth(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL_DrawSkySphere(s);
|
||||||
|
GL_SkyForceDepth(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
R_IBrokeTheArrays();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1105,20 +1116,32 @@ static void GL_DrawProgram_SkyChain(msurface_t *fa)
|
||||||
vbo_t *v;
|
vbo_t *v;
|
||||||
mesh_t *m;
|
mesh_t *m;
|
||||||
|
|
||||||
|
|
||||||
v = &fa->texinfo->texture->vbo;
|
v = &fa->texinfo->texture->vbo;
|
||||||
qglUseProgramObjectARB(skyprogram);
|
qglUseProgramObjectARB(skyprogram);
|
||||||
qglUniform1fARB(skyprogram_time, cl.time);
|
qglUniform1fARB(skyprogram_time, r_refdef.time);
|
||||||
qglUniform3fvARB(skyprogram_eyepos, 1, r_origin);
|
qglUniform3fvARB(skyprogram_eyepos, 1, r_origin);
|
||||||
|
|
||||||
|
|
||||||
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
|
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
|
||||||
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
|
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
|
||||||
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
|
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
|
||||||
|
qglEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
|
if (fa->texinfo->texture->shader)
|
||||||
qglEnable(GL_TEXTURE_2D);
|
{
|
||||||
GL_MBind(mtexid1, fa->texinfo->texture->tn.fullbright);
|
GL_MBind(mtexid0, fa->texinfo->texture->shader->passes[0].anim_frames[0]);
|
||||||
qglEnable(GL_TEXTURE_2D);
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
GL_MBind(mtexid1, fa->texinfo->texture->shader->passes[1].anim_frames[0]);
|
||||||
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
|
||||||
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
GL_MBind(mtexid1, fa->texinfo->texture->tn.fullbright);
|
||||||
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
for (; fa; fa = fa->texturechain)
|
for (; fa; fa = fa->texturechain)
|
||||||
{
|
{
|
||||||
|
@ -1146,6 +1169,7 @@ static void GL_DrawProgram_WaterChain(msurface_t *fa)
|
||||||
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
|
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
|
||||||
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
|
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
|
||||||
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
|
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
|
||||||
|
qglEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
|
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
|
||||||
qglEnable(GL_TEXTURE_2D);
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
|
Loading…
Reference in a new issue