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 400
     pixelHeight 400
    }
   }
  }
 ]
}

PROTO PaletteElement [
 exposedField SFVec2f translation 0 0
 exposedField SFVec2f scale 1 1
 exposedField SFColor color 0 0 0
 exposedField SFFloat proto_ident 0
 eventOut SFBool isOver
 eventOut SFInt32 active_proto
] {
 Transform2D {
  scale IS scale
  translation IS translation
  children [
   DEF TS TouchSensor {
    isOver IS isOver
   }
   Shape {
    appearance Appearance {
     material Material2D {
      emissiveColor IS color
      filled TRUE
      lineProps LineProperties {
       width 3
      }
     }
    }
    geometry IndexedFaceSet2D {
     coordIndex [0 1 2 3 4 5 -1]
     coord Coordinate2D {
      point [100 0 50 86.6 -50 86.6 -100 0 -50 -86.6 50 -86.6]
     }
    }
   }
  ]
 }
 DEF V Valuator {
  outSFInt32 IS active_proto
  Factor1 0
  Factor2 0
  Factor3 0
  Factor4 0
  Offset1 IS proto_ident
 }
 ROUTE TS.isActive TO V.inSFBool
}
PROTO Palette [
 exposedField SFVec2f translation 0 0
 exposedField SFVec2f scale 1 1
 eventOut SFColor selectedColor
 eventOut MFString active
] {
 DEF TR Transform2D {
  scale IS scale
  translation IS translation
  children [
   DEF RedPaletteElement PaletteElement {
    color 1 0 0
    proto_ident 1
   }
   DEF GreenPaletteElement PaletteElement {
    translation 150 86.6
    color 0 1 0
    proto_ident 2
   }
   DEF BluePaletteElement PaletteElement {
    translation -150 86.6
    color 0 0 1
    proto_ident 3
   }
  ]
 }
 DEF ColorValuator Valuator {
  outSFColor IS selectedColor
 }
 DEF RConditional Conditional {
  buffer {
   REPLACE ColorValuator.inSFColor BY 1 0 0
  }
 }
 DEF GConditional Conditional {
  buffer {
   REPLACE ColorValuator.inSFColor BY 0 1 0
  }
 }
 DEF BConditional Conditional {
  buffer {
   REPLACE ColorValuator.inSFColor BY 0 0 1
  }
 }
 DEF V2 Valuator {
  outMFString IS active
 }
 ROUTE RedPaletteElement.isOver TO RConditional.activate
 ROUTE GreenPaletteElement.isOver TO GConditional.activate
 ROUTE BluePaletteElement.isOver TO BConditional.activate
 ROUTE RedPaletteElement.active_proto TO V2.inSFInt32
 ROUTE GreenPaletteElement.active_proto TO V2.inSFInt32
 ROUTE BluePaletteElement.active_proto TO V2.inSFInt32
}
OrderedGroup {
 children [
  Background2D {
   backColor 1 1 1
  }
  WorldInfo {
   info ["This shows a Proto using Protos" "Each palette element is a proto" "The whole palette is another proto" "with routes and conditionals" "" "GPAC Regression Tests" "$Date: 2007-07-27 09:46:10 $ - $Revision: 1.2 $" "(C) 2002-2004 GPAC Team"]
   title "Nested Proto test"
  }
  Transform2D {
   translation 0 100
   children [
    Shape {
     appearance Appearance {
      material DEF Material2DNode Material2D {
       filled TRUE
       lineProps LineProperties {
        width 3
       }
      }
     }
     geometry Rectangle {
      size 10 10
     }
    }
   ]
  }
  Transform2D {
   scale 0.5 0.5
   translation 0 -50
   children [
    DEF P Palette {}
   ]
  }
  Transform2D {
   translation 0 50
   children [
    Shape {
     appearance Appearance {
      material Material2D {
       emissiveColor 0 0 0
       filled TRUE
      }
     }
     geometry DEF TXT Text {
      string ["Active Palette"]
      fontStyle FontStyle {
       size 20
      }
     }
    }
   ]
  }
 ]
}

ROUTE P.selectedColor TO Material2DNode.emissiveColor
ROUTE P.active TO TXT.string

