未验证 提交 1a9481ba 编写于 作者: M Michael Herzog 提交者: GitHub

DataUtils: Clamp param of toHalfFloat(). (#22444)

* DataUtils: Clamp param of toHalfFloat().

* DataUtils: Add warning to toHalfFloat().
上级 a6f25bce
......@@ -7,6 +7,14 @@ class DataUtils {
static toHalfFloat( val ) {
if ( val > 65504 ) {
console.warn( 'THREE.DataUtils.toHalfFloat(): value exceeds 65504.' );
val = 65504; // maximum representable value in float16
}
// Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410
/* This method is faster than the OpenEXR implementation (very often
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册