home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch11 / train / train.wrl < prev    next >
Text File  |  1997-03-31  |  15KB  |  510 lines

  1. #VRML V2.0 utf8
  2.  
  3. WorldInfo {
  4.   info    [ "Created in CosmoWorlds",
  5.         "Packaged by CosmoPackage" ]
  6. }
  7. DEF navInfo NavigationInfo {
  8.   avatarSize    [ 5, 10, 5 ]
  9.   headlight    FALSE
  10.   type    "FLY"
  11. }
  12. Background {
  13.   skyColor    0.38 0.63 0.75
  14. }
  15. DEF entryView Viewpoint {
  16.   position    -319.9 56.03 2026
  17.   orientation    -0.9742 0.2183 -0.05749  0.1296
  18.   fieldOfView    0.7854
  19.   description    "entry"
  20. }
  21. DEF trainGroup Transform {
  22.   children    [
  23.     DEF echoTimer TimeSensor {
  24.       cycleInterval    0.5
  25.       loop    FALSE
  26.       startTime    0
  27.     }
  28.     DEF fadeTimer TimeSensor {
  29.       cycleInterval    0.5
  30.       loop    FALSE
  31.       startTime    0
  32.     }
  33.     Group {
  34.       children    [
  35.     DEF trainLoop Group {
  36.       children    DEF trainTimer TimeSensor {
  37.         cycleInterval    24
  38.         loop    TRUE
  39.         startTime    0
  40.         stopTime    1
  41.       }
  42.  
  43.     }
  44.     DEF trainGroupTranslationInterp PositionInterpolator {
  45.       key    [ 0, 0.008333, 0.01667, 0.025,
  46.             0.03333, 0.04167, 0.05, 0.05833,
  47.             0.06667, 0.07639, 0.08611, 0.09583,
  48.             0.1056, 0.1153, 0.125, 0.1333,
  49.             0.1417, 0.15, 0.1583, 0.1667,
  50.             0.175, 0.1833, 0.1917, 0.2014,
  51.             0.2111, 0.2208, 0.2306, 0.2403,
  52.             0.25, 0.2583, 0.2667, 0.275,
  53.             0.2833, 0.2917, 0.3, 0.3083,
  54.             0.3167, 0.3264, 0.3361, 0.3458,
  55.             0.3556, 0.3653, 0.375, 0.3833,
  56.             0.3917, 0.4, 0.4083, 0.4167,
  57.             0.425, 0.4333, 0.4417, 0.4514,
  58.             0.4611, 0.4708, 0.4806, 0.4903,
  59.             0.5, 0.5083, 0.5167, 0.525,
  60.             0.5333, 0.5417, 0.55, 0.5583,
  61.             0.5667, 0.5764, 0.5861, 0.5958,
  62.             0.6056, 0.6153, 0.625, 0.6333,
  63.             0.6417, 0.65, 0.6583, 0.6667,
  64.             0.675, 0.6833, 0.6917, 0.7014,
  65.             0.7111, 0.7208, 0.7306, 0.7403,
  66.             0.75, 0.7583, 0.7667, 0.775,
  67.             0.7833, 0.7917, 0.8, 0.8083,
  68.             0.8167, 0.825, 0.8333, 0.8417,
  69.             0.85, 0.8583, 0.8667, 0.875,
  70.             0.8833, 0.8917, 0.9, 0.9083,
  71.             0.9167, 0.925, 0.9333, 0.9417,
  72.             0.9514, 0.9611, 0.9708, 0.9806,
  73.             0.9903, 1 ]
  74.       keyValue    [ 37.8 9.155e-05 52.79,
  75.             53.99 -0.1981 60.23,
  76.             69.6 -0.3814 67.85,
  77.             84.96 -0.5588 75.54,
  78.             100.4 -0.7391 83.19,
  79.             116.4 -0.9313 90.7,
  80.             133.2 -1.144 97.95,
  81.             151.2 -1.387 104.8,
  82.             170.7 -1.668 111.3,
  83.             196.4 -2.106 118.7,
  84.             225 -2.66 126.1,
  85.             255.3 -3.257 133,
  86.             286 -3.821 138.9,
  87.             316 -4.278 143,
  88.             343.8 -4.554 145,
  89.             366.2 -4.763 144.8,
  90.             388.2 -5.058 143.3,
  91.             409.8 -5.352 140.7,
  92.             430.9 -5.556 137.2,
  93.             451.5 -5.583 133.1,
  94.             471.5 -5.345 128.6,
  95.             490.8 -4.756 123.9,
  96.             509.4 -3.727 119.2,
  97.             530.3 -1.768 113.7,
  98.             550.1 0.9606 107.8,
  99.             568.9 4.211 101.3,
  100.             586.5 7.737 93.92,
  101.             602.9 11.29 85.39,
  102.             618 14.62 75.45,
  103.             629.8 17.28 66.11,
  104.             640.7 19.88 56.37,
  105.             650.9 22.47 46.09,
  106.             660.4 25.09 35.11,
  107.             669.4 27.78 23.29,
  108.             678 30.58 10.45,
  109.             686.4 33.52 -3.533,
  110.             694.8 36.65 -18.83,
  111.             704.8 40.75 -39.35,
  112.             714.9 45.35 -62.83,
  113.             724.5 50.16 -88.18,
  114.             732.8 54.91 -114.3,
  115.             739.3 59.32 -140.2,
  116.             743.2 63.1 -164.6,
  117.             744.6 65.9 -184.6,
  118.             744.8 68.48 -204.4,
  119.             743.9 70.85 -224,
  120.             742 73.04 -243.5,
  121.             739.1 75.06 -262.8,
  122.             735.3 76.92 -281.9,
  123.             730.7 78.62 -300.8,
  124.             725.3 80.2 -319.5,
  125.             717.8 81.72 -341.3,
  126.             708.5 82.86 -363.3,
  127.             697.8 83.72 -384.9,
  128.             685.6 84.41 -405.8,
  129.             672.1 85.05 -425.4,
  130.             657.4 85.74 -443.4,
  131.             644.1 86.37 -457.8,
  132.             630.1 86.96 -471.8,
  133.             615.4 87.5 -485.1,
  134.             599.9 88.03 -497.8,
  135.             583.7 88.53 -509.6,
  136.             566.7 89.01 -520.3,
  137.             548.9 89.5 -529.9,
  138.             530.2 89.98 -538.2,
  139.             506.4 90.64 -545.8,
  140.             480.1 91.39 -551.1,
  141.             452.5 92.12 -554.5,
  142.             424.4 92.72 -556.4,
  143.             396.8 93.08 -557.2,
  144.             370.8 93.09 -557.4,
  145.             349.7 92.82 -557.2,
  146.             328.8 92.39 -556.4,
  147.             308.2 91.81 -555.1,
  148.             288 91.1 -553.1,
  149.             268.1 90.28 -550.5,
  150.             248.5 89.36 -547.2,
  151.             229.3 88.35 -543.1,
  152.             210.6 87.28 -538.3,
  153.             188.7 85.96 -532,
  154.             166.8 84.53 -525.1,
  155.             145.5 82.93 -516.9,
  156.             125.5 81.11 -506.8,
  157.             107.6 79.01 -494.1,
  158.             92.33 76.59 -478.3,
  159.             80.68 74.32 -462.8,
  160.             69.22 71.96 -446.6,
  161.             57.99 69.54 -429.6,
  162.             47.02 67.05 -412.1,
  163.             36.33 64.5 -394.1,
  164.             25.97 61.92 -375.7,
  165.             15.96 59.29 -357,
  166.             6.335 56.65 -338.1,
  167.             -2.875 53.99 -319,
  168.             -11.64 51.32 -299.8,
  169.             -19.92 48.65 -280.7,
  170.             -27.69 46 -261.7,
  171.             -34.92 43.37 -242.9,
  172.             -41.57 40.77 -224.4,
  173.             -47.61 38.21 -206.2,
  174.             -52.28 35.69 -188.4,
  175.             -54.93 33.2 -170.8,
  176.             -55.77 30.73 -153.2,
  177.             -54.98 28.26 -135.8,
  178.             -52.77 25.79 -118.4,
  179.             -49.32 23.31 -101.1,
  180.             -44.83 20.81 -83.8,
  181.             -39.5 18.28 -66.53,
  182.             -30.95 15.29 -46.47,
  183.             -19.28 12.25 -26.53,
  184.             -5.529 9.196 -6.676,
  185.             9.26 6.127 13.13,
  186.             24.05 3.057 32.94,
  187.             37.8 9.155e-05 52.79 ]
  188.     }
  189.     DEF trainGroupRotationInterp OrientationInterpolator {
  190.       key    [ 0, 0.008333, 0.01667, 0.025,
  191.             0.03333, 0.04167, 0.05, 0.05833,
  192.             0.06667, 0.07639, 0.08611, 0.09583,
  193.             0.1056, 0.1153, 0.125, 0.1333,
  194.             0.1417, 0.15, 0.1583, 0.1667,
  195.             0.175, 0.1833, 0.1917, 0.2014,
  196.             0.2111, 0.2208, 0.2306, 0.2403,
  197.             0.25, 0.2583, 0.2667, 0.275,
  198.             0.2833, 0.2917, 0.3, 0.3083,
  199.             0.3167, 0.3264, 0.3361, 0.3458,
  200.             0.3556, 0.3653, 0.375, 0.3833,
  201.             0.3917, 0.4, 0.4083, 0.4167,
  202.             0.425, 0.4333, 0.4417, 0.4514,
  203.             0.4611, 0.4708, 0.4806, 0.4903,
  204.             0.5, 0.5083, 0.5167, 0.525,
  205.             0.5333, 0.5417, 0.55, 0.5583,
  206.             0.5667, 0.5764, 0.5861, 0.5958,
  207.             0.6056, 0.6153, 0.625, 0.6333,
  208.             0.6417, 0.65, 0.6583, 0.6667,
  209.             0.675, 0.6833, 0.6917, 0.7014,
  210.             0.7111, 0.7208, 0.7306, 0.7403,
  211.             0.75, 0.7583, 0.7667, 0.775,
  212.             0.7833, 0.7917, 0.8, 0.8083,
  213.             0.8167, 0.825, 0.8333, 0.8417,
  214.             0.85, 0.8583, 0.8667, 0.875,
  215.             0.8833, 0.8917, 0.9, 0.9083,
  216.             0.9167, 0.925, 0.9333, 0.9417,
  217.             0.9514, 0.9611, 0.9708, 0.9806,
  218.             0.9903, 1 ]
  219.       keyValue    [ -0.1777 0.9832 0.04141  0.4654,
  220.             -0.1406 0.9875 0.07089  0.4923,
  221.             -0.09496 0.9896 0.1077  0.5306,
  222.             -0.04809 0.9883 0.1449  0.5783,
  223.             -0.004746 0.984 0.1783  0.6325,
  224.             0.03258 0.9781 0.2055  0.6898,
  225.             0.06299 0.9721 0.226  0.7465,
  226.             0.08639 0.9671 0.2394  0.7985,
  227.             0.103 0.9638 0.2459  0.8421,
  228.             0.1178 0.9624 0.2446  0.8873,
  229.             0.1282 0.9632 0.2361  0.9237,
  230.             0.1355 0.9652 0.2238  0.9547,
  231.             0.1408 0.9673 0.2109  0.9838,
  232.             0.1446 0.969 0.2002  1.014,
  233.             0.1477 0.9697 0.1946  1.05,
  234.             0.1508 0.9694 0.1938  1.078,
  235.             0.1549 0.9686 0.1945  1.106,
  236.             0.159 0.9676 0.1962  1.134,
  237.             0.162 0.9666 0.1986  1.163,
  238.             0.1631 0.9659 0.2011  1.194,
  239.             0.1613 0.9657 0.2035  1.227,
  240.             0.1559 0.9662 0.2053  1.263,
  241.             0.1464 0.9675 0.2061  1.304,
  242.             0.1262 0.9702 0.2067  1.368,
  243.             0.1 0.9732 0.2072  1.441,
  244.             0.07149 0.9757 0.207  1.52,
  245.             0.04347 0.9776 0.206  1.601,
  246.             0.01818 0.9788 0.2039  1.68,
  247.             -0.002634 0.9797 0.2005  1.752,
  248.             -0.01674 0.9803 0.1968  1.8,
  249.             -0.03139 0.9809 0.1921  1.845,
  250.             -0.04582 0.9813 0.1868  1.888,
  251.             -0.05927 0.9817 0.1811  1.929,
  252.             -0.07101 0.9819 0.1754  1.97,
  253.             -0.08033 0.9822 0.1701  2.012,
  254.             -0.08655 0.9824 0.1653  2.054,
  255.             -0.08901 0.9829 0.1615  2.099,
  256.             -0.08519 0.9838 0.1578  2.161,
  257.             -0.07481 0.985 0.1553  2.225,
  258.             -0.06086 0.9863 0.1532  2.289,
  259.             -0.04611 0.9874 0.1512  2.355,
  260.             -0.03321 0.9883 0.1487  2.421,
  261.             -0.02464 0.9891 0.1453  2.486,
  262.             -0.02103 0.9897 0.1419  2.536,
  263.             -0.01849 0.9903 0.1378  2.586,
  264.             -0.01686 0.9909 0.1333  2.637,
  265.             -0.01599 0.9916 0.1287  2.688,
  266.             -0.01573 0.9921 0.1242  2.738,
  267.             -0.01593 0.9926 0.1202  2.789,
  268.             -0.01645 0.993 0.1169  2.839,
  269.             -0.01717 0.9933 0.1145  2.887,
  270.             -0.01892 0.9935 0.1124  2.949,
  271.             -0.02181 0.9936 0.1109  3.006,
  272.             -0.02542 0.9936 0.1103  3.062,
  273.             -0.02935 0.9934 0.1107  3.122,
  274.             -0.0332 0.9931 0.1124  3.187,
  275.             -0.03655 0.9926 0.1156  3.262,
  276.             -0.0389 0.9921 0.1195  3.328,
  277.             -0.04144 0.9913 0.1248  3.404,
  278.             -0.04404 0.9904 0.1311  3.484,
  279.             -0.04658 0.9893 0.1381  3.568,
  280.             -0.04895 0.9882 0.1454  3.65,
  281.             -0.05101 0.9869 0.1527  3.728,
  282.             -0.05262 0.9858 0.1597  3.799,
  283.             -0.05362 0.9847 0.1658  3.86,
  284.             -0.05364 0.9833 0.1736  3.924,
  285.             -0.05231 0.9819 0.1819  3.974,
  286.             -0.0502 0.9806 0.1897  4.016,
  287.             -0.04787 0.9794 0.1962  4.052,
  288.             -0.04592 0.9786 0.2007  4.088,
  289.             -0.04496 0.9783 0.2024  4.129,
  290.             -0.04502 0.9786 0.201  4.16,
  291.             -0.04554 0.9793 0.1974  4.187,
  292.             -0.04641 0.9803 0.1921  4.212,
  293.             -0.04748 0.9815 0.1856  4.239,
  294.             -0.04865 0.9827 0.1785  4.267,
  295.             -0.04978 0.984 0.1713  4.301,
  296.             -0.05075 0.985 0.1647  4.341,
  297.             -0.05144 0.9859 0.1591  4.39,
  298.             -0.052 0.9869 0.1526  4.472,
  299.             -0.05241 0.9879 0.1461  4.569,
  300.             -0.05267 0.9888 0.1394  4.675,
  301.             -0.05277 0.9898 0.1326  4.786,
  302.             -0.05272 0.9907 0.1257  4.895,
  303.             0.05251 -0.9915 -0.1189  1.284,
  304.             -0.05219 0.9918 0.1163  5.039,
  305.             -0.05152 0.9922 0.1136  5.078,
  306.             -0.05052 0.9925 0.111  5.118,
  307.             -0.04926 0.9929 0.1083  5.158,
  308.             -0.0478 0.9932 0.1057  5.198,
  309.             -0.0462 0.9936 0.103  5.238,
  310.             -0.04455 0.994 0.1003  5.277,
  311.             -0.04292 0.9943 0.09761  5.316,
  312.             -0.04143 0.9946 0.09486  5.355,
  313.             -0.04021 0.9949 0.09208  5.393,
  314.             -0.03938 0.9952 0.08926  5.431,
  315.             -0.03912 0.9955 0.0864  5.468,
  316.             -0.03963 0.9957 0.08351  5.505,
  317.             -0.04113 0.9959 0.08057  5.541,
  318.             0.04391 -0.996 -0.0776  0.7071,
  319.             0.05562 -0.9959 -0.07195  0.6454,
  320.             0.07728 -0.9948 -0.06624  0.5891,
  321.             0.1081 -0.9923 -0.06053  0.5364,
  322.             0.1468 -0.9876 -0.05482  0.4855,
  323.             0.1922 -0.9801 -0.04904  0.4342,
  324.             0.2431 -0.969 -0.04298  0.3806,
  325.             0.2997 -0.9534 -0.03619  0.3221,
  326.             0.3649 -0.9307 -0.02748  0.2563,
  327.             0.5108 -0.8597 -0.007514  0.1486,
  328.             0.9944 0.051 0.09282  0.04621,
  329.             0.06745 0.9956 0.06531  0.1394,
  330.             -0.1037 0.9934 0.049  0.2705,
  331.             -0.1578 0.9865 0.04335  0.3845,
  332.             -0.1777 0.9832 0.04141  0.4654 ]
  333.     }
  334.       ]
  335.     }
  336.     DEF touchTrain TouchSensor {
  337.     }
  338.     DEF trainSoundEffectScript Script {
  339.       eventOut      SFFloat      mainintensity
  340.       eventOut      SFFloat      echointensity
  341.       eventOut      SFTime      startEffects
  342.       eventOut      SFTime      stopEffects
  343.       eventOut      SFTime      startTrainOut
  344.       eventOut      SFTime      echoStart
  345.       eventOut      SFTime      fadeStart
  346.       eventOut      SFTime      stopTrainOut
  347.       eventIn      SFFloat      echoFract
  348.       eventIn      SFFloat      fadeFract
  349.       eventIn      SFTime      startTrain
  350.       eventIn      SFTime      stopTrain
  351.       eventIn      SFTime      cycleTrain
  352.       field      SFTime      soundStart    0
  353.       field      SFBool      entering    FALSE
  354.       url    "vrmlscript:
  355.             function echoFract(value, time)
  356.             {
  357.                 echointensity = value;
  358.         mainintensity = 1 - value;
  359.             }
  360.             function fadeFract(value, time)
  361.             {
  362.          echointensity = 1-value;
  363.         mainintensity = value;
  364.             }
  365.             
  366.             function startTrain(value, time)
  367.             {
  368.                 soundStart = value;
  369.         startTrainOut = value;
  370.             }
  371.             
  372.             function stopTrain(value, time)
  373.             {
  374.                 soundStart = 0;
  375.         stopTrainOut = value;
  376.         stopEffects = value;
  377.             }            
  378.             function cycleTrain(value, time)
  379.             {
  380.                 startEffects = value+18;
  381.         stopEffects = value+22;
  382.         echoStart = value+18.75;
  383.         fadeStart = value+21.25;
  384.             }            
  385.             
  386.         "
  387.     }
  388.     DEF trainGeomInline Transform {
  389.       children    Inline {
  390.     url    "trainGeomInline.wrl"
  391.     bboxCenter    -95.9 -29.03 124.2
  392.     bboxSize    18.48 26.22 50.07
  393.       }
  394.  
  395.       translation    -523.8 -140.3 1291
  396.       rotation    0.2335 0.9639 0.1277  0.5917
  397.       scale    1 1 1
  398.       scaleOrientation    0.2476 0.9638 -0.09873  0.6145
  399.       center    -95.9 -29.03 124.2
  400.     }
  401.     DEF trainSound Sound {
  402.       source    DEF trainclip AudioClip {
  403.     url    "train.wav"
  404.     loop    TRUE
  405.     startTime    0
  406.     stopTime    1
  407.       }
  408.  
  409.       intensity    1
  410.       location    -614.5 -140.9 1444
  411.       direction    0.04565 -0.6118 0.7897
  412.       minFront    40
  413.       maxFront    400
  414.       minBack    40
  415.       maxBack    400
  416.     }
  417.     DEF trainEcho Sound {
  418.       source    DEF trainEchoClip AudioClip {
  419.     url    "trainTunnel.wav"
  420.     loop    TRUE
  421.     startTime    0
  422.     stopTime    1
  423.       }
  424.  
  425.       intensity    1
  426.       location    -614 -142.3 1442
  427.       direction    0.04565 -0.6118 0.7897
  428.       minFront    40
  429.       maxFront    400
  430.       minBack    40
  431.       maxBack    400
  432.     }
  433.     DEF cabView Viewpoint {
  434.       position    -629.3 -162.5 1402
  435.       orientation    -0.02293 0.9925 0.1204  3.717
  436.       fieldOfView    0.7854
  437.       description    "cabcam"
  438.     }
  439.   ]
  440.   translation    0 0 0
  441.   rotation    0 0 1  0
  442.   scale    1 1 1
  443.   scaleOrientation    0 0 1  0
  444.   center    -619.7 -169.4 1416
  445. }
  446. DEF terrainGeomInline Transform {
  447.   children    Inline {
  448.     url    "terrainGeom.wrl"
  449.     bboxCenter    3.959 -23.58 28.31
  450.     bboxSize    3195 327.2 3194
  451.   }
  452.  
  453. }
  454. DEF tunnelGroup Transform {
  455.   children    DEF tunnelGeomInline Transform {
  456.     children    Inline {
  457.       url    "tunnelGeomInline.wrl"
  458.       bboxCenter    6.695 -20.74 18.33
  459.       bboxSize    55.92 57.82 268.1
  460.     }
  461.  
  462.     translation    -598.4 -86.63 1055
  463.     rotation    0.2188 -0.9756 0.01611  0.4707
  464.     scale    1 1 1
  465.     scaleOrientation    -0.1655 0.3749 -0.9122  0.5138
  466.   }
  467.  
  468.   translation    0 48.66 6.274
  469.   rotation    1 0 0  0.04674
  470.   scale    1 1 1
  471. }
  472. DEF trackGroup Transform {
  473.   children    Inline {
  474.     url    "trackInline.wrl"
  475.     bboxCenter    -271.8 -141.9 1203
  476.     bboxSize    819.7 389.5 746.1
  477.   }
  478.  
  479. }
  480. DEF Light1 DirectionalLight {
  481.   intensity    0.7961
  482.   ambientIntensity    0.41
  483.   color    0.9737 1 0.9474
  484.   direction    -0.7968 -0.1298 -0.5901
  485. }
  486. DEF VP2 Viewpoint {
  487.   position    -748.6 -119.1 1333
  488.   orientation    0.0252 -0.9983 -0.05338  0.6548
  489.   fieldOfView    0.7854
  490.   description    "tunnelView"
  491. }
  492. ROUTE trainSoundEffectScript.echoStart TO echoTimer.set_startTime
  493. ROUTE trainSoundEffectScript.fadeStart TO fadeTimer.set_startTime
  494. ROUTE touchTrain.touchTime TO trainTimer.set_startTime
  495. ROUTE cabView.bindTime TO trainTimer.set_startTime
  496. ROUTE trainTimer.fraction_changed TO trainGroupTranslationInterp.set_fraction
  497. ROUTE trainTimer.fraction_changed TO trainGroupRotationInterp.set_fraction
  498. ROUTE echoTimer.fraction_changed TO trainSoundEffectScript.echoFract
  499. ROUTE fadeTimer.fraction_changed TO trainSoundEffectScript.fadeFract
  500. ROUTE trainTimer.startTime_changed TO trainSoundEffectScript.startTrain
  501. ROUTE trainTimer.cycleTime TO trainSoundEffectScript.cycleTrain
  502. ROUTE trainSoundEffectScript.startTrainOut TO trainclip.set_startTime
  503. ROUTE trainSoundEffectScript.stopTrainOut TO trainclip.set_stopTime
  504. ROUTE trainSoundEffectScript.mainintensity TO trainSound.set_intensity
  505. ROUTE trainSoundEffectScript.startEffects TO trainEchoClip.set_startTime
  506. ROUTE trainSoundEffectScript.stopEffects TO trainEchoClip.set_stopTime
  507. ROUTE trainSoundEffectScript.echointensity TO trainEcho.set_intensity
  508. ROUTE trainGroupTranslationInterp.value_changed TO trainGroup.set_translation
  509. ROUTE trainGroupRotationInterp.value_changed TO trainGroup.set_rotation
  510.