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-rot-color.vr

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

Web3D/VR

rotation and color

timer


  
  DEF TIMER TimeSensor {
          cycleInterval 10
          loop TRUE
  }
  
  

PROTO: cylinder (with transform)


  
  PROTO CylinderTransform [
          field SFVec3f cylinderTranslation 0  0  0
          field SFRotation cylinderRotation 1  0  0  1.57
          eventIn SFRotation setCylinderRotation
          field SFColor cylinderColor 1 1 1
          eventIn SFColor setCylinderColor
          field SFFloat cylinderRadius 3.0
          field SFFloat cylinderHeight 0.2
  ]
  

proto body


  {
          Transform {
                  translation IS cylinderTranslation
                  rotation IS cylinderRotation
                  set_rotation IS setCylinderRotation
                  children [
                          Shape {
                                  appearance Appearance {
                                          material Material {
                                                  diffuseColor IS cylinderColor
                  set_diffuseColor IS setCylinderColor
                                          }
                                  }
                                  geometry Cylinder {
                                          radius IS cylinderRadius
                                          height IS cylinderHeight
                                  }
                          }
                  ]
          }
  }
  
  

the scene (is a group)


  
  Group {
          children [
                  Transform {
                          rotation 1 0 0 -1.20
                          children [
  
                          CylinderTransform { }
  
  

orientation interpolator


  
                          DEF OR_INT OrientationInterpolator {
                                  key [0, 0.25, 0.5, 0.75, 1]
                                  keyValue [
                                          0 0 1  0.0
                                          0 0 1  -1.57
                                          0 0 1  -3.14
                                          0 0 1  -4.71
                                          0 0 1  -6.28
                                  ]
                          }
  
  

color interpolator


                          DEF COLINT ColorInterpolator {
                                  key [0, 0.33, 0.66, 1]
                                  keyValue [
                                          1 0 0,
                                          0 1 0,
                                          0 0 1,
                                          1 0 0
                                  ]
                          }
  
  

the cylinder object


  
                          DEF ORCYL CylinderTransform {
                                  cylinderHeight 5.0
                                  cylinderRadius 0.8
                                  cylinderColor 1 0 0
                                  cylinderRotation 1 0 0 0
                          }
                          ]
                  }
          ]
  }
  
  

event routing


  
  ROUTE TIMER.fraction_changed TO OR_INT.set_fraction
  ROUTE TIMER.fraction_changed TO COLINT.set_fraction
  
  ROUTE OR_INT.value_changed TO ORCYL.setCylinderRotation
  ROUTE COLINT.value_changed TO ORCYL.setCylinderColor
  
  


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