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

extern-proto-slide-interface-interface.vr

extern-proto-slide-interface-interface.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  #VRMLV2.0 utf8
  

proto-slide-interface-interface

interface


  EXTERNPROTO SlideInterface [
  exposedField SFNode slide_set
  exposedField SFVec3f location
  exposedField SFVec3f scale
  exposedField SFRotation rotation
  exposedField SFFloat transparency
  exposedField SFColor color
  exposedField SFColor knob
  eventIn SFInt32 dlp
  ]
  {
  
  Transform {
  translation IS location
  scale IS scale
  rotation IS rotation
  children [
  DEF RED Appearance {
           material Material {
                emissiveColor 1 0 0      
                diffuseColor 1 0 0      
                transparency 0.7
                }
          }
  DEF WHITE Appearance {
           material Material {
                emissiveColor 1 1 1      
                diffuseColor 1 1 1
                transparency 0.6
                }
          }
  DEF YELLOW Appearance {
           material Material {
                emissiveColor 1 1 0      
                diffuseColor 1 1 0
                transparency 0.6
                }
          }
  DEF BLUE Appearance {
           material Material {
                emissiveColor 0 0 1
                diffuseColor 0 0 1
                transparency 0.7
                }
          }
  Switch {
      whichChoice -1
      choice [
  
          DEF C_SHAPE Shape {
              appearance DEF APPEARANCE Appearance {
                  material Material {
                      emissiveColor 0 0 0      
                      diffuseColor  0.5 0.5 0.5
                      specularColor 0.3 0.3 0.3
                      transparency 0.7
                  }
              } 
              geometry Sphere { radius 0.5 }
              }
          DEF ARROW_SHAPE Shape {
              appearance DEF APPEARANCE Appearance {
                  material Material {
                      emissiveColor 0 0 0      
                      diffuseColor  0.5 0.5 0.5
                      specularColor 0.3 0.3 0.3
                      transparency IS transparency
                  }
              } 
              geometry Extrusion {
                  convex FALSE
                  crossSection [ -1.0  0.0,
                                 -0.0  0.5,
                                 -0.0  0.2,
                                  1.0  0.2,
                                  1.0 -0.2,
                                 -0.0 -0.2,
                                 -0.0 -0.5,
                                 -1.0  0.0 ]
                  spine [ 0 0.0 0,
                          0 0.2 0 ]
              }
          }
          DEF SPHERE_SHAPE Shape {
              appearance USE APPEARANCE
              geometry Sphere { radius 0.5 }
          }
          DEF BOX_SHAPE Shape {
              appearance USE APPEARANCE
              geometry Box {}
          }
  
          DEF BAR_SHAPE Shape {
              appearance USE APPEARANCE
              geometry Box { size 0.07 0.04 0.04 }
          }
          DEF WHITEBAR Shape {
              appearance USE WHITE
              geometry Box { size 0.07 0.04 0.04 }
          }
          DEF REDBAR Shape {
              appearance USE RED
              geometry Box { size 0.07 0.04 0.04 }
          }
          DEF BLUEBAR Shape {
              appearance USE BLUE
              geometry Box { size 0.07 0.04 0.04 }
          }
          DEF YELLOWBAR Shape {
              appearance USE YELLOW
              geometry Box { size 0.07 0.04 0.04 }
          }
  
      ]
  }
  
  Transform {
      scale 0.8 1 0.5
      ##translation 0 -3 0
      children [
          Transform {
              translation  10 -4 0
              children [
                  DEF C_TOUCH_SENSOR TouchSensor {}
                  Transform {
                      rotation  1 0 0 1.57
                      scale 0.5 1.5 1
                      children  USE C_SHAPE
                  }
              ]
          }
      DEF switch Switch {
      whichChoice 0
      choice [
      DEF group Group {
      children [
          DEF index_switch Switch {
          whichChoice 0
          choice [
          Transform {
              scale 20 20 10
              translation  0 -3.5 -1
              children [
                  Anchor {
                      url          "proto-slide-interface-interface.html"
                      ##url          "index.html"
                      parameter    []
                      children USE BAR_SHAPE
                  }
              ]
          }
          ] }
          DEF dlp_switch Switch {
          whichChoice -1
          choice [
          Group { children [ 
          Transform {
              scale 20 20 10
              translation  0 -3.5 -1
              children [
              DEF touch_white TouchSensor {}
              Group { children USE WHITEBAR }
              ]
          }
          Transform {
              scale 20 20 10
              translation  2 -3.5 -1
              children [
              DEF touch_blue TouchSensor {}
              Group { children USE BLUEBAR }
              ]
          }
          Transform {
              scale 20 20 10
              translation  -2 -3.5 -1
              children [
              DEF touch_red TouchSensor {}
              Group { children USE REDBAR }
              ]
          } 
          ] }
          ] } ## Switch
  
          Transform {
              ##translation  -0.5 -0.35 -1
              translation  -7 -3 0
              children [
                  DEF PREVIOUS_TOUCH_SENSOR TouchSensor {}
                  Transform {
                      rotation  1 0 0 1.57
                      scale 0.5 1.5 1
                      ##scal10  5  0.05 0.05 0.05
                      children  USE ARROW_SHAPE
                      ##children  USE SPHERE_SHAPE
                  }
              ]
          }
  
          Transform {
              translation   7 -3 0
              children [
                  DEF NEXT_TOUCH_SENSOR TouchSensor {}
                  Transform {
                      rotation  0 0.706 0.706 3.1415
                      scale 0.5 1.5 1
                      ##scale     0.05 0.05 0.05
                      ## children  USE SPHERE_SHAPE
                      children  USE ARROW_SHAPE
                  }
              ]
          }
          ] }
          ] }
  
          DEF SCRIPT Script {
          directOutput TRUE
          eventIn SFInt32 dlp IS dlp
          eventIn SFTime toggle
          eventIn SFTime bar_white
          eventIn SFTime bar_red
          eventIn SFTime bar_blue
          field SFNode me
          
          field SFNode previous
          field SFNode next
          field SFNode button
          field SFNode white
          field SFNode red
          field SFNode blue
          field SFNode index_switch
          field SFNode dlp_switch
          field SFNode xswitch
          field SFNode slide_set
  
          field SFInt32 state
          
          url "vrmlscript:
          function initialize() {
          Browser.addRoute(previous,'touchTime',slide_set,'previous');
          Browser.addRoute(next,'touchTime',slide_set,'next');
          Browser.addRoute(button,'touchTime',me,'toggle');
          Browser.addRoute(white,'touchTime',me,'bar_white');
          Browser.addRoute(red,'touchTime',me,'bar_red');
          Browser.addRoute(blue,'touchTime',me,'bar_blue');
          }
          function shutdown() {
          Browser.deleteRoute(previous,'touchTime',slide_set,'previous');
          Browser.deleteRoute(next,'touchTime',slide_set,'next');
          Browser.deleteRoute(button,'touchTime',me,'toggle');
          Browser.deleteRoute(white,'touchTime',me,'bar_white');
          Browser.deleteRoute(red,'touchTime',me,'bar_red');
          Browser.deleteRoute(blue,'touchTime',me,'bar_blue');
          }
          function dlp(value) {
          if (value == 1) {
                  index_switch.whichChoice = -1;
                  dlp_switch.whichChoice = 0;
          } else if (value == 0) {
                  index_switch.whichChoice = 0;
                  dlp_switch.whichChoice = -1;
          }}
          function bar_white(time) { slide_set.touched = 1; }
          function bar_red(time) { slide_set.touched = 2; }
          function bar_blue(time) { slide_set.touched = 2; }
          function toggle(time) {
          if (state == 0) {
                  xswitch.whichChoice = -1;
                  slide_set.hide = -1;
                  state = 1;
          } else if (state == 1) {
                  xswitch.whichChoice = 0;
                  slide_set.hide = 0;
                  state = 0;
          }
          }
          "
          }
  
      ]
  }
  
  ] } ## end transform
  }
  
  


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