Avoid crashing if broken LOD level

It doesn't matter now because we have auto LOD computing
This commit is contained in:
Benau 2021-03-29 11:22:37 +08:00
parent 0889362f27
commit a738fa66e3

View File

@ -230,9 +230,8 @@ void LODNode::add(int level, scene::ISceneNode* node, bool reparent)
// I'm not convinced (Auria) but he's the artist pro, so I listen ;P
// The last level should not be randomized because after that the object disappears,
// and the location is disapparition needs to be deterministic
if (m_detail.size() > 0)
if (m_detail.size() > 0 && m_detail.back() < level * level)
{
assert(m_detail.back()<level*level);
m_detail[m_detail.size() - 1] += (int)(((rand()%1000)-500)/500.0f*(m_detail[m_detail.size() - 1]*0.2f));
}