Esempio n. 1
0
// inverse vp view transform. For ray casting... only one view
// inverse for now. Need better design if more are needed.
func ivp(at *lin.T, xrot, scr *lin.Q, vm *lin.M4) *lin.M4 {
	rot := scr.Inv(at.Rot)
	vm.SetQ(rot)
	return vm.TranslateMT(at.Loc.X, at.Loc.Y, at.Loc.Z)
}
Esempio n. 2
0
// VO orthographic projection transform.
func VO(pov *lin.T, scr *lin.Q, vm *lin.M4) *lin.M4 {
	return vm.Set(lin.M4I).ScaleMS(1, 1, 0)
}
Esempio n. 3
0
// XZ_XY perspective to ortho view transform.
// Can help transform a 3D map to a 2D overlay.
func XZ_XY(at *lin.T, scr *lin.Q, vm *lin.M4) *lin.M4 {
	rot := scr.SetAa(1, 0, 0, -lin.Rad(90))
	l := at.Loc
	return vm.SetQ(rot).ScaleMS(1, 1, 0).TranslateTM(-l.X, -l.Y, -l.Z)
}
Esempio n. 4
0
// VP perspective projection transform.
func VP(at *lin.T, scr *lin.Q, vm *lin.M4) *lin.M4 {
	vm.SetQ(at.Rot)
	return vm.TranslateTM(-at.Loc.X, -at.Loc.Y, -at.Loc.Z)
}