InitialObjectDescriptor {
  objectDescriptorID 1
  ODProfileLevelIndication 0xFF
  sceneProfileLevelIndication 0xFE
  audioProfileLevelIndication 0xFF
  visualProfileLevelIndication 0xFF
  graphicsProfileLevelIndication 0xFE

  esdescr [
    ES_Descriptor {
      es_id 1
      decConfigDescr DecoderConfigDescriptor {
				streamType 3
				decSpecificInfo BIFSConfig {
				  isCommandStream true
				  pixelMetric true
				  pixelWidth 200
				  pixelHeight 200
				}
      }
    }
  ]
}

Group { 
 children [
  WorldInfo {
   title "Viewpoint bind test"
   info ["This shows sensors triggering viewpoint binding" "Viewpoint switching shall not be animated" "" "GPAC Regression Tests" "$Date: 2007-07-27 09:46:08 $ - $Revision: 1.2 $" "(C) 2002-2004 GPAC Team"]
  }

	DEF VP1 Viewpoint {description "Front View" position 0 0 300}
	DEF VP2 Viewpoint {description "Above View" position 0 300 30 orientation 1 0 0 -1.2 }
	
	DEF TR Transform {
  	translation 50 0 0
  	children [
     Shape {
     	appearance Appearance {
     		material Material {
     			diffuseColor 0 1 1
     		}
     	}
      geometry DEF BOX Box {size 50 50 50}
     }
     DEF TS2 TouchSensor {}
  	]
  }
	
  Transform {
  	translation -80 0 20
  	children [
     Shape {
     	appearance Appearance {
     		material Material2D { emissiveColor 1 0 0 filled TRUE }
     	}
      geometry DEF RC_RED Rectangle {size 100 100}
     }
  	]
  }

	Shape {
		appearance Appearance {
			material Material2D { emissiveColor 1 1 1 filled TRUE }
		}
		geometry DEF RC_WHITE Rectangle { size 200 200 }
	}
		

  Transform {
  	translation -30 0 0
  	children [
     Shape {
     	appearance Appearance {
     		material DEF MAT Material {
     			diffuseColor 1 1 0
     		}
     	}
      geometry DEF SPHERE Sphere {radius 30}
     }
     DEF TOUCH TouchSensor {}
    ]
  }
  DEF TS TimeSensor { enabled FALSE cycleInterval 2.0 loop TRUE }
  DEF OI OrientationInterpolator  {
  	key [0 0.5 1]
  	keyValue [1 1 1 0, 1 1 1 3.14, 1 1 1 6.26]
 	}
 	
 	DEF C Conditional { buffer { REPLACE MAT.diffuseColor BY 0 0 1 } }
 	DEF RC Conditional { buffer { REPLACE MAT.diffuseColor BY 1 1 0 } }

  DEF SETVP1 Conditional {
  	buffer {
  		REPLACE VP1.set_bind BY TRUE
  		REPLACE ROUTE MVP BY TOUCH.isActive TO SETVP2.activate
  	}
  }
  DEF SETVP2 Conditional {
  	buffer {
  		REPLACE VP2.set_bind BY TRUE
  		REPLACE ROUTE MVP BY TOUCH.isActive TO SETVP1.activate
  	}
  }

 ]
}

DEF MVP ROUTE TOUCH.isActive TO SETVP2.activate
ROUTE TOUCH.isOver TO TS.enabled
ROUTE TS.fraction_changed TO OI.set_fraction
ROUTE OI.value_changed TO TR.rotation
ROUTE TS2.isActive TO C.activate
ROUTE TS2.isActive TO RC.reverseActivate
