This commit is contained in:
Rachael Alexanderson 2017-07-01 13:12:25 -04:00
commit c3cc3637db
8 changed files with 46 additions and 32 deletions

View file

@ -156,6 +156,7 @@ static void I_DetectOS()
case 10: name = "OS X Yosemite"; break;
case 11: name = "OS X El Capitan"; break;
case 12: name = "macOS Sierra"; break;
case 13: name = "macOS High Sierra"; break;
}
char release[16] = "unknown";

View file

@ -942,7 +942,9 @@ void R_InitTranslationTables ()
IcePaletteRemap[i] = ColorMatcher.Pick (IcePalette[i][0], IcePalette[i][1], IcePalette[i][2]);
}
FRemapTable *remap = translationtables[TRANSLATION_Standard][7];
for (i = 0; i < 256; ++i)
remap->Remap[0] = 0;
remap->Palette[0] = 0;
for (i = 1; i < 256; ++i)
{
int r = GPalette.BaseColors[i].r;
int g = GPalette.BaseColors[i].g;
@ -955,7 +957,9 @@ void R_InitTranslationTables ()
// The alphatexture translation. Since alphatextures use the red channel this is just a standard grayscale mapping.
PushIdentityTable(TRANSLATION_Standard);
remap = translationtables[TRANSLATION_Standard][8];
for (i = 0; i < 256; i++)
remap->Remap[0] = 0;
remap->Palette[0] = 0;
for (i = 1; i < 256; i++)
{
remap->Remap[i] = i;
remap->Palette[i] = PalEntry(255, i, i, i);

View file

@ -3071,6 +3071,7 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx)
}
}
ValueType = left->ValueType;
break;
}
else if (right->IsVector() && left->IsNumeric())
{
@ -3085,8 +3086,9 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx)
}
}
ValueType = right->ValueType;
}
break;
}
// Incompatible operands, intentional fall-through
default:
// Vector modulus is not permitted

View file

@ -72,20 +72,6 @@
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
EXTERN_CVAR(Bool, r_drawvoxels);
namespace { double sprite_distance_cull = 1e16; }
CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
if (r_sprite_distance_cull > 0.0)
{
sprite_distance_cull = r_sprite_distance_cull * r_sprite_distance_cull;
}
else
{
sprite_distance_cull = 1e16;
}
}
namespace swrenderer
{
RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread)
@ -950,10 +936,6 @@ namespace swrenderer
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst))
return false;
double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared();
if (distanceSquared > sprite_distance_cull)
return false;
return true;
}

View file

@ -134,13 +134,42 @@ namespace swrenderer
void RenderTranslucentPass::DrawMaskedSingle(bool renew)
{
RenderPortal *renderportal = Thread->Portal.get();
DrawSegmentList *drawseglist = Thread->DrawSegments.get();
int numGroups = drawseglist->SegmentGroups.Size();
for (int j = 0; j < numGroups; j++)
drawseglist->SegmentGroups[j].GroupDrawn = false;
auto &sortedSprites = Thread->SpriteList->SortedSprites;
for (int i = sortedSprites.Size(); i > 0; i--)
{
if (sortedSprites[i - 1]->IsCurrentPortalUniq(renderportal->CurrentPortalUniq))
VisibleSprite *sprite = sortedSprites[i - 1];
// Draw the draw segments known to be behind us now.
for (int j = numGroups; j > 0; j--)
{
sortedSprites[i - 1]->Render(Thread);
auto &group = drawseglist->SegmentGroups[j - 1];
if (!group.GroupDrawn && group.neardepth > sprite->DrawSegDepth())
{
for (unsigned int index = group.BeginIndex; index != group.EndIndex; index++)
{
DrawSegment *ds = drawseglist->Segment(index);
if (ds->CurrentPortalUniq != renderportal->CurrentPortalUniq) continue;
if (ds->fake) continue;
if (ds->maskedtexturecol != nullptr || ds->bFogBoundary)
{
RenderDrawSegment renderer(Thread);
renderer.Render(ds, ds->x1, ds->x2);
}
}
group.GroupDrawn = true;
}
}
if (sprite->IsCurrentPortalUniq(renderportal->CurrentPortalUniq))
{
sprite->Render(Thread);
}
}
@ -151,7 +180,6 @@ namespace swrenderer
Thread->Clip3D->fake3D |= FAKE3D_REFRESHCLIP;
}
DrawSegmentList *drawseglist = Thread->DrawSegments.get();
for (unsigned int index = 0; index != drawseglist->SegmentsCount(); index++)
{
DrawSegment *ds = drawseglist->Segment(index);

View file

@ -63,6 +63,7 @@ namespace swrenderer
short *sprbottomclip;
unsigned int BeginIndex;
unsigned int EndIndex;
bool GroupDrawn;
};
class DrawSegmentList

View file

@ -296,7 +296,7 @@ namespace swrenderer
for (unsigned int groupIndex = 0; groupIndex < segmentlist->SegmentGroups.Size(); groupIndex++)
{
auto &group = segmentlist->SegmentGroups[groupIndex];
if (group.x1 >= x2 || group.x2 <= x1)
if (group.x1 >= x2 || group.x2 <= x1 || group.neardepth > spr->depth)
continue;
if (group.fardepth < spr->depth)
@ -335,11 +335,6 @@ namespace swrenderer
{
DrawSegment *ds = segmentlist->Segment(index);
// [ZZ] portal handling here
//if (ds->CurrentPortalUniq != spr->CurrentPortalUniq)
// continue;
// [ZZ] WARNING: uncommenting the two above lines, totally breaks sprite clipping
// kg3D - no clipping on fake segs
if (ds->fake) continue;
// determine if the drawseg obscures the sprite
@ -380,8 +375,7 @@ namespace swrenderer
RenderPortal *renderportal = thread->Portal.get();
// seg is behind sprite, so draw the mid texture if it has one
if (ds->CurrentPortalUniq == renderportal->CurrentPortalUniq && // [ZZ] instead, portal uniq check is made here
(ds->maskedtexturecol != nullptr || ds->bFogBoundary))
if (ds->CurrentPortalUniq == renderportal->CurrentPortalUniq && (ds->maskedtexturecol != nullptr || ds->bFogBoundary))
{
RenderDrawSegment renderer(thread);
renderer.Render(ds, r1, r2);

View file

@ -46,6 +46,8 @@ namespace swrenderer
double SortDist2D() const { return DVector2(deltax, deltay).LengthSquared(); }
float SortDist() const { return idepth; }
float DrawSegDepth() const { return depth; }
protected:
virtual bool IsParticle() const { return false; }
virtual bool IsVoxel() const { return false; }