diff --git a/src/actor.h b/src/actor.h index 5d1a4b99a9..2bc8802847 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1269,6 +1269,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; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index a9cd383557..cb21be2e35 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -495,7 +495,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, §or_t::touching_thinglist); // Attach to thing - if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, MAX(radius, renderradius), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings); + if (renderradius >= 0) touching_rendersectors = P_CreateSecNodeList(this, RenderRadius(), ctx != nullptr ? ctx->render_list : nullptr, §or_t::touching_renderthings); else { touching_rendersectors = nullptr; diff --git a/src/rendering/hwrenderer/scene/hw_spritelight.cpp b/src/rendering/hwrenderer/scene/hw_spritelight.cpp index 028c2f03dc..a8bc1f849d 100644 --- a/src/rendering/hwrenderer/scene/hw_spritelight.cpp +++ b/src/rendering/hwrenderer/scene/hw_spritelight.cpp @@ -157,7 +157,8 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata) float x = (float)self->X(); float y = (float)self->Y(); float z = (float)self->Center(); - float radiusSquared = (float)(self->renderradius * self->renderradius); + float actorradius = (float)self->RenderRadius(); + float radiusSquared = actorradius * actorradius; dl_validcount++; BSPWalkCircle(self->Level, x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor @@ -172,7 +173,7 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata) { int group = subsector->sector->PortalGroup; DVector3 pos = light->PosRelative(group); - float radius = (float)(light->GetRadius() + self->renderradius); + float radius = (float)(light->GetRadius() + actorradius); double dx = pos.X - x; double dy = pos.Y - y; double dz = pos.Z - z; diff --git a/src/rendering/polyrenderer/scene/poly_model.cpp b/src/rendering/polyrenderer/scene/poly_model.cpp index a0c544ab8b..43fd55d485 100644 --- a/src/rendering/polyrenderer/scene/poly_model.cpp +++ b/src/rendering/polyrenderer/scene/poly_model.cpp @@ -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(actor->Level, 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; diff --git a/src/rendering/swrenderer/things/r_model.cpp b/src/rendering/swrenderer/things/r_model.cpp index 93901fbf11..824b4be90b 100644 --- a/src/rendering/swrenderer/things/r_model.cpp +++ b/src/rendering/swrenderer/things/r_model.cpp @@ -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(actor->Level, 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;