mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
16 lines
384 B
Go
16 lines
384 B
Go
package graphics
|
|
|
|
func OrthoProjectionMatrix(left, right, bottom, top int) [4][4]float64 {
|
|
e11 := float64(2) / float64(right-left)
|
|
e22 := float64(2) / float64(top-bottom)
|
|
e14 := -1 * float64(right+left) / float64(right-left)
|
|
e24 := -1 * float64(top+bottom) / float64(top-bottom)
|
|
|
|
return [4][4]float64{
|
|
{e11, 0, 0, e14},
|
|
{0, e22, 0, e24},
|
|
{0, 0, 1, 0},
|
|
{0, 0, 0, 1},
|
|
}
|
|
}
|