File: boxlighttest.py

package info (click to toggle)
python-visual 1%3A5.12-1.6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 7,708 kB
  • ctags: 7,635
  • sloc: cpp: 15,593; sh: 9,615; ansic: 6,631; python: 4,737; makefile: 384
file content (33 lines) | stat: -rw-r--r-- 990 bytes parent folder | download | duplicates (3)
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
32
33
from visual import *

# Mikhail Temkine, University of Toronto, April 2007

print """
Box lighting test
"""

r = 3
a1 = a2 = a3 = 0.0

arrow(pos=(0, 4, 0), axis=(0, 1, 0), color=color.red)
boxy = box(size=(3,3,3), color=(0.5, 0.5, 0.5), material=materials.rough)
b1 = sphere(radius=0.3, pos=(r, 0, 0),
            color=color.magenta, material=materials.emissive)
b2 = sphere(radius=0.3, pos=(0, 0, r),
            color=color.yellow, material=materials.emissive)
b3 = arrow(radius=0.3, pos=(0, 0, r),
            color=color.green, material=materials.emissive)
l1 = local_light(pos=b1.pos, color=b1.color)
l2 = local_light(pos=b2.pos, color=b2.color)
l3 = distant_light(direction=b3.pos, color=b3.color)

while 1:
    rate(100)
    l1.pos = b1.pos = r*vector(cos(a1), sin(a1), b1.z)
    a1 += 0.02
    l2.pos = b2.pos = (r+0.4)*vector(b2.x, sin(a2), cos(a2))
    a2 += 0.055
    l3.direction = b3.pos = (r+3)*vector(sin(a3), b3.y, cos(a3))
    b3.axis = b3.pos * -0.3
    a3 += 0.033