InitialObjectDescriptor {
 objectDescriptorID 1
 audioProfileLevelIndication 255
 visualProfileLevelIndication 254
 sceneProfileLevelIndication 1
 graphicsProfileLevelIndication 1
 ODProfileLevelIndication 1
 esDescr [
  ES_Descriptor {
   ES_ID 1
   decConfigDescr DecoderConfigDescriptor {
    streamType 3
    decSpecificInfo BIFSConfig {
     isCommandStream true
     pixelMetric true
     pixelWidth 600
     pixelHeight 600
    }
   }
  }
  ES_Descriptor {
   ES_ID 2
   decConfigDescr DecoderConfigDescriptor {
    streamType 1
   }
  }
 ]
}

OrderedGroup {
 children [
  Background2D {
   backColor 1 1 1
  }
  WorldInfo {
   info [
    "This test shows usage of the InputSensor node to detect keys and trigger of events"
    "The InputSensor in this case has a url which points to a specific pseudo-media object. This object contains one stream, called interaction stream."
    "This stream is made of Device Data Frame whose content is specialized depending on the kind of input device."
    "The InputSensor node in the scene specifies how to dispatch the content of the DDF."
    "For each piece of information in the DDF, a REPLACE command is associated."
    "The value of the target property is replaced by the associated content from the DDF."
    "" 
    "If the configuration of the stream says 'MouseSensor', like here, the input device is a mouse and the DDF content is as follows:"
    "- the mouse position," 
    "- the status of the left button," 
    "- the status of the middle button," 
    "- the status of the right button," 
    "- and the status of the wheel." 
    "This configuration allows doing different things than the TouchSensor because the TouchSensor cannot give information about the buttons, or the wheel. On the other hand, it can be triggered based on sibling geometry, which is not the case of the InputSensor node in MouseSensor mode." 
    "In this example, the result of the InputSensor node triggers ECMAScript actions." 
    "" 
    "GPAC Regression Tests" "$Date: 2007-07-27 09:46:07 $ - $Revision: 1.3 $" 
    "(C) 2002-2006 GPAC Team"
   ]
   title "InputSensor Node for mouse events (MouseSensor)"
  }
  Transform2D {
   translation -120 -100
   children [
    Shape {
     appearance DEF APP Appearance {
      material Material2D {
       emissiveColor 0 0 0
       filled TRUE
      }
     }
     geometry DEF TXT1 Text {
      string ["Left Down" ""]
      fontStyle DEF FS FontStyle {
       justify ["MIDDLE"]
       size 20
      }
     }
    }
   ]
  }
  Transform2D {
   translation 0 -100
   children [
    Shape {
     appearance USE APP
     geometry DEF TXT2 Text {
      string ["Middle Down" ""]
      fontStyle USE FS
     }
    }
   ]
  }
  Transform2D {
   translation 120 -100
   children [
    Shape {
     appearance USE APP
     geometry DEF TXT3 Text {
      string ["Right Down" ""]
      fontStyle USE FS
     }
    }
   ]
  }
  Transform2D {
   translation 0 -150
   children [
    Shape {
     appearance USE APP
     geometry DEF TXT4 Text {
      string [""]
      fontStyle USE FS
     }
    }
   ]
  }
  DEF SC Script {
   eventIn SFBool set_left
   eventIn SFBool set_middle
   eventIn SFBool set_right
   eventIn SFFloat set_wheel
   field SFFloat wheel_pos 0
   field SFNode t1 USE TXT1
   field SFNode t2 USE TXT2
   field SFNode t3 USE TXT3
   field SFNode t4 USE TXT4
   url ["javascript:function set_left(value, timestamp) {t1.string[1] = '' + value;}function set_middle(value, timestamp) {t2.string[1] = '' + value;}function set_right(value, timestamp) {t3.string[1] = '' + value;}function set_wheel(value, timestamp) {wheel_pos += value;t4.string[0] = 'Wheel Pos ' + wheel_pos;}"   ]
  }
  DEF TR Transform2D {
   children [
    Shape {
     appearance Appearance {
      texture ImageTexture {
       url [od:2]
      }
     }
     geometry Bitmap {}

    }
   ]
  }
  InputSensor {
   url [od:10]
   buffer {
    REPLACE TR.translation BY 0 0
    REPLACE SC.set_left BY FALSE
    REPLACE SC.set_middle BY FALSE
    REPLACE SC.set_right BY FALSE
    REPLACE SC.set_wheel BY 0
   }
  }
 ]
}


AT 0 {
  UPDATE OD [
   ObjectDescriptor {
    objectDescriptorID 2
    esDescr [
     ES_Descriptor {
      ES_ID 3
      muxInfo MuxInfo {
       fileName "../auxiliary_files/logo.png"
      }
     }
    ]
   }
   ObjectDescriptor {
    objectDescriptorID 10
    esDescr [
     ES_Descriptor {
      ES_ID 5
      decConfigDescr DecoderConfigDescriptor {
       streamType 10
       decSpecificInfo UIConfig {
        deviceName "Mouse"
       }
      }
     }
    ]
   }
  ]
}

