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

object-dam.vr

object-dam.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

extern


  
  #@proto proto-rif-interface-arm.vr
  #@proto proto-rif-interface-window.vr
  #@proto proto-rif-interface-picture.vr
  
  #@proto proto-rif-interface-wheel.vr
  #@proto proto-rif-interface-toggle.vr
  
  #@extern extern-blaxxun-HUD.vr
  #@extern extern-blaxxun-Layer3D.vr
  
  
  
  
  Transform {
  
  children [
  DirectionalLight { }
  PointLight {
    location -20 30 20
    on TRUE
    intensity 1
    ambientIntensity .75
    color 1 1 1
  }
  
  NavigationInfo { headlight  TRUE type       "WALK" }
  
  Background { skyColor [.6 .6 1] }
  
  DEF INITIAL Viewpoint { description  "Initial Viewpoint" position 0 1.70 0 }
  
  DEF PHOTO_1 Viewpoint {
      description  "Photograph nr 1"
      position    70.2596 1.6 -173.214
      orientation 0.00130031 0.993692 -0.112138 3.11854
  #    position    -56.6681 2.2843 15.2004
  #    orientation 0.115788 -0.987286 0.108899 1.61764
  }
  
  DEF PHOTO_2 Viewpoint {
      description  "Photograph nr 2"
      position    -46.4928 29.1499 41.4216
      orientation 0 -1 0 0.691544
  }
  
  DEF PHOTO_3 Viewpoint {
      description  "Photograph nr 3"
      position    -23.9646 12.7 -9.93549
      orientation 0 -1 0 1.65804
  }
  
  Transform {
      rotation    0 1 0 4.712
      translation 103 0 -14.5
      children [
      <inline src=object/rif/dam/Kerk.wrl/>
      ]
  }
  
  Transform {
      rotation    0 -1 0 0.4948
      translation 37 0 -75
      children [
      <inline src=object/rif/dam/Paleis.wrl/>
      ]
  }
  
  Transform {
      rotation    0 1 0 4.70798
      translation 43.4853 0 16.778
      children [
      <inline src=object/rif/dam/No_FloorPalaceChurchMonument.wrl/>
      ]
  }
  
  DEF FLOOR Shape { 
      appearance Appearance { 
          material Material { diffuseColor  0.2 0.5 0.2 } 
          texture  ImageTexture { url "object/rif/dam/overhead.jpg" }
      } 
      geometry IndexedFaceSet { 
          coord Coordinate { 
              point [ -200 0  200, 200 0  200, -200 0 -200, 200 0 -200] 
          } 
          coordIndex [ 2, 0, 1, 3, -1 ] 
          texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1 ] }
          texCoordIndex [ 0, 1, 2, 3, -1]
      } 
  }
  
  
  HUD {
      children [
      Transform {
      scale 1 0.5 1
      children [
          SwingingArm {
              translation 2 -0.6 -2
              armLength   1
              children [
                  Window {
                      title        "Paintings"
                      touchEnabled FALSE
                      size         2 0.5
                      children [
                          DEF PICTURE_1 Picture {
                              position -0.70 0.0
                              size      0.5  0.4 
                              texture  "object/rif/dam/Photos/Photo1.jpg"
                              touchEnabled TRUE
                          }
                          DEF PICTURE_2 Picture {
                              position -0.15 0.0
                              size      0.5  0.4 
                              texture  "object/rif/dam/Photos/Photo2.jpg"
                              touchEnabled TRUE
                          }
                          DEF PICTURE_3 Picture {
                              position  0.4  0.0
                              size      0.5  0.4 
                              texture  "object/rif/dam/Photos/Photo3.jpg"
                              touchEnabled TRUE
                          }
                          DEF WHEEL Wheel {
                              position     0.85  0.05
                              size         0.2   0.2 
                              texture      "object/rif/dam/wheel.gif"
                              value        0.5
                          }
                          DEF TOGGLE Toggle {
                              position     0.85 -0.15
                              size         0.2   0.1 
                              texture_on   "object/rif/dam/toggle_on.gif"
                              texture_off  "object/rif/dam/toggle_off.gif"
                          }
                      ]
                  }
              ]
          }
  
          DEF HUD_PICTURE Switch {
              choice Transform {
                  scale       1.5 2 1
                  translation 0 0 -3
                  children [
                      PointLight { }
                      Shape {
                      appearance Appearance {
                          material DEF HUD_MATERIAL Material { transparency 0.2  }
                          texture  DEF HUD_TEXTURE  ImageTexture { }
                      }
                      geometry IndexedFaceSet {
                          coord Coordinate {
                              point [ -1  1 0,  -1  -1 0,  1  -1 0,  1  1 0 ]
                          }
                          coordIndex [ 0, 1, 2, 3, -1 ]
                          texCoord TextureCoordinate { 
                              point [ 0 1, 0 0, 1 0, 1 1 ] 
                          }
                          texCoordIndex [ 0, 1, 2, 3, -1]
                      }
                  } ]
              }
          }
      ] } ## Transform
      ]
  }
  
  
  
  DEF CYCLE Script {
      directOutput TRUE
      eventIn SFTime   next
      eventIn SFTime   toggle
      eventIn SFTime   setPicture1
      eventIn SFTime   setPicture2
      eventIn SFTime   setPicture3
  
      field   SFNode   texture USE HUD_TEXTURE
      field   SFNode   hudPicture USE HUD_PICTURE
      field   MFString mfstr  []
      field   MFString photos ["object/rif/dam/Photos/Photo1.jpg",
                               "object/rif/dam/Photos/Photo2.jpg",
                               "object/rif/dam/Photos/Photo3.jpg"]
      field   MFString viewss  ["PHOTO_1",
                                "PHOTO_2",
                                "PHOTO_3",
                                "INITIAL"]
      field   MFNode   views  [USE PHOTO_1,
                               USE PHOTO_2,
                               USE PHOTO_3,
                               USE INITIAL]
      field   SFInt32  active 3   
  
      eventOut SFNode  goTo
   
      url "vrmlscript:
          function initialize() {
              //Browser.print('Virtual DAM online...');
              Browser.setViewpointAnimation(TRUE);
          }
          function setPicture(nr,time) {
              active      = nr-1;
              goTo        = views[active];
              mfstr[0]    = photos[active];
              texture.url = mfstr; 
  
  //            if(hudPicture.whichChoice == -1) {
  //                hudPicture.whichChoice = 0;
  //            } 
          }
          function setPicture1(value,time) {
              setPicture(1,time);
          }
          function setPicture2(value,time) {
              setPicture(2,time);
          }
          function setPicture3(value,time) {
              setPicture(3,time);
          }
          function toggle(value,time) {
              if(hudPicture.whichChoice == -1) {
                  hudPicture.whichChoice = 0;
              } else {
                  hudPicture.whichChoice = -1;
              }
          }
          function next(value,time) {
              active = active + 1;
              if(active == 3) {
                  goTo                   = views[active];
                  hudPicture.whichChoice = -1;
                  return;
              }
              if(active == 4) {
                  active                 = 0;
                  hudPicture.whichChoice = 0;
              }
              goTo        = views[active];
              mfstr[0]    = photos[active];
              texture.url = mfstr; 
          }
      "
  }
  
  DEF TIME_SENSOR TimeSensor { cycleInterval 2 }
  DEF POS_INTERP  PositionInterpolator {}
  DEF ROT_INTERP  OrientationInterpolator {}
  DEF VIEWPOINT   Viewpoint {}
  ROUTE TIME_SENSOR.fraction_changed TO POS_INTERP.set_fraction
  ROUTE TIME_SENSOR.fraction_changed TO ROT_INTERP.set_fraction
  ROUTE POS_INTERP.value_changed     TO VIEWPOINT.set_position
  ROUTE ROT_INTERP.value_changed     TO VIEWPOINT.set_orientation
  
  ROUTE PICTURE_1.touchTime TO CYCLE.setPicture1
  ROUTE PICTURE_2.touchTime TO CYCLE.setPicture2
  ROUTE PICTURE_3.touchTime TO CYCLE.setPicture3
  ROUTE TOGGLE.switch       TO HUD_PICTURE.whichChoice
  ROUTE WHEEL.value         TO HUD_MATERIAL.set_transparency
  
  DEF GOTO_VIEWPOINT Script {
      directOutput TRUE
  
      eventIn  SFNode goTo
      field    SFNode temp      NULL
  
      field    SFNode timer     USE TIME_SENSOR
      field    SFNode posInterp USE POS_INTERP
      field    SFNode rotInterp USE ROT_INTERP
      field    SFNode viewpoint USE VIEWPOINT
  
      field    MFFloat    mfflt []
      field    MFRotation mfrot []
      field    MFVec3f    mfpos []
  
      url "vrmlscript:
          function goTo(value,time) {
              temp = value;
  
              mfflt[0] = 0.0;
              mfflt[1] = 1.0;
              posInterp.set_key = mfflt;
              mfpos[0] = Browser.viewpointPosition;
              mfpos[1] = value.position;
              posInterp.set_keyValue = mfpos;
  
              rotInterp.set_key = mfflt;
              mfrot[0] = Browser.viewpointOrientation;
              mfrot[1] = value.orientation;
              rotInterp.set_keyValue = mfrot;
  
              viewpoint.position    = Browser.viewpointPosition;
              viewpoint.orientation = Browser.viewpointOrientation;
              viewpoint.set_bind    = TRUE;
              
              timer.startTime = time + 0.1;
          }
      "
      
  }
  
  # ROUTE INPUTHANDLER.next   TO CYCLE.next
  # ROUTE INPUTHANDLER.toggle TO CYCLE.toggle
  ROUTE CYCLE.goTo          TO GOTO_VIEWPOINT.goTo
  ] } ## 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.