loom
1import "support.s-script" : s
2import "shuttle.s-script" type Shuttle
3
4def float :
5t = 0.0,
6tk = 0.0,
7dt = 0.0
8
9def int :
10iteration_step = 1
11
12def auto :
13objects = []
14
15def auto :
16callback = fn [] ()
17{
18}
19
20fn add (object : obj)
21{
22if obj["__equetions__"] == null && obj["__rights__"] == null
23print "*** scene.add : Объект не является моделью ode"
24else
25objects ++ obj
26}
27
28fn start ()
29{
30if tk == t {
31print "*** scene.start : Не задано значение tk"
32return
33}
34
35if dt == 0.0 {
36print "*** scene.start : Не задано значение dt"
37return
38}
39
40if iteration_step < 1
41iteration_step = 1
42
43def array.any(objects.size, Shuttle) : shuttles
44
45for int : i in Range(0,objects.size) {
46shuttles[i]["obj"] = & objects[i]
47make fiber shuttles[i]
48}
49
50def int :
51n = 0
52
53s.sendTimeToShellStatusBar(t)
54callback()
55
56while true {
57for int : i in Range(0,objects.size)
58flow fiber shuttles[i].stepper(t, dt, iteration_step)
59
60for int : i in Range(0,objects.size) {
61wait fiber shuttles[i]
62pull fiber shuttles[i]
63}
64
65s.sendTimeToShellStatusBar(t)
66callback()
67
68if t >= tk break
69
70for int : i in Range(0,objects.size)
71push fiber shuttles[i]
72
73n += iteration_step
74t = dt * n
75}
76}
77