1
0
Fork 0

feat(engine): add number clamping functions

This commit is contained in:
Henrik Hautakoski 2025-10-27 20:19:22 +01:00
parent 6cf0e4abb4
commit 7d5d5b9a54

9
engine/core/num_clamp.go Normal file
View file

@ -0,0 +1,9 @@
package core
func ByteToClampedFloat32(v byte) float32 {
return min(float32(v)/255.0, 1.0)
}
func ClampedFloat32ToByte(v float32) byte {
return byte(min(v, 1.0) * 255)
}