tut21.wrl

#VRML V2.0 utf8

WorldInfo {
   title "Floppy's VRML97 Tutorial Example 21"
   info ["(C) Copyright 1999 Vapour Technology"
         "vrmlguide@vapourtech.com"]
}

DirectionalLight {
   direction 0 -1 -1
   ambientIntensity .5
}

Background {
   skyColor 0 0 0
}

DEF BACKRED Background {
   skyColor 1 0 0
}

DEF BACKGREEN Background {
   skyColor 0 1 0
}

DEF BACKBLUE Background {
   skyColor 0 0 1
}

Group {
   children [
      DEF WORLDVIEW Viewpoint {
         description "EntryWay"
         position 0 1.6 7.5
      }
      DEF MOVABLE NavigationInfo {
         headlight FALSE
      }
      DEF FLOOR Shape {
         appearance DEF METAL Appearance {
            material Material {
               shininess .75
               diffuseColor .75 .75 .75
               ambientIntensity .5
            }
         }
         geometry Cylinder {
            radius 10
            height .1
         }
      }
      Transform {
         translation 0 5 0
         children USE FLOOR
      }
      Shape {
         appearance Appearance {
            material Material {
               transparency 1
            }
         }
         geometry Cylinder {
            radius 10.1
            height 5
         }
      }
      DEF PILLAR Transform {
         translation 0 2.5 9
         children [
            Shape {
               appearance USE METAL
               geometry Cylinder {
                  radius .25
                  height 5
               }
            }
         ]
      }
      Transform {
         rotation 0 1 0 .78
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 1.57
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 2.36
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 3.14
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 3.93
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 4.71
         children USE PILLAR
      }
      Transform {
         rotation 0 1 0 5.5
         children USE PILLAR
      }
      Transform {
         translation -5 1 -3
         children [
            DEF WORLDSWITCH TouchSensor {
            }
            Shape {
               appearance Appearance {
                  material Material {
                     emissiveColor 1 1 0
                  }
               }
               geometry Sphere {
                  radius .1
               }
            }
         ]
      }
      Transform {
         translation -5 .5 -3
         children [
            Shape {
               appearance USE METAL
               geometry Cylinder {
                  radius .05
                  height 1
               }
            }
         ]
      }
      Transform {
         translation 5 .5 -3
         children [
            Shape {
               appearance USE METAL
               geometry Box {
                  size .5 1 2
               }
            }
         ]
      }
      Transform {
         translation 5 1 -3.5
         children [
            DEF REDSWITCH TouchSensor {
            }
            Shape {
               appearance Appearance {
                  material Material {
                     emissiveColor 1 0 0
                  }
               }
               geometry Sphere {
                  radius .2
               }
            }
         ]
      }
      Transform {
         translation 5 1 -3
         children [
            DEF GREENSWITCH TouchSensor {
            }
            Shape {
               appearance Appearance {
                  material Material {
                     emissiveColor 0 1 0
                  }
               }
               geometry Sphere {
                  radius .2
               }
            }
         ]
      }
      Transform {
         translation 5 1 -2.5
         children [
            DEF BLUESWITCH TouchSensor {
            }
            Shape {
               appearance Appearance {
                  material Material {
                     emissiveColor 0 0 1
                  }
               }
               geometry Sphere {
                  radius .2
               }
            }
         ]
      }
   ]
}

DEF PLATFORMTIMER TimeSensor {
   cycleInterval 60
   loop TRUE
}

DEF PLATFORMINT OrientationInterpolator {
   key [
      0 .25 .5 .75 1
   ]
   keyValue [
      0 -1 0 0 0 -1 0 1.57 0 -1 0 3.14 0 -1 0 4.71 0 -1 0 0
   ]
}

DEF PLATFORM Transform {
   children [
      Transform {
         translation 0 0 20
         children [
            DEF PLATFORMVIEW Viewpoint {
               description "Moving Platform"
               position 0 1.6 1
            }
            DEF STATIC NavigationInfo {
               headlight FALSE
               type "NONE"
            }
            Shape {
               appearance USE METAL
               geometry Box {
                  size 2.2 .1 2.2
               }
            }
            Transform {
               translation 0 1.1 -1
               children [
                  DEF PLATFORMSWITCH TouchSensor {
                  }
                  Shape {
                     appearance Appearance {
                        material Material {
                           emissiveColor 1 1 0
                        }
                     }
                     geometry Sphere {
                        radius .1
                     }
                  }
               ]
            }
            Transform {
               translation 0 .5 -1
               children [
                  Shape {
                     appearance USE METAL
                     geometry Cylinder {
                        radius .05
                        height 1
                     }
                  }
               ]
            }
         ]
      }
   ]
}

DEF REDFILTER Script {
   eventIn SFBool input
   field SFBool boolValue TRUE
   eventOut SFBool output
   url "javascript:
      function input(value, time) {
         if (value==boolValue) output = value;
      }
   "
}

DEF GREENFILTER Script {
   eventIn SFBool input
   field SFBool boolValue TRUE
   eventOut SFBool output
   url "javascript:
      function input(value, time) {
         if (value==boolValue) output = value;
      }
   "
}

DEF BLUEFILTER Script {
   eventIn SFBool input
   field SFBool boolValue TRUE
   eventOut SFBool output
   url "javascript:
      function input(value, time) {
         if (value==boolValue) output = value;
      }
   "
}

DEF PLATFORMFILTER Script {
   eventIn SFBool input
   field SFBool boolValue TRUE
   eventOut SFBool output
   url "javascript:
      function input(value, time) {
         if (value==boolValue) output = value;
      }
   "
}

DEF WORLDFILTER Script {
   eventIn SFBool input
   field SFBool boolValue TRUE
   eventOut SFBool output
   url "javascript:
      function input(value, time) {
         if (value==boolValue) output = value;
      }
   "
}

#Platform animation
ROUTE PLATFORMTIMER.fraction_changed TO PLATFORMINT.set_fraction
ROUTE PLATFORMINT.value_changed TO PLATFORM.rotation

#Viewpoint binding
ROUTE WORLDSWITCH.isActive TO WORLDFILTER.input
ROUTE WORLDFILTER.output TO PLATFORMVIEW.set_bind
ROUTE PLATFORMSWITCH.isActive TO PLATFORMFILTER.input
ROUTE PLATFORMFILTER.output TO WORLDVIEW.set_bind

#NavigationInfo updating
ROUTE WORLDFILTER.output TO STATIC.set_bind
ROUTE PLATFORMFILTER.output TO MOVABLE.set_bind

#Background binding
ROUTE REDSWITCH.isActive TO REDFILTER.input
ROUTE REDFILTER.output TO BACKRED.set_bind
ROUTE GREENSWITCH.isActive TO GREENFILTER.input
ROUTE GREENFILTER.output TO BACKGREEN.set_bind
ROUTE BLUESWITCH.isActive TO BLUEFILTER.input
ROUTE BLUEFILTER.output TO BACKBLUE.set_bind

Generated by GNU enscript 1.6.1.

© Copyright 1999 Vapour Technology - vrmlguide@vapourtech.com - http://www.vapourtech.com/vrmlguide