浏览代码

fix devide by zero in texture viewer when construct orientation matrix (#1825)

Kitchen 6 年之前
父节点
当前提交
4941a3d81c
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      tools/texturev/texturev.cpp

+ 1 - 1
tools/texturev/texturev.cpp

@@ -1095,7 +1095,7 @@ struct InterpolatorT
 			const double freq = double(bx::getHPFrequency() );
 			const double freq = double(bx::getHPFrequency() );
 			int64_t now = bx::getHPCounter();
 			int64_t now = bx::getHPCounter();
 			float time = (float)(double(now - offset) / freq);
 			float time = (float)(double(now - offset) / freq);
-			float lerp = bx::clamp(time, 0.0f, duration) / duration;
+			float lerp = duration != 0 ? bx::clamp(time, 0.0f, duration) / duration : 0.0f;
 			return lerpT(from, to, easeT(lerp) );
 			return lerpT(from, to, easeT(lerp) );
 		}
 		}