mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Fix npot sky rendering in Polymost
Patch from Nuke.YKT. git-svn-id: https://svn.eduke32.com/eduke32@8076 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymost.cpp
This commit is contained in:
parent
d0a49c3278
commit
c17db80734
1 changed files with 34 additions and 22 deletions
|
@ -3982,8 +3982,6 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
|
|||
flatskyrender = 0;
|
||||
vec2f_t xys[8];
|
||||
|
||||
polymost_setClamp(2);
|
||||
|
||||
// Transform polygon to sky coordinates
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
|
@ -4028,6 +4026,11 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
|
|||
if (xys[i].x > x1) x1 = xys[i].x;
|
||||
}
|
||||
|
||||
int const npot = (1<<(picsiz[globalpicnum]&15)) != tilesiz[globalpicnum].x;
|
||||
int const xpanning = (r_parallaxskypanning?global_cf_xpanning:0);
|
||||
|
||||
polymost_setClamp((npot || xpanning != 0) ? 0 : 2);
|
||||
|
||||
int picnumbak = globalpicnum;
|
||||
ti = globalpicnum;
|
||||
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
|
||||
|
@ -4038,7 +4041,14 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
|
|||
do
|
||||
{
|
||||
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+ti;
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?global_cf_xpanning:0)) - xtex.u*ghalfx;
|
||||
if (npot)
|
||||
{
|
||||
fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
int tang = (y<<(11-dapskybits))&2047;
|
||||
otex.u = otex.d*(t*((float)(tang)) * (1.f/2048.f) + xpanning) - xtex.u*fx;
|
||||
}
|
||||
else
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + xpanning) - xtex.u*ghalfx;
|
||||
y++;
|
||||
o.x = fx; fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
|
||||
|
@ -4321,6 +4331,7 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
skyclamphack = 0;
|
||||
flatskyrender = 1;
|
||||
globalshade += globvis2*xdimscale*fviewingrange*(1.f / (64.f * 65536.f * 256.f * 1024.f));
|
||||
polymost_setVisibility(0.f);
|
||||
polymost_domost(x0,fy0,x1,fy1);
|
||||
flatskyrender = 0;
|
||||
}
|
||||
|
@ -4389,6 +4400,7 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->floorypanning*(float)i*(1.f/256.f) : vv[0];
|
||||
|
||||
int const npot = (1<<(picsiz[globalpicnum]&15)) != tilesiz[globalpicnum].x;
|
||||
int const xpanning = (r_parallaxskypanning?sec->floorxpanning:0);
|
||||
|
||||
i = globalpicnum;
|
||||
float const r = (fy1-fy0)/(x1-x0); //slope of line
|
||||
|
@ -4399,15 +4411,14 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
do
|
||||
{
|
||||
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
|
||||
if (!npot)
|
||||
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->floorxpanning:0)) - xtex.u*ghalfx;
|
||||
else
|
||||
if (npot)
|
||||
{
|
||||
int32_t picbits = picsiz[globalpicnum]&15;
|
||||
int32_t np2 = tilesiz[globalpicnum].x != (1<<picbits);
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(np2 ? 0 : (y<<(11-dapskybits))))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->floorxpanning:0)) - xtex.u*ghalfx;
|
||||
fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
int tang = (y<<(11-dapskybits))&2047;
|
||||
otex.u = otex.d*(t*((float)(tang)) * (1.f/2048.f) + xpanning) - xtex.u*fx;
|
||||
}
|
||||
else
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + xpanning) - xtex.u*ghalfx;
|
||||
y++;
|
||||
o.x = fx; fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
if (fx > x1) { fx = x1; i = -1; }
|
||||
|
@ -4747,6 +4758,7 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
|
||||
|
||||
int const npot = (1<<(picsiz[globalpicnum]&15)) != tilesiz[globalpicnum].x;
|
||||
int const xpanning = (r_parallaxskypanning?sec->ceilingxpanning:0);
|
||||
|
||||
i = globalpicnum;
|
||||
float const r = (cy1-cy0)/(x1-x0); //slope of line
|
||||
|
@ -4757,14 +4769,14 @@ static void polymost_drawalls(int32_t const bunch)
|
|||
do
|
||||
{
|
||||
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
|
||||
if (!npot)
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - xtex.u*ghalfx;
|
||||
else
|
||||
if (npot)
|
||||
{
|
||||
int32_t picbits = picsiz[globalpicnum]&15;
|
||||
int32_t np2 = tilesiz[globalpicnum].x != (1<<picbits);
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(np2 ? 0 : (y<<(11-dapskybits))))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - xtex.u*ghalfx;
|
||||
fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
int tang = (y<<(11-dapskybits))&2047;
|
||||
otex.u = otex.d*(t*((float)(tang)) * (1.f/2048.f) + xpanning) - xtex.u*fx;
|
||||
}
|
||||
else
|
||||
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + xpanning) - xtex.u*ghalfx;
|
||||
y++;
|
||||
o.x = fx; fx = (((float) (y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
|
||||
if (fx > x1) { fx = x1; i = -1; }
|
||||
|
|
Loading…
Reference in a new issue