mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-29 15:12:11 +00:00
This commit is contained in:
commit
d8df255438
6 changed files with 37 additions and 10 deletions
|
@ -594,7 +594,6 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe
|
|||
for (unsigned i = 0; i < collected_ss.Size(); i++)
|
||||
{
|
||||
subSec = collected_ss[i].sub;
|
||||
auto &pos = collected_ss[i].pos;
|
||||
|
||||
touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors);
|
||||
if (subSec->sector->validcount != ::validcount)
|
||||
|
@ -603,9 +602,10 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe
|
|||
subSec->sector->validcount = ::validcount;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < subSec->numlines; i++)
|
||||
for (unsigned int j = 0; j < subSec->numlines; ++j)
|
||||
{
|
||||
seg_t * seg = subSec->firstline + i;
|
||||
auto &pos = collected_ss[i].pos;
|
||||
seg_t *seg = subSec->firstline + j;
|
||||
|
||||
// check distance from x/y to seg and if within radius add this seg and, if present the opposing subsector (lather/rinse/repeat)
|
||||
// If out of range we do not need to bother with this seg.
|
||||
|
|
|
@ -196,14 +196,30 @@ int gl_CalcLightLevel(int lightlevel, int rellight, bool weapon)
|
|||
|
||||
if ((glset.lightmode & 2) && lightlevel < 192 && !weapon)
|
||||
{
|
||||
light = xs_CRoundToInt(192.f - (192-lightlevel)* 1.95f);
|
||||
if (lightlevel > 100)
|
||||
{
|
||||
light = xs_CRoundToInt(192.f - (192 - lightlevel)* 1.87f);
|
||||
if (light + rellight < 20)
|
||||
{
|
||||
light = 20 + (light + rellight - 20) / 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
light += rellight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
light = (lightlevel + rellight) / 5;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
light=lightlevel;
|
||||
light=lightlevel+rellight;
|
||||
}
|
||||
|
||||
return clamp(light+rellight, 0, 255);
|
||||
return clamp(light, 0, 255);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -363,8 +363,12 @@ static inline void RenderThings(subsector_t * sub, sector_t * sector)
|
|||
SetupSprite.Clock();
|
||||
sector_t * sec=sub->sector;
|
||||
// Handle all things in sector.
|
||||
for (AActor * thing = sec->thinglist; thing; thing = thing->snext)
|
||||
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
|
||||
{
|
||||
auto thing = p->m_thing;
|
||||
if (thing->validcount == validcount) continue;
|
||||
thing->validcount = validcount;
|
||||
|
||||
FIntCVar *cvar = thing->GetClass()->distancecheck;
|
||||
if (cvar != NULL && *cvar >= 0)
|
||||
{
|
||||
|
@ -378,6 +382,7 @@ static inline void RenderThings(subsector_t * sub, sector_t * sector)
|
|||
|
||||
GLRenderer->ProcessSprite(thing, sector, false);
|
||||
}
|
||||
|
||||
for (msecnode_t *node = sec->render_thinglist; node; node = node->m_snext)
|
||||
{
|
||||
AActor *thing = node->m_thing;
|
||||
|
|
|
@ -91,6 +91,7 @@ extern bool r_showviewer;
|
|||
DWORD gl_fixedcolormap;
|
||||
area_t in_area;
|
||||
TArray<BYTE> currentmapsection;
|
||||
int camtexcount;
|
||||
|
||||
void gl_ParseDefs();
|
||||
|
||||
|
@ -1356,6 +1357,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
}
|
||||
|
||||
tex->SetUpdated();
|
||||
camtexcount++;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -207,22 +207,25 @@ void OpenGLFrameBuffer::Update()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
CVAR(Bool, gl_finishbeforeswap, false, 0);
|
||||
CVAR(Bool, gl_finishbeforeswap, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
extern int camtexcount;
|
||||
|
||||
void OpenGLFrameBuffer::Swap()
|
||||
{
|
||||
bool swapbefore = gl_finishbeforeswap && camtexcount == 0;
|
||||
Finish.Reset();
|
||||
Finish.Clock();
|
||||
if (gl_finishbeforeswap) glFinish();
|
||||
if (swapbefore) glFinish();
|
||||
if (needsetgamma)
|
||||
{
|
||||
//DoSetGamma();
|
||||
needsetgamma = false;
|
||||
}
|
||||
SwapBuffers();
|
||||
if (!gl_finishbeforeswap) glFinish();
|
||||
if (!swapbefore) glFinish();
|
||||
Finish.Unclock();
|
||||
swapped = true;
|
||||
camtexcount = 0;
|
||||
FHardwareTexture::UnbindAll();
|
||||
mDebug->Update();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ class DynamicLight : Actor native
|
|||
Height 0;
|
||||
Radius 0.1;
|
||||
FloatBobPhase 0;
|
||||
RenderRadius -1;
|
||||
+NOBLOCKMAP
|
||||
+NOGRAVITY
|
||||
+FIXMAPTHINGPOS
|
||||
|
|
Loading…
Reference in a new issue