clamp effect parameters values

This commit is contained in:
MihailRis 2026-02-12 22:04:25 +03:00
parent 92eeee5a20
commit a43f41182d
2 changed files with 67 additions and 9 deletions

View file

@ -141,8 +141,10 @@ void Decorator::updateAcoustics(const Camera& camera) {
averageDistance += distance;
averageAbsorption += material->soundAbsorption;
}
averageDistance /= hit;
averageAbsorption /= hit;
if (hit > 0) {
averageDistance /= hit;
averageAbsorption /= hit;
}
float decayTime = 20.0f * (averageDistance / rayLength);
float escapeRatio = static_cast<float>(rays - hit) / static_cast<float>(rays);