root / trunk / pysoy / examples / vid_billboard.py

Revision 1387, 0.9 kB (checked in by ArcRiley, 4 weeks ago)

Quick fix: updated for new material API

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3import soy
4from time import sleep
5
6sce = soy.scenes.Scene()
7cam = soy.bodies.Camera(sce)
8cam.position = (0.0, 0.0, 10.0)
9lig = soy.bodies.Light(sce)
10lig.position = (-10.0,10.0,2.0)
11fps = soy.textures.Print()
12ogg = soy.transports.File('media/changeworld.ogg')
13vid = ogg['video']
14mat = soy.materials.Textured()
15mat.colormap = vid
16bil = soy.models.Billboard(mat)
17bil.size = (4.0,3.0)
18bod = soy.bodies.Body(sce)
19bod.model = bil
20bod.rotation = (1.0,0.4,0.2)
21
22scr = soy.Screen()
23win = soy.Window(scr, 'Video Billboard')
24pro = soy.widgets.Projector(win, camera=cam)
25can = soy.widgets.Canvas(win, texture=fps)
26
27key = soy.controllers.Keyboard(win)
28key['q'] = soy.actions.Quit()
29key[ 1 ] = soy.actions.Quit() # 9 = esc key
30wcn = soy.controllers.Window(win)
31wcn['close'] = soy.actions.Quit()
32
33if __name__ == '__main__' :
34  while True:
35    sleep(0.3)
36    fps.text = str(cam.fps)
Note: See TracBrowser for help on using the browser.