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

vr-example-life-1.vr (wrl /pl ) [ flux / bitmanagement / cortona / octaga ]


  
                  
  NavigationInfo {
          type "Examine"
  }
  
  Background{
          skyColor 0 0 0
  }
  
  PROTO MyViewPoint [ exposedField SFVec3f position 2.5 3 12
                                  exposedField SFRotation orientation 1 0 0 -0.2
                                  exposedField   SFBool set_bind  TRUE
  ]{ 
  Viewpoint { 
          position IS position
          orientation IS orientation
  } 
  }
  
  PROTO spot [ 
          exposedField SFVec3f translation 0 0 0 
          exposedField SFFloat transparency 0
  ]
  {
          Transform {
                  translation        IS translation
                  children [
                          DEF TS TouchSensor {}
                          Shape {
                                  appearance Appearance {
                                          material DEF boxTrans Material {
                                                  diffuseColor 1 1 1
                                              transparency IS        transparency
                                          }
                                  }
                                  geometry Box {
                                          size 0.8 0.8 0.8
                                  }
                          }        
                  ]
          }
  
          DEF trans Script {
      eventIn SFBool isClicked
          eventIn        SFFloat        transparency
      eventOut SFFloat trans_changed
  
      url "javascript:
                  function isClicked(value) {
                          if(value){
                                  if(transparency == 1)
                                           trans_changed = 0;
                                  else trans_changed = 1;
                          }
                  }
          "
  
  }
  
  ROUTE TS.isActive TO trans.isClicked
  ROUTE boxTrans.transparency TO trans.transparency
  ROUTE trans.trans_changed TO boxTrans.transparency
  }
  
  PROTO bar [ exposedField SFVec3f translation 0 0 0 
  ]{
          Transform {
                  translation        IS translation
                  children [
                                  Shape {
                                          appearance Appearance { 
                                                  material Material { 
                                                          diffuseColor 0 0 1
                                                  } 
                                          }
                                          geometry Box {size 0.1 0.4 0.2}
                                  }
                  ]
          }
  }
  
  PROTO arrow [] {
          Shape {
                  appearance Appearance {
                          material Material {
                                  diffuseColor 0 0 1
                          }
                  }
                  geometry IndexedFaceSet        {
                          coord Coordinate {
                                  point [ 0 -0.2 0.1,   0 0.2 0.1,   0.4 0.0 0.1
                                                  0 -0.2 -0.1, 0 0.2 -0.1,        0.4 0.0 -0.1 ]
                                  }
                                  coordIndex [0 2 1 -1
                                                          3 4 5 -1
                                                          1 4 3 0 -1
                                                          2 0 3 5 -1
                                                      1 2 5 4 -1 ]
                  }
          }
  }
  
  PROTO startbutton [
          exposedField SFVec3f translation 0 0 0
          eventOut SFBool        isActive 
  ]{
  
  Transform {
          translation IS translation
          children[
                  DEF startbutton TouchSensor {isActive IS isActive }
                  DEF        arrow arrow        {}
                  DEF        Bar bar { translation -0.15 0 0 }
          ]
  }
  }
  
  PROTO pausebutton [
          exposedField SFVec3f translation 0 0 0
          eventOut SFBool        isActive 
  
  ] {
  Transform {
          translation IS translation
          children[
                  DEF pausebutton TouchSensor {isActive IS isActive }
                  DEF        Bar bar         { translation 0 0 0 }
                  DEF        Bar1 bar { translation  0.15 0 0 }
          ]
  }
  }
  
  PROTO stopbutton [
          exposedField SFVec3f translation 0 0 0
          eventOut SFBool        isActive 
  ] {
  Transform {
          translation IS translation
          children[
                  DEF stopbutton TouchSensor {isActive IS isActive }
                  Shape {
                          appearance Appearance {
                                  material Material {
                                          diffuseColor 0 0 1
                                  }
                          }
                          geometry Box {
                                  size 0.4 0.4 0.2
                          }
                  }
          ]
  }
  }
                  
  PROTO enlarge [
          exposedField SFVec3f translation 0 0 0
          exposedField SFRotation        rotation 0 0 0 0
          exposedField SFBool        enabled TRUE
          eventOut SFBool isActive
  ] {
  Transform {
          translation        IS translation
          rotation IS        rotation
          children [
                  TouchSensor        { enabled IS enabled isActive IS isActive }
                  DEF        arrow arrow        {}
          ]
  }
  }
  
  PROTO life [exposedField SFVec3f translation 0 0 0
                          exposedField SFRotation        zRotation 0 0 0 0
                          exposedField SFRotation        yRotation 0 0 0 0
  ]
  {
  Transform {
          translation        IS translation
          rotation IS        zRotation
          children [
                  Transform {
                          rotation IS yRotation
                          children [
                                  Shape {
                                          appearance Appearance {
                                                  material Material {
                                                          diffuseColor 1 1 1
                                                  }
                                          }
                                          geometry Text {
                                                  string "The Game of Life"
                                                  fontStyle FontStyle        {
                                                          size 0.7
                                                  }
                                          }
                                  }
                          ]
                  }
          ]
  }
  }
   
  PROTO foot [
          exposedField SFVec3f translation 0 0 0
          exposedField SFRotation rotation 0 0 0 0
  
  ]{
  Transform {
          translation        IS translation
          rotation IS        rotation
          children [
  
                  Shape{
                          appearance Appearance {
                                  material Material {
                                          diffuseColor 0.4 0.4 0.4
                                  }
                          }
                          geometry IndexedFaceSet        {
                          coord Coordinate {
                                  point [ -3 0 3, 3 0 3, 3 0 -3, -3 0 -3,
                                                  -4 -1 4, 4 -1 4, 4 -1 -4, -4 -1 -4 ]
                                  }
                                  coordIndex [0 1 2 3 -1
                                                          7 6 5 4 -1
                                                          0 4 5 1 -1
                                                          3 7 4 0 -1
                                                      2 6 7 3 -1
                                                          1 5 6 2 -1 ]
                  }
                  }
          ]
  }
  }
  
  PROTO messageBox [
          exposedField SFVec3f translation 0 0 0
          exposedField MFString string "Click buttons to create world"
  ]{
          Transform {
                  translation        IS translation
                  children [
                          Shape {
                                  appearance Appearance {
                                          material Material {
                                                  diffuseColor 0.4 0.4 0.4
                                          }
                                  }
                                  geometry Box { size 6 0.75 0.2 }
                          }
                          Transform {
                                  translation        0 0 0.06
                                  children [
                          Shape {
                                  appearance Appearance {
                                          material Material {
                                                  diffuseColor 1 1 1
                                          }
                                  }
                                  geometry Box { size        5.8 0.55 0.1 }
                          }
                          ]}
                          DEF text Transform {
                                  translation        -2.75 -0.1 0.15
                                  children [
                          Shape {
                                  appearance Appearance {
                                          material Material {
                                                  diffuseColor 0 0 0
                                          }
                                  }
                                  geometry Text { 
                                          string IS string 
                                          fontStyle FontStyle {
                                                  size 0.35
                                                  family "TYPEWRITER"
                                                  style "BOLD"
                                          }
                                  }
                          }
                          ]}
                  ]
          }
  }
  
  DEF        Viewpoint MyViewPoint {}
  DEF bottom Transform {
          children [
  
  DEF        foot foot { translation 2 -1.5 0 }
  DEF        messageBox messageBox { translation        2 -1.125 2.9 }
  Transform {
          translation 0.5 -2 3.5
          rotation 1 0 0 -0.785
          children [
                  DEF        startbutton startbutton        { translation 1 0 0 }
                  DEF        stopbutton  stopbutton  { translation 0.25 0 0 }
                  DEF        pausebutton pausebutton        { translation -0.5 0 0 }
                  DEF        heightEnlarge enlarge {translation 3.25 0.25 0 rotation 0 0 1 1.57 }
                  DEF        widthEnlarge enlarge { translation 3.5 0 0 }
                  DEF        widthDecline enlarge { translation 3 0 0 rotation 0 0 1 3.14 }
                  DEF        heightDecline enlarge { translation        3.25 -0.25 0 rotation        0 0 1 -1.57 }
          ]
  }
  
  DEF        leftText life  { translation -1.51 -2 -2.25 yRotation 0 1 0 -1.57 zRotation 0 0 1 -0.785 }        
  DEF        rightText life { translation 5.51 -2 2.25   yRotation        0 1 0 1.57  zRotation 0 0 1 0.785 }
  DEF        backTex life   { translation 4.25 -2 -3.51          yRotation        0 1 0 3.14  zRotation 1 0 0 0.785 }
  ]}
  
  DEF        root Transform {
  children []}
    
  <phrase dir=b turn=0 id=_ level=_ right="haven t~nI seen this~nbefore?"/> 
  <phrase dir=b turn=0 id=_ level=_ left="I am glad~nyou re paying~nattention!!"> 
  <gesture dir=b id=_ level=_ right=0 pause=500/>    
  <gesture dir=b id=_ level=_ left=0 pause=600/>     
  
    
  
[] 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 _

(C) A. Eliëns 9/8/2006

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.