mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-03-24 02:22:02 +00:00
Merge branch 'master' of https://github.com/raa-eruanna/qzdoom-gpl
This commit is contained in:
commit
cea6091c88
3 changed files with 25 additions and 12 deletions
|
@ -1076,7 +1076,7 @@ void OpenGLSWFrameBuffer::CalcFullscreenCoords(FBVERTEX verts[4], bool viewarea_
|
|||
|
||||
int OpenGLSWFrameBuffer::GetPageCount()
|
||||
{
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -209,19 +209,27 @@ namespace swrenderer
|
|||
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y - 0.5) / viewport->InvZtoScale * zspan);
|
||||
drawerargs.dc_viewpos_step.X = (float)(zspan / viewport->CenterX);
|
||||
|
||||
static DrawerLight lightbuffer[64 * 1024];
|
||||
static int nextlightindex = 0;
|
||||
|
||||
// Plane normal
|
||||
drawerargs.dc_normal.X = 0.0f;
|
||||
drawerargs.dc_normal.Y = 0.0f;
|
||||
drawerargs.dc_normal.Z = (y >= viewport->CenterY) ? 1.0f : -1.0f;
|
||||
|
||||
// Setup lights for row
|
||||
drawerargs.dc_num_lights = 0;
|
||||
drawerargs.dc_lights = lightbuffer + nextlightindex;
|
||||
// Calculate max lights that can touch the row so we can allocate memory for the list
|
||||
int max_lights = 0;
|
||||
VisiblePlaneLight *cur_node = light_list;
|
||||
while (cur_node && nextlightindex < 64 * 1024)
|
||||
while (cur_node)
|
||||
{
|
||||
if (!(cur_node->lightsource->flags2&MF2_DORMANT))
|
||||
max_lights++;
|
||||
cur_node = cur_node->next;
|
||||
}
|
||||
|
||||
drawerargs.dc_num_lights = 0;
|
||||
drawerargs.dc_lights = Thread->FrameMemory->AllocMemory<DrawerLight>(max_lights);
|
||||
|
||||
// Setup lights for row
|
||||
cur_node = light_list;
|
||||
while (cur_node)
|
||||
{
|
||||
double lightX = cur_node->lightsource->X() - ViewPos.X;
|
||||
double lightY = cur_node->lightsource->Y() - ViewPos.Y;
|
||||
|
@ -244,7 +252,6 @@ namespace swrenderer
|
|||
uint32_t green = cur_node->lightsource->GetGreen();
|
||||
uint32_t blue = cur_node->lightsource->GetBlue();
|
||||
|
||||
nextlightindex++;
|
||||
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
|
||||
light.x = lx;
|
||||
light.y = lconstant;
|
||||
|
@ -255,9 +262,6 @@ namespace swrenderer
|
|||
|
||||
cur_node = cur_node->next;
|
||||
}
|
||||
|
||||
if (nextlightindex == 64 * 1024)
|
||||
nextlightindex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -110,6 +110,13 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
|
|||
double centeryback = viewport->CenterY;
|
||||
viewport->CenterY = 0;
|
||||
|
||||
int oldviewwindowx = 0;
|
||||
int oldviewwindowy = 0;
|
||||
oldviewwindowx = viewwindowx;
|
||||
oldviewwindowy = viewwindowy;
|
||||
viewwindowx = 0;
|
||||
viewwindowy = 0;
|
||||
|
||||
// There is not enough precision in the drawing routines to keep the full
|
||||
// precision for y0. :(
|
||||
double sprtopscreen;
|
||||
|
@ -187,6 +194,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
|
|||
}
|
||||
|
||||
viewport->CenterY = centeryback;
|
||||
viewwindowx = oldviewwindowx;
|
||||
viewwindowy = oldviewwindowy;
|
||||
}
|
||||
|
||||
viewport->RenderTarget->Unlock();
|
||||
|
|
Loading…
Reference in a new issue