feat(engine): add number clamping functions
This commit is contained in:
parent
402192742b
commit
c25022bc37
1 changed files with 9 additions and 0 deletions
9
engine/core/num_clamp.go
Normal file
9
engine/core/num_clamp.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue