2016-11-24 08:13:05 -06:00
|
|
|
package pixel
|
|
|
|
|
2017-01-12 04:44:54 -06:00
|
|
|
import "github.com/go-gl/mathgl/mgl32"
|
|
|
|
|
2016-12-23 13:25:47 -06:00
|
|
|
func clamp(x, low, high float64) float64 {
|
|
|
|
if x < low {
|
|
|
|
return low
|
|
|
|
}
|
|
|
|
if x > high {
|
|
|
|
return high
|
|
|
|
}
|
|
|
|
return x
|
2016-11-24 08:13:05 -06:00
|
|
|
}
|
2017-01-12 04:44:54 -06:00
|
|
|
|
|
|
|
func transformToMat(t ...Transform) mgl32.Mat3 {
|
|
|
|
mat := mgl32.Ident3()
|
|
|
|
for i := range t {
|
|
|
|
mat = mat.Mul3(t[i].Mat())
|
|
|
|
}
|
|
|
|
return mat
|
|
|
|
}
|