paint: fix pack_f32_i16

This commit is contained in:
luboslenco
2026-09-01 10:27:13 +02:00
parent 0eba925481
commit 47f132c84d
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ fun pack_f32_i16(f: float, i: uint): float {
// const t1: float = ((prec / maxi) - 1.0) / prec_minus_one;
// const t2: float = (prec / maxi) / prec_minus_one;
// return t1 * f + t2 * float(i);
return 0.062504762 * min(f, 0.9999) + 0.062519999 * float(i);
return 0.062485207147583624 * min(f, 0.9990234375) + 0.062500476102698687 * float(i);
}
fun mesh_posnor_frag(input: vert_out): float4[3] {
+1 -1
View File
@@ -63,7 +63,7 @@ fun pack_f32_i16(f: float, i: uint): float {
// const t1: float = ((prec / maxi) - 1.0) / prec_minus_one;
// const t2: float = (prec / maxi) / prec_minus_one;
// return t1 * f + t2 * float(i);
return 0.062504762 * min(f, 0.9999) + 0.062519999 * float(i);
return 0.062485207147583624 * min(f, 0.9990234375) + 0.062500476102698687 * float(i);
}
fun mesh_posnortex_frag(input: vert_out): float4[3] {
+1 -1
View File
@@ -432,7 +432,7 @@ fun octahedron_wrap(v: float2): float2 { \
char *str_pack_float_int16 = "\
fun pack_f32_i16(f: float, i: uint): float { \
return 0.062504762 * min(f, 0.9999) + 0.062519999 * float(i); \
return 0.062485207147583624 * min(f, 0.9990234375) + 0.062500476102698687 * float(i); \
} \
";