Web3D/VRML
[] readme course preface 1 2 3 4 5 6 7 reference examples resources

talk show tell print

x-nurb-anim.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

animated nurb

scene


  
  WorldInfo 
  {
          title "Simple NurbsSurface"
          info "NurbsSurface with CV-Animation"
  }
  
  NavigationInfo {
          type ["EXAMINE","ANY"]
  
  }
  
  

extern proto


  
  EXTERNPROTO NurbsSurface [
  field        SFInt32  uDimension 
  field        SFInt32  vDimension 
  field        MFFloat  uKnot  
  field        MFFloat  vKnot 
  field        SFInt32  uOrder 
  field        SFInt32  vOrder 
  exposedField MFVec3f  controlPoint
  exposedField MFFloat  weight
  exposedField SFInt32  uTessellation
  exposedField SFInt32  vTessellation
  exposedField SFNode   texCoord
  field        SFBool   ccw
  field        SFBool   solid
  ]
  [
          "urn:inet:blaxxun.com:node:NurbsSurface",
          "nurbs.wrl#NurbsSurface"  # for local testing
          "http://www.blaxxun.com/vrml/protos/nurbs.wrl#NurbsSurface"
  ]
  
  

transform root


  
  Transform {
  translation -1.5 -1.5 0
  children [
          Shape { 
                  geometry DEF nurb NurbsSurface {
                          uOrder 4 
                          vOrder 4 
                          uTessellation 50
                          uTessellation 51
                          uDimension 4 
                          vDimension 4 
                          controlPoint[ 0 0 0, 1 0 0, 2 0 0, 3 0 0,
                                           0 1 0, 1 1 0, 2 1 0, 3 1 0, 
                                        0 2 0, 1 2 0, 2 2 0, 3 2 0, 
                                               0 3 0, 1 3 0, 2 3 0, 3 3 0]
                           }
  
  

appearance


                          appearance Appearance {
                              material Material { 
                                                            diffuseColor 0 0 1 
                                                            emissiveColor 1 0 0
                                          }  
                                          texture ImageTexture {url "alchemy.gif"}
                                       }
          }        
  ]
  }
  
  

animation script


  DEF animate Script { 
      eventIn SFFloat setTime
          field SFNode nurb USE nurb 
          directOutput TRUE
      url "javascript:
          function setTime(value) {
                          nurb.controlPoint[3].z = 5*Math.sin(value*2*Math.PI);                
                          nurb.controlPoint[10].z = 10*Math.sin(value*2*Math.PI);                
                          nurb.controlPoint[14].z = 5*Math.sin(value*2*Math.PI);                
          }
      "        
  }
  
  

routing


  
  DEF TimeSource TimeSensor { cycleInterval 2.0 loop TRUE} 
  
  ROUTE TimeSource.fraction_changed TO animate.setTime
  


[] readme course preface 1 2 3 4 5 6 7 reference examples resources
eliens@cs.vu.nl

draft version 0.3 (17/9/2001)