~holger-seelig/titania-library/trunk

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#VRML V2.0 utf8 Titania V0.7.3

PROTO RotorTimeSensor [
  exposedField SFTime  cycleInterval 1
  exposedField SFBool  loop FALSE
  eventOut     SFFloat fraction_changed
]
{
  TimeSensor {
    cycleInterval IS cycleInterval
    loop IS loop
    fraction_changed IS fraction_changed
  }
}

PROTO Rotor [
  exposedField SFTime     cycleInterval 1
  exposedField SFBool     loop FALSE
  eventOut     SFRotation value_changed
]
{
  PROTO RotorOrientationInterpolator [
    eventIn      SFFloat    set_fraction
    exposedField MFFloat    key [ ]
    exposedField MFRotation keyValue [ ]
    eventOut     SFRotation value_changed
  ]
  {
    OrientationInterpolator {
      set_fraction IS set_fraction
      key IS key
      keyValue IS keyValue
      value_changed IS value_changed
    }
  }

  DEF Timer RotorTimeSensor {
    cycleInterval IS cycleInterval
    loop IS loop
  }

  DEF Rotator RotorOrientationInterpolator {
    key [ 0, 0.25, 0.5, 0.75, 1 ]
    keyValue [ 0 0 1 0, 0 0 1 1.5708, 0 0 1 3.14159, 0 0 1 4.71239, 0 0 1 0 ]
    value_changed IS value_changed
  }

  ROUTE Timer.fraction_changed TO Rotator.set_fraction
}