소스 검색

Changed the minimum value of a float when converting it to half float. It was 5.96046E-8f and it's now 3.054738E-5f. This values seems to be the lowest one before 0 when converting back half to float.
This issue has been revealed in this post https://hub.jmonkeyengine.org/t/pbr-nan-to-half-conversion-errors/37219
The bad minimum was causing erratic data being wrote to the texture when the value was very close to 0, and causing the glitches and even crashes when color values were given as Float.Infinity or Float.NaN.

Nehon 8 년 전
부모
커밋
1315af8d52
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      jme3-core/src/main/java/com/jme3/math/FastMath.java

+ 2 - 2
jme3-core/src/main/java/com/jme3/math/FastMath.java

@@ -981,9 +981,9 @@ final public class FastMath {
             return 0x7bff;
         } else if (flt < -65504f) {
             return (short) (0x7bff | 0x8000);
-        } else if (flt > 0f && flt < 5.96046E-8f) {
+        } else if (flt > 0f && flt < 3.054738E-5f) {
             return 0x0001;
-        } else if (flt < 0f && flt > -5.96046E-8f) {
+        } else if (flt < 0f && flt > -3.054738E-5f) {
             return (short) 0x8001;
         }