forked from pi3d/pi3d_demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pi3d2.py
31 lines (28 loc) · 782 Bytes
/
Pi3d2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
from __future__ import absolute_import, division, print_function, unicode_literals
""" Peter Hess' converted shader for pi3d dynamic texturing """
import demo
import pi3d
DISPLAY = pi3d.Display.create(x=50, y=50, frames_per_second=30)
shader = pi3d.Shader("star")
tex = pi3d.Texture("textures/PATRN.PNG")
box = pi3d.Cuboid(x=0, y=0, z=2.2)
box.set_draw_details(shader,[tex])
tm = 0.0
dt = 0.01
sc = 0.0
ds = 0.001
mykeys = pi3d.Keyboard()
while DISPLAY.loop_running():
box.set_custom_data(48, [tm, sc, -0.5 * sc])
"""Three custom unif values used by star shader to animate image
"""
tm += dt
sc = (sc + ds) % 10.0
box.rotateIncX(0.01)
box.rotateIncY(0.071)
box.draw()
if mykeys.read() == 27:
mykeys.close()
DISPLAY.destroy()
break