mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 17:11:24 +00:00
- fix software renderer dynamic lights not working properly in mirrors
(cherry picked from commit f5386a706f
)
This commit is contained in:
parent
d0ff0bcaf2
commit
f70715e25a
2 changed files with 15 additions and 2 deletions
|
@ -189,7 +189,12 @@ namespace swrenderer
|
|||
{
|
||||
auto viewport = Thread->Viewport.get();
|
||||
|
||||
drawerargs.dc_viewpos.X = (float)((x + 0.5 - viewport->CenterX) / viewport->CenterX * zcol);
|
||||
int tx = x;
|
||||
bool mirror = !!(Thread->Portal->MirrorFlags & RF_XFLIP);
|
||||
if (mirror)
|
||||
tx = viewwidth - tx - 1;
|
||||
|
||||
drawerargs.dc_viewpos.X = (float)((tx + 0.5 - viewport->CenterX) / viewport->CenterX * zcol);
|
||||
drawerargs.dc_viewpos.Y = zcol;
|
||||
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y1 - 0.5) / viewport->InvZtoScale * zcol);
|
||||
drawerargs.dc_viewpos_step.Z = (float)(-zcol / viewport->InvZtoScale);
|
||||
|
|
|
@ -205,13 +205,21 @@ namespace swrenderer
|
|||
|
||||
if (r_dynlights)
|
||||
{
|
||||
int tx = x1;
|
||||
bool mirror = !!(Thread->Portal->MirrorFlags & RF_XFLIP);
|
||||
if (mirror)
|
||||
tx = viewwidth - tx - 1;
|
||||
|
||||
// Find row position in view space
|
||||
float zspan = (float)(planeheight / (fabs(y + 0.5 - viewport->CenterY) / viewport->InvZtoScale));
|
||||
drawerargs.dc_viewpos.X = (float)((x1 + 0.5 - viewport->CenterX) / viewport->CenterX * zspan);
|
||||
drawerargs.dc_viewpos.X = (float)((tx + 0.5 - viewport->CenterX) / viewport->CenterX * zspan);
|
||||
drawerargs.dc_viewpos.Y = zspan;
|
||||
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y - 0.5) / viewport->InvZtoScale * zspan);
|
||||
drawerargs.dc_viewpos_step.X = (float)(zspan / viewport->CenterX);
|
||||
|
||||
if (mirror)
|
||||
drawerargs.dc_viewpos_step.X = -drawerargs.dc_viewpos_step.X;
|
||||
|
||||
// Plane normal
|
||||
drawerargs.dc_normal.X = 0.0f;
|
||||
drawerargs.dc_normal.Y = 0.0f;
|
||||
|
|
Loading…
Reference in a new issue