~jtaylor/ubuntu/oneiric/soya/fix-780305

« back to all changes in this revision

Viewing changes to c_src/python/test.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Dequènes (Duck)
  • Date: 2005-01-30 09:55:06 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050130095506-f21p6v6cgaobhn5j
Tags: 0.9.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import soya.model
2
 
import soya.soya3d
3
 
 
4
 
import _soya
5
 
 
6
 
import pickle
7
 
import random
8
 
 
9
 
import soya.editor
10
 
import Tkinter
11
 
 
12
 
import gc
13
 
 
14
 
# TEST MORPH
15
 
 
16
 
 
17
 
w = soya.soya3d.World ()
18
 
 
19
 
## for i in xrange(5):
20
 
##   soya.model.Face (w, [soya.model.Vertex(w, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, - random.random() * 10.0),
21
 
##                        soya.model.Vertex(w, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, - random.random() * 10.0),
22
 
##                        soya.model.Vertex(w, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, - random.random() * 10.0)])
23
 
 
24
 
 
25
 
 
26
 
w2 = soya.soya3d.World (w)
27
 
 
28
 
soya.model.Material.PATH = "/home/jiba/python/slune/materials"
29
 
mat1 = soya.model.Material.get("grass1")
30
 
mat2 = soya.model.Material.get("bloc1")
31
 
 
32
 
##     f  = soya.model.Face (w, [soya.model.Vertex(w, 0.0, 0.0, 0.0),
33
 
##                               soya.model.Vertex(w, 1.0, 0.0, 0.0),
34
 
##                               soya.model.Vertex(w, 0.0, 1.0, 0.0)
35
 
##                               ], mat1)
36
 
##     f.double_sided = 1
37
 
##     f.smoothlit = 1
38
 
    
39
 
co = 0
40
 
while (co < 50):
41
 
    f  = soya.model.Face (w, [soya.model.Vertex(w,  random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0),
42
 
                              soya.model.Vertex(w2, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0),
43
 
                              soya.model.Vertex(w,  random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0)
44
 
                              ], mat1)
45
 
    f.double_sided = 1
46
 
    f.smoothlit = 1
47
 
    co = co + 1
48
 
 
49
 
while (co < 100):
50
 
    f  = soya.model.Face (w, [soya.model.Vertex(w,  random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0),
51
 
                              soya.model.Vertex(w2, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0),
52
 
                              soya.model.Vertex(w,  random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0, random.random() * 10.0 - 5.0)
53
 
                              ], mat2)
54
 
    f.double_sided = 1
55
 
    f.smoothlit = 1
56
 
    co = co + 1
57
 
 
58
 
    
59
 
f  = soya.model.Face (w, [soya.model.Vertex(w, 10.0, 0.0, 0.0),
60
 
                          soya.model.Vertex(w, 11.0, 0.0, 0.0),
61
 
                          soya.model.Vertex(w, 10.0, 1.0, 0.0)
62
 
                          ], mat2)
63
 
f.double_sided = 1
64
 
f.smoothlit = 1
65
 
 
66
 
 
67
 
## f  = soya.model.Face (w, [soya.model.Vertex(w, 0.0, 0.0, 0.0),
68
 
##                           soya.model.Vertex(w, 1.0, 0.0, 0.0),
69
 
##                           soya.model.Vertex(w, 0.0, 1.0, 0.0)
70
 
##                           ], mat1)
71
 
## f2 = soya.model.Face (w, [soya.model.Vertex(w,  0.0, 0.0, 0.0),
72
 
##                           soya.model.Vertex(w2, 0.0, 0.0, 1.0),
73
 
##                           soya.model.Vertex(w,  1.0, 0.0, 0.0)
74
 
##                           ], mat1)
75
 
## f.double_sided = 1
76
 
## f2.double_sided = 1
77
 
 
78
 
## f.smoothlit = 1
79
 
## f2.smoothlit = 1
80
 
 
81
 
 
82
 
print "will now convert to morph..."
83
 
m = w._to_morph()
84
 
 
85
 
 
86
 
while(len(w.children) > 0):
87
 
  w.remove(w.children[0])
88
 
 
89
 
#w.remove(f)
90
 
#w.remove(f2)
91
 
 
92
 
 
93
 
 
94
 
i = soya.soya3d.Morph(w, m)
95
 
 
96
 
 
97
 
## a = _soya._AnimCoordsys()
98
 
## w.anim = a
99
 
 
100
 
## a.add(w,1.0)
101
 
## w.set_xyz(0.0,10.0,0.0)
102
 
## a.add(w,2.0)
103
 
## w.set_xyz(5.0,10.0,0.0)
104
 
## a.add(w,4.0)
105
 
## w.set_xyz(0.0,0.0,0.0)
106
 
## a.cyclic_lap = 4.0
107
 
 
108
 
#print m.__getstate__()
109
 
 
110
 
#print 'ok'
111
 
 
112
 
soya.editor.edit(w)
113
 
Tkinter.mainloop()
114
 
 
115
 
 
116
 
#c = soya.soya3d.Camera(w)
117
 
#soya.init()
118
 
#while(1):
119
 
#  c.render()
120
 
#  soya.display()
121
 
  
122