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-matrix-sharedobject.vr

extern-proto-matrix-sharedobject.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  #VRMLV2.0 utf8
  

proto-matrix-sharedobject

interface


  EXTERNPROTO SharedObject
  [
   exposedField    SFBool        isPilot
   exposedField    SFString      name
   exposedField    MFNode        children
   exposedField    SFVec3f       position
   exposedField    SFRotation     orientation
   eventIn         SFBool        set_isVisible
   eventOut        SFBool        isVisible_changed
   exposedField    MFString       url
   exposedField    SFBool        isAvatar
   exposedField    MFNode        states
  ]
  {
     Transform {
        translation IS position
        rotation IS orientation
        children [
           DEF Visible Switch {
              whichChoice 0
              choice [
                 Transform {
                    rotation 0 1 0 3.141592 # to compensate for Camera direction
                    children IS children
                 }
                ]
           }
           Group {
              children IS states
           }
           DEF Control Script {
              eventIn   SFBool   set_isVisible IS set_isVisible
              eventOut  SFBool   isVisible_changed IS isVisible_changed
              eventOut  SFInt32  choice
  
              mustEvaluate TRUE
  
              url "javascript:
        function set_isVisible( value ){
          isVisible_changed = value;
          if( value == true ){
            choice = 0;
          } else {
            choice = -1;
          }
        }"
           }
          ]
     }
     ROUTE Control.choice TO Visible.set_whichChoice
  }
  


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