mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- fixed radius use in dynamic light traversal for models.
This commit is contained in:
parent
a5d743cc3b
commit
ac9133eda0
5 changed files with 15 additions and 7 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue