Initial checkin - Alex
[terminatorX.git] / knob / render_all
1 #!/usr/bin/python
2
3 import os, sys
4
5 def render(i, mask):
6         angle = 280.0*float(i)/49.0+40.0-180.0
7         
8         inf = open('tX_knob.pov')
9         outf = open('tmp.pov', 'w')
10         for line in inf:
11                 out = line.replace('ROT_ANGLE','%lf' % angle)
12                 
13                 if mask:
14                         out = out.replace('BACKGROUND','Black')
15                         out = out.replace('MASKOPTION','no_shadow')
16                 else:
17                         out = out.replace('BACKGROUND','Blue')
18                         out = out.replace('MASKOPTION','')
19                 
20                 outf.write(out)
21                 
22         outf.close()
23         inf.close()
24         
25         os.system('/usr/local/share/povray-3.6/scripts/render_scene.sh tmp.pov')
26         if mask:
27                 m = '-mask'
28         else:
29                 m = ''
30                 
31         os.rename('tmp.png', 'knob%0i%s.png' % (49-i,m))
32         os.unlink('tmp.pov')
33
34
35 if len(sys.argv)>1:
36         img = []
37         for image in sys.argv[1:]:
38                 img.append(int(image))
39 else:
40         img = xrange(0,50)
41         
42 print img       
43
44 for i in img:
45         render(i, False)
46         render(i, True)
47