Merge ../qzdoom

This commit is contained in:
Rachael Alexanderson 2017-03-10 12:07:55 -05:00
commit 65d67b704c
5 changed files with 30 additions and 17 deletions

View file

@ -1076,7 +1076,7 @@ void OpenGLSWFrameBuffer::CalcFullscreenCoords(FBVERTEX verts[4], bool viewarea_
int OpenGLSWFrameBuffer::GetPageCount() int OpenGLSWFrameBuffer::GetPageCount()
{ {
return 1; return 2;
} }
//========================================================================== //==========================================================================

View file

@ -955,7 +955,7 @@ DEFINE_ACTION_FUNCTION(DBlockLinesIterator, CreateFromPos)
ACTION_RETURN_OBJECT(new DBlockLinesIterator(x, y, z, h, radius, sec)); ACTION_RETURN_OBJECT(new DBlockLinesIterator(x, y, z, h, radius, sec));
} }
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Next) DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Next)
{ {
PARAM_SELF_PROLOGUE(DBlockLinesIterator); PARAM_SELF_PROLOGUE(DBlockLinesIterator);
ACTION_RETURN_BOOL(self->Next()); ACTION_RETURN_BOOL(self->Next());
@ -1294,9 +1294,9 @@ DEFINE_ACTION_FUNCTION(DBlockThingsIterator, CreateFromPos)
ACTION_RETURN_OBJECT(new DBlockThingsIterator(x, y, z, h, radius, ignore, nullptr)); ACTION_RETURN_OBJECT(new DBlockThingsIterator(x, y, z, h, radius, ignore, nullptr));
} }
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Next) DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Next)
{ {
PARAM_SELF_PROLOGUE(DBlockLinesIterator); PARAM_SELF_PROLOGUE(DBlockThingsIterator);
ACTION_RETURN_BOOL(self->Next()); ACTION_RETURN_BOOL(self->Next());
} }

View file

@ -735,7 +735,7 @@ bool SightCheck::P_SightPathTraverse ()
// step through map blocks // step through map blocks
// Count is present to prevent a round off error from skipping the break // Count is present to prevent a round off error from skipping the break
int itres; int itres = -1;
for (count = 0 ; count < 1000 ; count++) for (count = 0 ; count < 1000 ; count++)
{ {
// end traversing when reaching the end of the blockmap // end traversing when reaching the end of the blockmap

View file

@ -69,7 +69,7 @@ namespace swrenderer
{ {
double cosine = cos(planeang), sine = sin(planeang); double cosine = cos(planeang), sine = sin(planeang);
pviewx = pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine; pviewx = pl->xform.xOffs + ViewPos.X * cosine - ViewPos.Y * sine;
pviewy = pl->xform.yOffs - ViewPos.X * sine - ViewPos.Y * cosine; pviewy = pl->xform.yOffs + pl->xform.baseyOffs - ViewPos.X * sine - ViewPos.Y * cosine;
} }
else else
{ {
@ -209,19 +209,27 @@ namespace swrenderer
drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y - 0.5) / viewport->InvZtoScale * zspan); drawerargs.dc_viewpos.Z = (float)((viewport->CenterY - y - 0.5) / viewport->InvZtoScale * zspan);
drawerargs.dc_viewpos_step.X = (float)(zspan / viewport->CenterX); drawerargs.dc_viewpos_step.X = (float)(zspan / viewport->CenterX);
static DrawerLight lightbuffer[64 * 1024];
static int nextlightindex = 0;
// Plane normal // Plane normal
drawerargs.dc_normal.X = 0.0f; drawerargs.dc_normal.X = 0.0f;
drawerargs.dc_normal.Y = 0.0f; drawerargs.dc_normal.Y = 0.0f;
drawerargs.dc_normal.Z = (y >= viewport->CenterY) ? 1.0f : -1.0f; drawerargs.dc_normal.Z = (y >= viewport->CenterY) ? 1.0f : -1.0f;
// Setup lights for row // Calculate max lights that can touch the row so we can allocate memory for the list
drawerargs.dc_num_lights = 0; int max_lights = 0;
drawerargs.dc_lights = lightbuffer + nextlightindex;
VisiblePlaneLight *cur_node = light_list; 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 lightX = cur_node->lightsource->X() - ViewPos.X;
double lightY = cur_node->lightsource->Y() - ViewPos.Y; double lightY = cur_node->lightsource->Y() - ViewPos.Y;
@ -244,7 +252,6 @@ namespace swrenderer
uint32_t green = cur_node->lightsource->GetGreen(); uint32_t green = cur_node->lightsource->GetGreen();
uint32_t blue = cur_node->lightsource->GetBlue(); uint32_t blue = cur_node->lightsource->GetBlue();
nextlightindex++;
auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++]; auto &light = drawerargs.dc_lights[drawerargs.dc_num_lights++];
light.x = lx; light.x = lx;
light.y = lconstant; light.y = lconstant;
@ -255,9 +262,6 @@ namespace swrenderer
cur_node = cur_node->next; cur_node = cur_node->next;
} }
if (nextlightindex == 64 * 1024)
nextlightindex = 0;
} }
else else
{ {

View file

@ -110,6 +110,13 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
double centeryback = viewport->CenterY; double centeryback = viewport->CenterY;
viewport->CenterY = 0; 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 // There is not enough precision in the drawing routines to keep the full
// precision for y0. :( // precision for y0. :(
double sprtopscreen; double sprtopscreen;
@ -187,6 +194,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
} }
viewport->CenterY = centeryback; viewport->CenterY = centeryback;
viewwindowx = oldviewwindowx;
viewwindowy = oldviewwindowy;
} }
viewport->RenderTarget->Unlock(); viewport->RenderTarget->Unlock();