home *** CD-ROM | disk | FTP | other *** search
/ Late Night VRML 2.0 with Java CD-ROM / code.zip / Ch11 / diagram / dsp.wrl next >
Text File  |  1997-03-31  |  11KB  |  440 lines

  1. #VRML V2.0 utf8
  2.  
  3. PROTO debugSound [
  4.         field        SFVec3f direction 0 0 1
  5.         field        SFFloat intensity 1
  6.         field        SFVec3f location 0 0 0
  7.         field        SFFloat maxBack 10
  8.         field        SFFloat maxFront 10
  9.         field        SFFloat minBack 1
  10.         field        SFFloat minFront 1
  11.         field        SFFloat priority 0
  12.         field        SFNode source NULL
  13.  
  14.         field        SFBool spatialize TRUE
  15.       ]
  16. {
  17.   Group {
  18.     children    [
  19.       DEF dbgSound Sound {
  20.     source IS source
  21.     source    NULL
  22.  
  23.     priority IS priority
  24.     priority    0
  25.     location IS location
  26.     location    0 0 0
  27.     direction IS direction
  28.     direction    0 0 1
  29.     minFront IS minFront
  30.     minFront    1
  31.     maxFront IS maxFront
  32.     maxFront    10
  33.     minBack IS minBack
  34.     minBack    1
  35.     maxBack IS maxBack
  36.     maxBack    10
  37.     spatialize IS spatialize
  38.     spatialize    TRUE
  39.       }
  40.       DEF rangeScript_0 Script {
  41.     eventOut    SFVec3f    maxScale
  42.     eventOut    SFVec3f    minScale
  43.     eventOut    SFVec3f    maxTrans
  44.     eventOut    SFVec3f    minTrans
  45.     field    SFFloat    maxFront IS maxFront
  46.     field    SFFloat    minFront IS minFront
  47.     field    SFFloat    maxBack IS maxBack
  48.     field    SFFloat    minBack IS minBack
  49.     field    SFVec3f    location IS location
  50.     field    SFFloat    maxf    10
  51.     field    SFFloat    minf    1
  52.     field    SFFloat    maxb    10
  53.     field    SFFloat    minb    1
  54.     field    SFFloat    minyx    1
  55.     field    SFFloat    maxxy    10
  56.     field    SFVec3f    loc    0 0 0
  57.     field    SFVec3f    maxs    10 10 1
  58.     field    SFVec3f    mins    1 1 1
  59.     field    SFVec3f    maxt    0 0 0
  60.     field    SFVec3f    mint    0 0 0
  61.     url    "vrmlscript:
  62.     function maxRange() {
  63.           maxxy = Math.sqrt(maxf*maxb);
  64.           maxs = new SFVec3f(maxxy, maxxy, ((maxf + maxb) * 0.5));
  65.           maxt = new SFVec3f(loc[0], loc[1], loc[2]+((maxf-maxb) * 0.5));
  66.           maxScale = maxs;
  67.           maxTrans = maxt;
  68.     }
  69.     function minRange() {
  70.           minxy = Math.sqrt(minf*minb);
  71.           mins = new SFVec3f(minxy, minxy, ((minf + minb) * 0.5));
  72.           mint = new SFVec3f(loc[0], loc[1], loc[2]+((minf-minb) * 0.5));
  73.           minScale = mins;
  74.           minTrans = mint;
  75.     }
  76.     function initialize() {
  77.           loc = location;
  78.           maxf = maxFront;
  79.           maxb = maxBack;
  80.           minf = minFront;
  81.           minb = minBack;
  82.           minRange();
  83.           maxRange();
  84.     }
  85.       "
  86.       }
  87.       DEF minRange_1 Transform {
  88.     children    Transform {
  89.       children    Shape {
  90.         appearance    Appearance {
  91.           material    Material {
  92.         ambientIntensity    1.39
  93.         diffuseColor    0.00646 0.718 0.7
  94.         specularColor    0 0 0
  95.         emissiveColor    0.606 0.718 0
  96.         shininess    0.2
  97.         transparency    0
  98.           }
  99.  
  100.           texture    NULL
  101.  
  102.           textureTransform    NULL
  103.  
  104.         }
  105.  
  106.         geometry    DEF wireframe_2 IndexedLineSet {
  107.           coord    Coordinate {
  108.         point    [ 1 0 0,
  109.               0.97 0.243 0,
  110.               0.97 0 0.243,
  111.               0.905 0.302 0.302,
  112.               0.832 0 0.555,
  113.               0.667 0.333 0.667,
  114.               0.555 0 0.832,
  115.               0.302 0.302 0.905,
  116.               0.243 0 0.97,
  117.               0 0.243 0.97,
  118.               0 0 1,
  119.               0.832 0.555 0,
  120.               0.667 0.667 0.333,
  121.               0.333 0.667 0.667,
  122.               0 0.555 0.832,
  123.               0.555 0.832 0,
  124.               0.302 0.905 0.302,
  125.               0 0.832 0.555,
  126.               0.243 0.97 0,
  127.               0 0.97 0.243,
  128.               0 1 0,
  129.               -0.243 0 0.97,
  130.               -0.302 0.302 0.905,
  131.               -0.555 0 0.832,
  132.               -0.667 0.333 0.667,
  133.               -0.832 0 0.555,
  134.               -0.905 0.302 0.302,
  135.               -0.97 0 0.243,
  136.               -0.97 0.243 0,
  137.               -1 0 0,
  138.               -0.333 0.667 0.667,
  139.               -0.667 0.667 0.333,
  140.               -0.832 0.555 0,
  141.               -0.302 0.905 0.302,
  142.               -0.555 0.832 0,
  143.               -0.243 0.97 0,
  144.               0 -0.243 0.97,
  145.               0.302 -0.302 0.905,
  146.               0.667 -0.333 0.667,
  147.               0.905 -0.302 0.302,
  148.               0.97 -0.243 0,
  149.               0 -0.555 0.832,
  150.               0.333 -0.667 0.667,
  151.               0.667 -0.667 0.333,
  152.               0.832 -0.555 0,
  153.               0 -0.832 0.555,
  154.               0.302 -0.905 0.302,
  155.               0.555 -0.832 0,
  156.               0 -0.97 0.243,
  157.               0.243 -0.97 0,
  158.               0 -1 0,
  159.               -0.97 -0.243 0,
  160.               -0.905 -0.302 0.302,
  161.               -0.667 -0.333 0.667,
  162.               -0.302 -0.302 0.905,
  163.               -0.832 -0.555 0,
  164.               -0.667 -0.667 0.333,
  165.               -0.333 -0.667 0.667,
  166.               -0.555 -0.832 0,
  167.               -0.302 -0.905 0.302,
  168.               -0.243 -0.97 0,
  169.               0 0 -1,
  170.               0 0.243 -0.97,
  171.               0.243 0 -0.97,
  172.               0.302 0.302 -0.905,
  173.               0.555 0 -0.832,
  174.               0.667 0.333 -0.667,
  175.               0.832 0 -0.555,
  176.               0.905 0.302 -0.302,
  177.               0.97 0 -0.243,
  178.               0 0.555 -0.832,
  179.               0.333 0.667 -0.667,
  180.               0.667 0.667 -0.333,
  181.               0 0.832 -0.555,
  182.               0.302 0.905 -0.302,
  183.               0 0.97 -0.243,
  184.               -0.97 0 -0.243,
  185.               -0.905 0.302 -0.302,
  186.               -0.832 0 -0.555,
  187.               -0.667 0.333 -0.667,
  188.               -0.555 0 -0.832,
  189.               -0.302 0.302 -0.905,
  190.               -0.243 0 -0.97,
  191.               -0.667 0.667 -0.333,
  192.               -0.333 0.667 -0.667,
  193.               -0.302 0.905 -0.302,
  194.               0.905 -0.302 -0.302,
  195.               0.667 -0.333 -0.667,
  196.               0.302 -0.302 -0.905,
  197.               0 -0.243 -0.97,
  198.               0.667 -0.667 -0.333,
  199.               0.333 -0.667 -0.667,
  200.               0 -0.555 -0.832,
  201.               0.302 -0.905 -0.302,
  202.               0 -0.832 -0.555,
  203.               0 -0.97 -0.243,
  204.               -0.302 -0.302 -0.905,
  205.               -0.667 -0.333 -0.667,
  206.               -0.905 -0.302 -0.302,
  207.               -0.333 -0.667 -0.667,
  208.               -0.667 -0.667 -0.333,
  209.               -0.302 -0.905 -0.302 ]
  210.           }
  211.  
  212.           color    NULL
  213.  
  214.           coordIndex    [ 0, 1, 2, -1, 2, 1, 3, -1,
  215.                 2, 3, 4, -1, 4, 3, 5, -1,
  216.                 4, 5, 6, -1, 6, 5, 7, -1,
  217.                 6, 7, 8, -1, 8, 7, 9, -1,
  218.                 8, 9, 10, -1, 1, 11, 3, -1,
  219.                 3, 11, 12, -1, 3, 12, 5, -1,
  220.                 5, 12, 13, -1, 5, 13, 7, -1,
  221.                 7, 13, 14, -1, 7, 14, 9, -1,
  222.                 11, 15, 12, -1, 12, 15, 16, -1,
  223.                 12, 16, 13, -1, 13, 16, 17, -1,
  224.                 13, 17, 14, -1, 15, 18, 16, -1,
  225.                 16, 18, 19, -1, 16, 19, 17, -1,
  226.                 19, 18, 20, -1, 10, 9, 21, -1,
  227.                 21, 9, 22, -1, 21, 22, 23, -1,
  228.                 23, 22, 24, -1, 23, 24, 25, -1,
  229.                 25, 24, 26, -1, 25, 26, 27, -1,
  230.                 27, 26, 28, -1, 27, 28, 29, -1,
  231.                 9, 14, 22, -1, 22, 14, 30, -1,
  232.                 22, 30, 24, -1, 24, 30, 31, -1,
  233.                 24, 31, 26, -1, 26, 31, 32, -1,
  234.                 26, 32, 28, -1, 14, 17, 30, -1,
  235.                 30, 17, 33, -1, 30, 33, 31, -1,
  236.                 31, 33, 34, -1, 31, 34, 32, -1,
  237.                 17, 19, 33, -1, 33, 19, 35, -1,
  238.                 33, 35, 34, -1, 35, 19, 20, -1,
  239.                 10, 36, 8, -1, 8, 36, 37, -1,
  240.                 8, 37, 6, -1, 6, 37, 38, -1,
  241.                 6, 38, 4, -1, 4, 38, 39, -1,
  242.                 4, 39, 2, -1, 2, 39, 40, -1,
  243.                 2, 40, 0, -1, 36, 41, 37, -1,
  244.                 37, 41, 42, -1, 37, 42, 38, -1,
  245.                 38, 42, 43, -1, 38, 43, 39, -1,
  246.                 39, 43, 44, -1, 39, 44, 40, -1,
  247.                 41, 45, 42, -1, 42, 45, 46, -1,
  248.                 42, 46, 43, -1, 43, 46, 47, -1,
  249.                 43, 47, 44, -1, 45, 48, 46, -1,
  250.                 46, 48, 49, -1, 46, 49, 47, -1,
  251.                 49, 48, 50, -1, 29, 51, 27, -1,
  252.                 27, 51, 52, -1, 27, 52, 25, -1,
  253.                 25, 52, 53, -1, 25, 53, 23, -1,
  254.                 23, 53, 54, -1, 23, 54, 21, -1,
  255.                 21, 54, 36, -1, 21, 36, 10, -1,
  256.                 51, 55, 52, -1, 52, 55, 56, -1,
  257.                 52, 56, 53, -1, 53, 56, 57, -1,
  258.                 53, 57, 54, -1, 54, 57, 41, -1,
  259.                 54, 41, 36, -1, 55, 58, 56, -1,
  260.                 56, 58, 59, -1, 56, 59, 57, -1,
  261.                 57, 59, 45, -1, 57, 45, 41, -1,
  262.                 58, 60, 59, -1, 59, 60, 48, -1,
  263.                 59, 48, 45, -1, 48, 60, 50, -1,
  264.                 61, 62, 63, -1, 63, 62, 64, -1,
  265.                 63, 64, 65, -1, 65, 64, 66, -1,
  266.                 65, 66, 67, -1, 67, 66, 68, -1,
  267.                 67, 68, 69, -1, 69, 68, 1, -1,
  268.                 69, 1, 0, -1, 62, 70, 64, -1,
  269.                 64, 70, 71, -1, 64, 71, 66, -1,
  270.                 66, 71, 72, -1, 66, 72, 68, -1,
  271.                 68, 72, 11, -1, 68, 11, 1, -1,
  272.                 70, 73, 71, -1, 71, 73, 74, -1,
  273.                 71, 74, 72, -1, 72, 74, 15, -1,
  274.                 72, 15, 11, -1, 73, 75, 74, -1,
  275.                 74, 75, 18, -1, 74, 18, 15, -1,
  276.                 18, 75, 20, -1, 29, 28, 76, -1,
  277.                 76, 28, 77, -1, 76, 77, 78, -1,
  278.                 78, 77, 79, -1, 78, 79, 80, -1,
  279.                 80, 79, 81, -1, 80, 81, 82, -1,
  280.                 82, 81, 62, -1, 82, 62, 61, -1,
  281.                 28, 32, 77, -1, 77, 32, 83, -1,
  282.                 77, 83, 79, -1, 79, 83, 84, -1,
  283.                 79, 84, 81, -1, 81, 84, 70, -1,
  284.                 81, 70, 62, -1, 32, 34, 83, -1,
  285.                 83, 34, 85, -1, 83, 85, 84, -1,
  286.                 84, 85, 73, -1, 84, 73, 70, -1,
  287.                 34, 35, 85, -1, 85, 35, 75, -1,
  288.                 85, 75, 73, -1, 75, 35, 20, -1,
  289.                 0, 40, 69, -1, 69, 40, 86, -1,
  290.                 69, 86, 67, -1, 67, 86, 87, -1,
  291.                 67, 87, 65, -1, 65, 87, 88, -1,
  292.                 65, 88, 63, -1, 63, 88, 89, -1,
  293.                 63, 89, 61, -1, 40, 44, 86, -1,
  294.                 86, 44, 90, -1, 86, 90, 87, -1,
  295.                 87, 90, 91, -1, 87, 91, 88, -1,
  296.                 88, 91, 92, -1, 88, 92, 89, -1,
  297.                 44, 47, 90, -1, 90, 47, 93, -1,
  298.                 90, 93, 91, -1, 91, 93, 94, -1,
  299.                 91, 94, 92, -1, 47, 49, 93, -1,
  300.                 93, 49, 95, -1, 93, 95, 94, -1,
  301.                 95, 49, 50, -1, 61, 89, 82, -1,
  302.                 82, 89, 96, -1, 82, 96, 80, -1,
  303.                 80, 96, 97, -1, 80, 97, 78, -1,
  304.                 78, 97, 98, -1, 78, 98, 76, -1,
  305.                 76, 98, 51, -1, 76, 51, 29, -1,
  306.                 89, 92, 96, -1, 96, 92, 99, -1,
  307.                 96, 99, 97, -1, 97, 99, 100, -1,
  308.                 97, 100, 98, -1, 98, 100, 55, -1,
  309.                 98, 55, 51, -1, 92, 94, 99, -1,
  310.                 99, 94, 101, -1, 99, 101, 100, -1,
  311.                 100, 101, 58, -1, 100, 58, 55, -1,
  312.                 94, 95, 101, -1, 101, 95, 60, -1,
  313.                 101, 60, 58, -1, 60, 95, 50, -1 ]
  314.         }
  315.  
  316.       }
  317.  
  318.       translation    0 0 0
  319.       rotation    1 0 0  1.57
  320.       scale    1 1 1
  321.       scaleOrientation    0 0 1  0
  322.     }
  323.  
  324.     translation    0 0 0
  325.     scale    1 1 1
  326.       }
  327.       DEF maxRange_3 Transform {
  328.     children    Transform {
  329.       children    Shape {
  330.         appearance    Appearance {
  331.           material    Material {
  332.         ambientIntensity    1.39
  333.         diffuseColor    0.0183 0.143 0.7
  334.         specularColor    0 0 0
  335.         emissiveColor    0.318 0.0434 0
  336.         shininess    0.2
  337.         transparency    0
  338.           }
  339.  
  340.           texture    NULL
  341.  
  342.           textureTransform    NULL
  343.  
  344.         }
  345.  
  346.         geometry    USE wireframe_2
  347.  
  348.       }
  349.  
  350.       translation    0 0 0
  351.       rotation    0 0 1  0
  352.       scale    1 1 1
  353.       scaleOrientation    0 0 1  0
  354.     }
  355.  
  356.     translation    0 0 0
  357.     scale    1 1 1
  358.       }
  359.     ]
  360.   }
  361.   ROUTE rangeScript_0.minTrans TO minRange_1.set_translation
  362.   ROUTE rangeScript_0.minScale TO minRange_1.set_scale
  363.   ROUTE rangeScript_0.maxTrans TO maxRange_3.set_translation
  364.   ROUTE rangeScript_0.maxScale TO maxRange_3.set_scale
  365. }
  366. WorldInfo {
  367.   info    [ "Created in CosmoWorlds",
  368.         "Packaged by CosmoPackage" ]
  369. }
  370. NavigationInfo {
  371.   speed    3
  372.   type    "EXAMINE"
  373. }
  374. DEF background Transform {
  375.   children    Background {
  376.     groundAngle    1.01
  377.     groundColor    [ 0.1 0.1 0.09,
  378.           0.48 0.48 0.45 ]
  379.     skyAngle    [ 0.05, 0.1, 1, 1.57 ]
  380.     skyColor    [ 1 1 0,
  381.           1 1 0.5,
  382.           0.125 0.125 0.5,
  383.           0.3 0.3 0.55,
  384.           0.64 0.73 0.84 ]
  385.   }
  386.  
  387.   translation    140 162 -16.6
  388.   rotation    0 0 1  0
  389. }
  390. DEF xform Transform {
  391.   children    [
  392.     DEF click TouchSensor {
  393.     }
  394.     DEF clickScript Script {
  395.       eventOut      SFTime      start
  396.       eventOut      SFTime      stop
  397.       eventIn      SFTime      touch
  398.       field      SFBool      playing    FALSE
  399.       url    "vrmlscript:
  400.             function touch (value, time) {
  401.               if (playing) {
  402.             stop = value;
  403.             playing = FALSE;
  404.               }
  405.               else {
  406.             start = value;
  407.             playing = TRUE;
  408.               }
  409.             }
  410.           "
  411.     }
  412.     debugSound {
  413.       maxBack    5
  414.       maxFront    150
  415.       minBack    1
  416.       minFront    25
  417.       source    DEF aclip AudioClip {
  418.     url    "forest.wav"
  419.     loop    TRUE
  420.     startTime    0
  421.     stopTime    1
  422.     description    "debug  xxAudioValues"
  423.       }
  424.  
  425.     }
  426.     DEF mybox Shape {
  427.       appearance    NULL
  428.  
  429.       geometry    Box {
  430.     size    0.5 0.5 0.5
  431.       }
  432.  
  433.     }
  434.   ]
  435.   translation    -1 0 0
  436. }
  437. ROUTE click.touchTime TO clickScript.touch
  438. ROUTE clickScript.start TO aclip.set_startTime
  439. ROUTE clickScript.stop TO aclip.set_stopTime
  440.