Merge branch '4.14.2' into gz_merge
This commit is contained in:
commit
9aa44fa13b
83 changed files with 927 additions and 270 deletions
|
|
@ -96,7 +96,7 @@ void AddLightToList(FDynLightData &dld, int group, FDynamicLight * light, bool f
|
|||
cs = 1.0f;
|
||||
}
|
||||
|
||||
if (light->target)
|
||||
if (light->target && (light->target->renderflags2 & RF2_LIGHTMULTALPHA))
|
||||
cs *= (float)light->target->Alpha;
|
||||
|
||||
info.r = light->GetRed() / 255.0f * cs;
|
||||
|
|
|
|||
|
|
@ -288,19 +288,25 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip, FRenderState& state)
|
|||
angle_t startAngle = clipper.GetClipAngle(seg->v2);
|
||||
angle_t endAngle = clipper.GetClipAngle(seg->v1);
|
||||
auto &clipperr = *rClipper;
|
||||
angle_t startAngleR = clipperr.PointToPseudoAngle(seg->v2->fX(), seg->v2->fY());
|
||||
angle_t endAngleR = clipperr.PointToPseudoAngle(seg->v1->fX(), seg->v1->fY());
|
||||
angle_t startAngleR = 0;
|
||||
angle_t endAngleR = 0;
|
||||
angle_t paddingR = 0x00200000; // Make radar clipping more aggressive (reveal less)
|
||||
|
||||
if(Viewpoint.IsAllowedOoB() && r_radarclipper && !(Level->flags3 & LEVEL3_NOFOGOFWAR) && (startAngleR - endAngleR >= ANGLE_180))
|
||||
if(Viewpoint.IsAllowedOoB() && r_radarclipper && !(Level->flags3 & LEVEL3_NOFOGOFWAR))
|
||||
{
|
||||
if (!seg->backsector) clipperr.SafeAddClipRange(startAngleR - paddingR, endAngleR + paddingR);
|
||||
else if((seg->sidedef != nullptr) && !uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ) && (currentsector->sectornum != seg->backsector->sectornum))
|
||||
startAngleR = clipperr.PointToPseudoAngle(seg->v2->fX(), seg->v2->fY());
|
||||
endAngleR = clipperr.PointToPseudoAngle(seg->v1->fX(), seg->v1->fY());
|
||||
|
||||
if (startAngleR - endAngleR >= ANGLE_180)
|
||||
{
|
||||
if (in_area == area_default) in_area = hw_CheckViewArea(seg->v1, seg->v2, seg->frontsector, seg->backsector);
|
||||
backsector = hw_FakeFlat(drawctx, seg->backsector, in_area, true);
|
||||
if (hw_CheckClip(seg->sidedef, currentsector, backsector)) clipperr.SafeAddClipRange(startAngleR - paddingR, endAngleR + paddingR);
|
||||
backsector = nullptr;
|
||||
if (!seg->backsector) clipperr.SafeAddClipRange(startAngleR - paddingR, endAngleR + paddingR);
|
||||
else if((seg->sidedef != nullptr) && !uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ) && (currentsector->sectornum != seg->backsector->sectornum))
|
||||
{
|
||||
if (in_area == area_default) in_area = hw_CheckViewArea(seg->v1, seg->v2, seg->frontsector, seg->backsector);
|
||||
backsector = hw_FakeFlat(drawctx, seg->backsector, in_area, true);
|
||||
if (hw_CheckClip(seg->sidedef, currentsector, backsector)) clipperr.SafeAddClipRange(startAngleR - paddingR, endAngleR + paddingR);
|
||||
backsector = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -711,7 +717,7 @@ void HWDrawInfo::DoSubsector(subsector_t * sub, FRenderState& state)
|
|||
if(Viewpoint.IsAllowedOoB() && sector->isSecret() && sector->wasSecret() && !r_radarclipper) return;
|
||||
|
||||
// cull everything if subsector outside all relevant clippers
|
||||
if ((sub->polys == nullptr))
|
||||
if (Viewpoint.IsAllowedOoB() && (sub->polys == nullptr))
|
||||
{
|
||||
auto &clipper = *mClipper;
|
||||
auto &clipperv = *vClipper;
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ void HWDrawInfo::ClearBuffers()
|
|||
void HWDrawInfo::UpdateCurrentMapSection()
|
||||
{
|
||||
int mapsection = Level->PointInRenderSubsector(Viewpoint.Pos)->mapsection;
|
||||
if (Viewpoint.IsAllowedOoB())
|
||||
mapsection = Level->PointInRenderSubsector(Viewpoint.camera->Pos())->mapsection;
|
||||
if (Viewpoint.IsAllowedOoB() || Viewpoint.IsOrtho())
|
||||
mapsection = Level->PointInRenderSubsector(Viewpoint.OffPos)->mapsection;
|
||||
CurrentMapSections.Set(mapsection);
|
||||
}
|
||||
|
||||
|
|
@ -319,20 +319,19 @@ int HWDrawInfo::SetFullbrightFlags(player_t *player)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
angle_t HWDrawInfo::FrustumAngle()
|
||||
angle_t OoBFrustumAngle(FRenderViewpoint* Viewpoint)
|
||||
{
|
||||
// If pitch is larger than this you can look all around at an FOV of 90 degrees
|
||||
if (fabs(Viewpoint.HWAngles.Pitch.Degrees()) > 89.0) return 0xffffffff;
|
||||
else if (fabs(Viewpoint.HWAngles.Pitch.Degrees()) > 46.0 && !Viewpoint.IsAllowedOoB()) return 0xffffffff; // Just like 4.12.2 and older did
|
||||
if (fabs(Viewpoint->HWAngles.Pitch.Degrees()) > 89.0) return 0xffffffff;
|
||||
int aspMult = AspectMultiplier(r_viewwindow.WidescreenRatio); // 48 == square window
|
||||
double absPitch = fabs(Viewpoint.HWAngles.Pitch.Degrees());
|
||||
double absPitch = fabs(Viewpoint->HWAngles.Pitch.Degrees());
|
||||
// Smaller aspect ratios still clip too much. Need a better solution
|
||||
if (aspMult > 36 && absPitch > 30.0) return 0xffffffff;
|
||||
else if (aspMult > 40 && absPitch > 25.0) return 0xffffffff;
|
||||
else if (aspMult > 45 && absPitch > 20.0) return 0xffffffff;
|
||||
else if (aspMult > 47 && absPitch > 10.0) return 0xffffffff;
|
||||
|
||||
double xratio = r_viewwindow.FocalTangent / Viewpoint.PitchCos;
|
||||
double xratio = r_viewwindow.FocalTangent / Viewpoint->PitchCos;
|
||||
double floatangle = 0.05 + atan ( xratio ) * 48.0 / aspMult; // this is radians
|
||||
angle_t a1 = DAngle::fromRad(floatangle).BAMs();
|
||||
|
||||
|
|
@ -340,6 +339,28 @@ angle_t HWDrawInfo::FrustumAngle()
|
|||
return a1;
|
||||
}
|
||||
|
||||
angle_t HWDrawInfo::FrustumAngle()
|
||||
{
|
||||
if (Viewpoint.IsAllowedOoB())
|
||||
{
|
||||
return OoBFrustumAngle(&Viewpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
float tilt = fabs(Viewpoint.HWAngles.Pitch.Degrees());
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90°
|
||||
if (tilt > 46.0f) return 0xffffffff;
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*Viewpoint.FieldOfView.Degrees() * 48.0 / AspectMultiplier(r_viewwindow.WidescreenRatio) / 90.0;
|
||||
angle_t a1 = DAngle::fromDeg(floatangle).BAMs();
|
||||
if (a1 >= ANGLE_180) return 0xffffffff;
|
||||
return a1;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Setup the modelview matrix
|
||||
|
|
@ -425,7 +446,9 @@ void HWDrawInfo::CreateScene(bool drawpsprites, FRenderState& state)
|
|||
{
|
||||
double a2 = 20.0 + 0.5*Viewpoint.FieldOfView.Degrees(); // FrustumPitch for vertical clipping
|
||||
if (a2 > 179.0) a2 = 179.0;
|
||||
vClipper->SafeAddClipRangeDegPitches(vp.HWAngles.Pitch.Degrees() - a2, vp.HWAngles.Pitch.Degrees() + a2); // clip the suplex range
|
||||
double pitchmult = !!(portalState.PlaneMirrorFlag & 1) ? -1.0 : 1.0;
|
||||
vClipper->SafeAddClipRangeDegPitches(pitchmult * vp.HWAngles.Pitch.Degrees() - a2, pitchmult * vp.HWAngles.Pitch.Degrees() + a2); // clip the suplex range
|
||||
Viewpoint.PitchSin *= pitchmult;
|
||||
}
|
||||
|
||||
// reset the portal manager
|
||||
|
|
@ -1292,8 +1315,8 @@ void HWDrawInfo::ProcessScene(bool toscreen, FRenderState& state)
|
|||
drawctx->portalState.BeginScene();
|
||||
|
||||
int mapsection = Level->PointInRenderSubsector(Viewpoint.Pos)->mapsection;
|
||||
if (Viewpoint.IsAllowedOoB())
|
||||
mapsection = Level->PointInRenderSubsector(Viewpoint.camera->Pos())->mapsection;
|
||||
if (Viewpoint.IsAllowedOoB() || Viewpoint.IsOrtho())
|
||||
mapsection = Level->PointInRenderSubsector(Viewpoint.OffPos)->mapsection;
|
||||
CurrentMapSections.Set(mapsection);
|
||||
DrawScene(toscreen ? DM_MAINVIEW : DM_OFFSCREEN, state);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "texturemanager.h"
|
||||
#include "hw_flatdispatcher.h"
|
||||
#include "hw_viewpointbuffer.h"
|
||||
|
||||
EXTERN_CVAR(Bool, lm_dynlights);
|
||||
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ void HWPortal::RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestenci
|
|||
bool needdepth = NeedDepthBuffer();
|
||||
|
||||
// Restore the old view
|
||||
|
||||
auto &vp = di->Viewpoint;
|
||||
if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ void HWWall::SkyPlane(HWWallDispatcher *di, FRenderState& state, sector_t *secto
|
|||
if (glport != NULL)
|
||||
{
|
||||
if (sector->PortalBlocksView(plane)) return;
|
||||
|
||||
if (di->di && screen->instack[1 - plane]) return;
|
||||
ptype = PORTALTYPE_SECTORSTACK;
|
||||
portal = glport;
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ void HWDrawInfo::GetDynSpriteLight(AActor *self, sun_trace_cache_t * traceCache,
|
|||
lg = light->GetGreen() / 255.0f;
|
||||
lb = light->GetBlue() / 255.0f;
|
||||
|
||||
if (light->target)
|
||||
if (light->target && (light->target->renderflags2 & RF2_LIGHTMULTALPHA))
|
||||
{
|
||||
float alpha = (float)light->target->Alpha;
|
||||
lr *= alpha;
|
||||
|
|
|
|||
|
|
@ -1494,7 +1494,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, FRenderState& state, particle_t *
|
|||
if (!particle || particle->alpha <= 0)
|
||||
return;
|
||||
|
||||
if (spr && spr->PT.texture.isNull())
|
||||
if (spr && !spr->ValidTexture())
|
||||
return;
|
||||
|
||||
lightlevel = hw_ClampLight(spr ? spr->GetLightLevel(sector) : sector->GetSpriteLight());
|
||||
|
|
@ -1563,17 +1563,29 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, FRenderState& state, particle_t *
|
|||
if (paused || (di->Level->isFrozen() && !(particle->flags & SPF_NOTIMEFREEZE)))
|
||||
timefrac = 0.;
|
||||
|
||||
if (spr)
|
||||
|
||||
if (spr && !(spr->flags & VTF_IsParticle))
|
||||
{
|
||||
AdjustVisualThinker(di, spr, sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool has_texture = particle->texture.isValid();
|
||||
bool custom_animated_texture = (particle->flags & SPF_LOCAL_ANIM) && particle->animData.ok;
|
||||
|
||||
int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles
|
||||
|
||||
bool has_texture = false;
|
||||
bool custom_animated_texture = false;
|
||||
int particle_style = 0;
|
||||
float size = particle->size;
|
||||
if (!spr)
|
||||
{
|
||||
has_texture = particle->texture.isValid();
|
||||
custom_animated_texture = (particle->flags & SPF_LOCAL_ANIM) && particle->animData.ok;
|
||||
particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles
|
||||
}
|
||||
else
|
||||
{
|
||||
size = float(spr->Scale.X);
|
||||
const int ptype = spr->GetParticleType();
|
||||
particle_style = (ptype != PT_DEFAULT) ? ptype : gl_particles_style;
|
||||
}
|
||||
// [BB] Load the texture for round or smooth particles
|
||||
if (particle_style)
|
||||
{
|
||||
|
|
@ -1635,7 +1647,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, FRenderState& state, particle_t *
|
|||
if (particle_style == 1) factor = 1.3f / 7.f;
|
||||
else if (particle_style == 2) factor = 2.5f / 7.f;
|
||||
else factor = 1 / 7.f;
|
||||
float scalefac=particle->size * factor;
|
||||
float scalefac= size * factor;
|
||||
|
||||
float ps = di->Level->pixelstretch;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue