示例#1
0
func (c *Camera) project(pt mgl32.Vec2) mgl32.Vec2 {
	var (
		screen = pt.Vec4(1, 1)
		out    mgl32.Vec4
	)
	out = c.Projection.Mul4x1(screen)
	return out.Vec2()
}
示例#2
0
func (c *Camera) unproject(pt mgl32.Vec2) mgl32.Vec2 {
	var (
		screen = pt.Vec4(1, 1)
		out    mgl32.Vec4
	)
	out = c.Inverse.Mul4x1(screen)
	out = out.Mul(1.0 / out[3])
	return out.Vec2()
}