예제 #1
0
파일: matrix.go 프로젝트: pikkpoiss/twodee
func Unproject(invproj mgl32.Mat4, x float32, y float32) (wx, wy float32) {
	var (
		screen = mgl32.Vec4{x, y, 1, 1}
		out    mgl32.Vec4
	)
	out = invproj.Mul4x1(screen)
	out = out.Mul(1.0 / out[3])
	wx = out[0]
	wy = out[1]
	return
}
예제 #2
0
파일: matrix.go 프로젝트: pikkpoiss/twodee
func Project(proj mgl32.Mat4, x float32, y float32) (sx, sy float32) {
	var out mgl32.Vec4
	out = proj.Mul4x1(mgl32.Vec4{x, y, 1, 1})
	return out[0], out[1]
}