Ejemplo n.º 1
0
func render(frch chan<- animate.Frame, fact animate.RenderFactory, pkt core.SimPacket) {
	rend, rerr := fact.Build(pkt, nil)
	if rerr != nil {
		fatal(rerr)
	}

	go func() {
		for _, fr := range rend.Render() {
			frch <- fr
		}
		close(frch)
	}()
}
Ejemplo n.º 2
0
func main() {
	count := uint(30)
	width := uint(1920)
	height := uint(1080)
	flag.UintVar(&count, "framecnt", count, "Frames generated per simulation packet")
	flag.UintVar(&width, "width", width, "Width of output surface")
	flag.UintVar(&height, "height", height, "Height of output surface")
	flag.Parse()

	yard := ext.StdExtensions()
	shapes := animate.StdShapes
	groups := animate.StdGroupFacts

	fact := animate.RenderFactory{}
	fact.Width = width
	fact.Height = height
	fact.Yard = yard
	fact.Framecnt = count
	fact.EntShapes = shapes
	fact.EntGroups = groups
	frtun := runFrameTunnel(fact)

	for frch := range frtun {
		for fr := range frch {
			werr := animate.WriteFrame(fr, os.Stdout)
			if werr != nil {
				fmt.Fprintf(os.Stderr, "Warning: %v", werr)
			}
		}
	}
}