18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 08:17:09 +01:00

fix(render): the lamps of small scenery models are seen from afar

This commit is contained in:
2026-11-30 18:48:43 +01:00
parent cabd53a01c
commit 269591fc35
14 changed files with 66 additions and 13 deletions
+13
View File
@@ -1843,6 +1843,17 @@ void assign_lod_ranges(TSubModel *Root, std::string const &Filename)
phase.submodel->fSquareMaxDist = farlimit * farlimit;
}
}
// whether the submodel, the submodels under it or the ones after it hold a light point seen from afar
bool has_light_points(TSubModel const *Submodel)
{
for (auto const *submodel = Submodel; submodel != nullptr; submodel = submodel->Next)
{
if (((submodel->eType == TP_FREESPOTLIGHT) && (false == submodel->bLightOnly)) || has_light_points(submodel->Child))
return true;
}
return false;
}
} // namespace
bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
@@ -1890,6 +1901,8 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
assign_lod_ranges(Root, name);
}
m_lightpoints = has_light_points(Root);
bool const result = Root ? iSubModelsCount > 0 : false; // brak pliku albo problem z wczytaniem
if (false == result)
{