mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Fix visibility in Polymer with r_usenewshading 4.
Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6558 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ae47d2f11d
commit
2f98d759f6
3 changed files with 10 additions and 5 deletions
|
@ -7941,7 +7941,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
case REND_POLYMOST:
|
case REND_POLYMOST:
|
||||||
// NOTE: In Polymost, the fragment depth depends on the x screen size!
|
// NOTE: In Polymost, the fragment depth depends on the x screen size!
|
||||||
if (r_usenewshading == 4)
|
if (r_usenewshading == 4)
|
||||||
globalvisibility = g_visibility;
|
globalvisibility = g_visibility * xdimen;
|
||||||
else if (r_usenewshading >= 2)
|
else if (r_usenewshading >= 2)
|
||||||
globalvisibility = scale(g_visibility<<2, xdimen, 1680);
|
globalvisibility = scale(g_visibility<<2, xdimen, 1680);
|
||||||
else
|
else
|
||||||
|
@ -7949,6 +7949,9 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
break;
|
break;
|
||||||
# ifdef POLYMER
|
# ifdef POLYMER
|
||||||
case REND_POLYMER:
|
case REND_POLYMER:
|
||||||
|
if (r_usenewshading == 4)
|
||||||
|
globalvisibility = g_visibility;
|
||||||
|
else
|
||||||
globalvisibility = g_visibility<<2;
|
globalvisibility = g_visibility<<2;
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
||||||
|
|
||||||
// fogcalc needs this
|
// fogcalc_old needs this
|
||||||
gvisibility = ((float)globalvisibility)*FOGSCALE;
|
gvisibility = ((float)globalvisibility)*FOGSCALE;
|
||||||
|
|
||||||
ang = (float)(daang) * (360.f/2048.f);
|
ang = (float)(daang) * (360.f/2048.f);
|
||||||
|
@ -5265,7 +5265,9 @@ static int32_t polymer_bindmaterial(const _prmaterial *material, int16_t* l
|
||||||
texunit++;
|
texunit++;
|
||||||
|
|
||||||
bglUniform1fARB(prprograms[programbits].uniform_shadeOffset, (GLfloat)material->shadeoffset);
|
bglUniform1fARB(prprograms[programbits].uniform_shadeOffset, (GLfloat)material->shadeoffset);
|
||||||
bglUniform1fARB(prprograms[programbits].uniform_visibility, globalvisibility/2048.0 * material->visibility);
|
// the furthest visible point is the same as Polymost, however the fog in Polymer is a sphere insted of a plane
|
||||||
|
float const visfactor = r_usenewshading == 4 ? 1.f/512.f : 1.f/2048.f;
|
||||||
|
bglUniform1fARB(prprograms[programbits].uniform_visibility, globalvisibility * visfactor * material->visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PR_BIT_DIFFUSE_MAP
|
// PR_BIT_DIFFUSE_MAP
|
||||||
|
|
|
@ -496,7 +496,7 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
||||||
|
|
||||||
if (((uint8_t)(vis + 16)) > 0 && g_visibility > 0)
|
if (((uint8_t)(vis + 16)) > 0 && g_visibility > 0)
|
||||||
{
|
{
|
||||||
GLfloat glfogconstant = 262144.f / xdimen;
|
GLfloat glfogconstant = 262144.f;
|
||||||
GLfloat fogrange = (frealmaxshade * glfogconstant) / (((uint8_t)(vis + 16)) * globalvisibility);
|
GLfloat fogrange = (frealmaxshade * glfogconstant) / (((uint8_t)(vis + 16)) * globalvisibility);
|
||||||
GLfloat normalizedshade = shade / frealmaxshade;
|
GLfloat normalizedshade = shade / frealmaxshade;
|
||||||
GLfloat fogshade = normalizedshade * fogrange;
|
GLfloat fogshade = normalizedshade * fogrange;
|
||||||
|
|
Loading…
Reference in a new issue