Clamp LODscale. If the object is drawn at zero we produce an Inf value which will produce Nans with later calculations.

This commit is contained in:
Ian Curtis 2023-12-29 13:28:10 +00:00
parent 0e07f29f80
commit 75260f9f2c

View file

@ -738,6 +738,8 @@ void CNew3D::DescendCullingNode(UINT32 addr)
float LODscale = m_nodeAttribs.currentDisableCulling ? std::numeric_limits<float>::max() : (fBlendRadius / std::hypot(x, y, z)); float LODscale = m_nodeAttribs.currentDisableCulling ? std::numeric_limits<float>::max() : (fBlendRadius / std::hypot(x, y, z));
const LOD *lod = m_LODBlendTable->table[lodTablePointer].lod; const LOD *lod = m_LODBlendTable->table[lodTablePointer].lod;
LODscale = std::clamp(LODscale, 0.0f, std::numeric_limits<float>::max());
if (m_nodeAttribs.currentDisableCulling || (!outsideFrustum && LODscale >= lod[3].deleteSize)) { if (m_nodeAttribs.currentDisableCulling || (!outsideFrustum && LODscale >= lod[3].deleteSize)) {
// Descend down first link // Descend down first link