media @ VU 
  
 
 
 
 
  
    
    
  
web3d-x-switch.vr
web3d-x-switch.vr
(wrl
) 
[ flux /
bitmanagement / 
cortona / 
octaga 
]
  
Web3D/VR
  
 switch cycling
  
script
  
  DEF CYCLE Script {
     eventIn SFTime touchTime
     field SFInt32 number 4
     eventOut SFInt32 output
     url "javascript:
        function initialize() {
           output = 0;
        }
        function touchTime(value, time) {
           if (output == number - 1) output = 0;
           else ++output;
        }
     "
  }
  
  
  
button
  Transform {
     translation -7 5 0
     children [
        DEF SENSOR TouchSensor {
        }
        Shape {
           appearance Appearance {
              material Material {
                 emissiveColor 1 0 0
              }
           }
           geometry Sphere {
              radius 0.1
           }
        }
     ]
  }
  
  
  
switch
  
  DEF SWITCH Switch {
     whichChoice 0
     choice [
        Shape {
           appearance DEF BLUE Appearance {
              material Material {
                 diffuseColor 0 0 1
              }
           }
           geometry Box {}
        }
        Shape {
           appearance USE BLUE
           geometry Sphere {}
        }
        Shape {
           appearance USE BLUE
           geometry Cone {}
        }
        Shape {
           appearance USE BLUE
           geometry Cylinder {}
        }
     ]
  }
  
  
  
event routing
  
  ROUTE SENSOR.touchTime TO CYCLE.touchTime
  ROUTE CYCLE.output TO SWITCH.whichChoice
  
    
  
    
  
  
  
  
  
  
  
  (C) A. Eliëns 
  21/5/2007
  
  You may not copy or print any of this material without explicit permission of the author or the publisher. 
  
In case of other copyright issues, contact the author.