示例#1
0
func (a *Box) UpdateWorld(prg *simplex.Program) {
	prg.For(&a.l, &a.r, &a.b, &a.t, &a.z)
	a.world.Identity()
	a.world.Translate(&a.world, float32(a.l.Val), float32(a.b.Val), 0)
	a.world.Scale(&a.world, float32(a.r.Val-a.l.Val), float32(a.t.Val-a.b.Val), 1)
	a.world[2][3] = float32(a.z.Val)
}
示例#2
0
func NewBox(prg *simplex.Program) (a Box) {
	a.l, a.r, a.b, a.t, a.z = prg.Var(1), prg.Var(1), prg.Var(1), prg.Var(1), prg.Var(1)
	return
}