media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

web3d-x-button.vr

web3d-x-button.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

Web3D/VR

script logo handler

scene


  
  NavigationInfo {
     type ["NONE"]
  }
  
  Viewpoint {
     description "Default View"
     position 5 5 13
  }
  
  

image


  
  Transform {
     translation 5 5 0
     children [
        Shape {
           appearance Appearance {            
              texture ImageTexture {
                 url "@logo.gif"
              }
              textureTransform DEF TEXTRANS TextureTransform {}
           }
           geometry Box {
              size 10 10 1e-8
           }
        }
     ]
  }
  
  

sensor


  
  Group {
     children [
        DEF SENSOR PlaneSensor {
           minPosition 0 0
           maxPosition 10 10
           offset 10 10 0
        }
  
        DEF BUTTON Transform {
           translation 10 10 0
           children [
              Shape {
                 appearance Appearance {
                    material Material {
                       emissiveColor 1 0 0
                    }
                 }
                 geometry Sphere {
                    radius 0.1
                 }
              }
           ]
        }
     ]
  }
  
  

script


  
  DEF SCRIPT Script {
     eventIn  SFVec3f  set_translation
     eventOut SFVec2f  scale_changed
     url "javascript:
        function set_translation(value,time) {
           if (value.x < 1e-8) value.x = 1e-8;
           if (value.y < 1e-8) value.y = 1e-8;
           var newScale = new SFVec2f(10/value.x, 10/value.y);
           scale_changed = newScale;
        }
     "
  }
  
  

event routing


  
  ROUTE SENSOR.translation_changed TO BUTTON.set_translation
  ROUTE SENSOR.translation_changed TO SCRIPT.set_translation
  ROUTE SCRIPT.scale_changed TO TEXTRANS.set_scale
  


(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.