Check for 0 value before doing log2

This commit is contained in:
Fernando García Liñán 2020-11-17 12:34:03 +01:00
parent 79b858d6d8
commit 42ee05fd0e

View File

@ -222,7 +222,8 @@ Compositor::update(const osg::Matrix &view_matrix,
u->set(osg::Vec3f(-zFar, -zFar * zNear, zFar - zNear));
break;
case FCOEF:
u->set(2.0f / log2(float(zFar) + 1.0f));
if (zFar != 0.0)
u->set(2.0f / log2(float(zFar) + 1.0f));
break;
default:
// Unknown uniform