- fixed radius use in dynamic light traversal for models.

# Conflicts:
#	src/hwrenderer/scene/hw_spritelight.cpp

# Conflicts:
#	src/gl/scene/gl_spritelight.cpp
This commit is contained in:
Christoph Oelckers 2019-04-19 08:23:08 +02:00 committed by drfrag
parent 411169bc46
commit 18bf8d65ba
5 changed files with 18 additions and 10 deletions

View file

@ -1331,6 +1331,11 @@ public:
return fabs(Z() - checkz) < EQUAL_EPSILON;
}
double RenderRadius() const
{
return MAX(radius, renderradius);
}
DVector3 PosRelative(int grp) const;
DVector3 PosRelative(const AActor *other) const;
DVector3 PosRelative(sector_t *sec) const;

View file

@ -180,10 +180,11 @@ int gl_SetDynModelLight(AActor *self, int dynlightindex)
addedLights.clear();
float x = self->X();
float y = self->Y();
float z = self->Center();
float radiusSquared = self->renderradius * self->renderradius;
float x = (float)self->X();
float y = (float)self->Y();
float z = (float)self->Center();
float actorradius = (float)self->RenderRadius();
float radiusSquared = actorradius * actorradius;
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
@ -195,7 +196,7 @@ int gl_SetDynModelLight(AActor *self, int dynlightindex)
{
int group = subsector->sector->PortalGroup;
DVector3 pos = light->PosRelative(group);
float radius = light->GetRadius() + self->renderradius;
float radius = light->GetRadius() + actorradius;
double dx = pos.X - x;
double dy = pos.Y - y;
double dz = pos.Z - z;

View file

@ -498,7 +498,7 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
// at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created.
touching_sectorlist = P_CreateSecNodeList(this, radius, ctx != nullptr? ctx->sector_list : nullptr, &sector_t::touching_thinglist); // Attach to thing
if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, &sector_t::touching_renderthings);
if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, RenderRadius(), ctx != nullptr ? ctx->render_list : nullptr, &sector_t::touching_renderthings);
else
{
touching_rendersectors = nullptr;

View file

@ -120,7 +120,8 @@ void PolyModelRenderer::AddLights(AActor *actor)
float x = (float)actor->X();
float y = (float)actor->Y();
float z = (float)actor->Center();
float radiusSquared = (float)(actor->renderradius * actor->renderradius);
float actorradius = (float)actor->RenderRadius();
float radiusSquared = actorradius * actorradius;
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
@ -132,7 +133,7 @@ void PolyModelRenderer::AddLights(AActor *actor)
{
int group = subsector->sector->PortalGroup;
DVector3 pos = light->PosRelative(group);
float radius = (float)(light->GetRadius() + actor->renderradius);
float radius = (float)(light->GetRadius() + actorradius);
double dx = pos.X - x;
double dy = pos.Y - y;
double dz = pos.Z - z;

View file

@ -161,7 +161,8 @@ namespace swrenderer
float x = (float)actor->X();
float y = (float)actor->Y();
float z = (float)actor->Center();
float radiusSquared = (float)(actor->renderradius * actor->renderradius);
float actorradius = (float)actor->RenderRadius();
float radiusSquared = actorradius * actorradius;
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
@ -173,7 +174,7 @@ namespace swrenderer
{
int group = subsector->sector->PortalGroup;
DVector3 pos = light->PosRelative(group);
float radius = (float)(light->GetRadius() + actor->renderradius);
float radius = (float)(light->GetRadius() + actorradius);
double dx = pos.X - x;
double dy = pos.Y - y;
double dz = pos.Z - z;