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

proto-slide-element-block.vr

proto-slide-element-block.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  

block

Web3D/VR

info


  
  

  
  
  
  ##
  
  
  ##
  
  
  
  ##
  
  
  ##
  
  
  
  
  
  

block


  
  PROTO BlockElement [
      exposedField SFString   elementType "BLOCKELEMENT"
      exposedField SFVec3f    position    0 0 0
      exposedField SFBool     linebreak   FALSE
      
      exposedField SFBool     absolute    FALSE
      
      exposedField SFInt32    startLevel  -1
      exposedField SFInt32    endLevel    -1
      eventIn      SFInt32    showLevel
  
      exposedField SFString href        ""
  
      exposedField SFFloat    width       1
      exposedField SFFloat    height      1
  
      exposedField MFString   justify ["BEGIN"]
  
      exposedField SFVec3f    location    0 0 0
      exposedField SFRotation rotation    0 1 0 0
      exposedField SFVec3f    scale       1 1 1
      exposedField MFNode     block    []
  ] {
  

body


      Transform {
          translation IS position 
          children [
              DEF TRANSFORM Transform {
                  children [
                      Transform {
                          translation IS location
                          rotation    IS rotation
                          scale       IS scale
                          children    IS block
                      }
                  ]
              }
          ]
      }
  

script


      DEF SCRIPT Script {
          directOutput TRUE
          field SFFloat  width     IS  width
          field SFFloat  height    IS  height
          field SFNode   transform USE TRANSFORM
  
          field   MFNode  blocks           IS block
  
          field    SFInt32 endLevel         IS endLevel
          eventOut SFInt32 endLevel_changed IS endLevel
          eventIn  SFInt32 showLevel        IS showLevel
  
          field SFBool absolute IS absolute
  
          url "javascript:
              function initialize() {
                  if (!absolute) transform.translation = new SFVec3f(width/2,height/2,0);
                  var i = 0;
                  var maxLevel = 0;
                  for(i=0;i<blocks.length;i++) {
                      if(blocks[i].lastLevel > maxLevel) {
                          maxLevel = blocks[i].lastLevel;
                      }
                  }
                  endLevel         = maxLevel;
                  //endLevel         = -1;
                  endLevel_changed = maxLevel;
              }
              function showLevel(value,time) {
                  var i = 0;
                  for(i=0;i<blocks.length;i++) {
                      blocks[i].showLevel = value;
                  }
              }
          "
      }
  }
  
  
  


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