<toolconfig>

  <rawdevices>
    <rawdevice id="Keyboard" type="de.jreality.toolsystem.raw.DeviceKeyboard"/>
    <rawdevice id="KeyboardSWT" type="de.jreality.toolsystem.raw.DeviceKeyboardSWT"/>
    <rawdevice id="Mouse" type="de.jreality.toolsystem.raw.DeviceMouse"/>
    <rawdevice id="Mouse" type="de.jreality.toolsystem.raw.DeviceMouseSWT"/>
    <rawdevice id="SystemTimer" type="de.jreality.toolsystem.raw.DeviceSystemTimer"/>
    <!--rawdevice id="Joystick" type="de.jreality.toolsystem.raw.DeviceJoystick"/-->
  </rawdevices>

  <rawslots>

  <!-- map slots of raw devices to InputSlots -->
  
    <mapping device="Keyboard" src="VK_SPACE" target="JumpActivation"/>
    <mapping device="KeyboardSWT" src="32" target="JumpActivation"/>
    
    <mapping device="Keyboard" src="VK_SHIFT" target="Secondary"/>
    <mapping device="KeyboardSWT" src="131072" target="Secondary"/> <!-- SPACE -->
    
    <mapping device="Keyboard" src="VK_CONTROL" target="Meta"/>
    <mapping device="KeyboardSWT" src="262144" target="Meta"/>

    <mapping device="Keyboard" src="VK_W" target="forward"/>
    <mapping device="Keyboard" src="VK_A" target="left"/>
    <mapping device="Keyboard" src="VK_S" target="backward"/>
    <mapping device="Keyboard" src="VK_D" target="right"/>
    <mapping device="KeyboardSWT" src="119" target="forward"/>
    <mapping device="KeyboardSWT" src="97" target="left"/>
    <mapping device="KeyboardSWT" src="115" target="backward"/>
    <mapping device="KeyboardSWT" src="100" target="right"/>

    <mapping device="Keyboard" src="VK_E" target="EncompassActivation"/>
    <mapping device="KeyboardSWT" src="101" target="EncompassActivation"/>

    <mapping device="Keyboard" src="VK_L" target="LookSwitch"/>
    <mapping device="KeyboardSWT" src="108" target="LookSwitch"/>

    <mapping device="Keyboard" src="VK_R" target="DrawPickActivation"/>
    <mapping device="Keyboard" src="VK_P" target="ShowPick"/>
    <mapping device="Keyboard" src="VK_0" target="IncreaseSpeed"/>
    <mapping device="Keyboard" src="VK_9" target="DecreaseSpeed"/>
    <mapping device="Mouse" src="left" target="PrimaryAction"/>
    <mapping device="Mouse" src="right" target="PrimarySelection"/>
    <mapping device="Mouse" src="center" target="PrimaryMenu"/>
    <mapping device="Mouse" src="wheel_up" target="PrimaryUp"/>
    <mapping device="Mouse" src="wheel_down" target="PrimaryDown"/>
    <mapping device="Mouse" src="axes" target="PointerNDC"/>
    <mapping device="Mouse" src="axesEvolution" target="PointerNDCevolution"/>
    
    <mapping device="SystemTimer" src="tick" target="SystemTime"/>

    <!--mapping device="Joystick" src="axis_1" target="ForwardBackwardAxis"/>
    <mapping device="Joystick" src="axis_0" target="RightLeftAxis"/>
    <mapping device="Joystick" src="button_0" target="IncreaseSpeed"/>
    <mapping device="Joystick" src="button_1" target="DecreaseSpeed"/-->
  </rawslots>
  
  
  <virtualdevices>
  
    <mapping src="PrimarySelection" target="ShowPanel"/>
    <mapping src="PrimaryAction" target="RotateActivation"/>
    <mapping src="PrimaryAction" target="PointDragActivation"/>
    <mapping src="PrimaryMenu" target="DragActivation"/>
    <mapping src="PrimarySelection" target="ScaleActivation"/>

    <mapping src="Meta" target="Accelertation"/>
    <mapping src="Meta" target="DragAlongViewDirection"/>
    
    <mapping src="PointerNdcXevolution" target="HorizontalShipRotationAngleEvolution"/>
    <mapping src="PointerNdcXevolution" target="ScaleAxis"/>
    <mapping src="PointerNdcYevolution" target="VerticalShipRotationAngleEvolution"/>
    <mapping src="PointerNdcYevolution" target="VerticalHeadRotationAngleEvolution"/>
    
    <constant name="FollowPointerSwitch">
      <object class="java.lang.Double">
        <double>0</double>
      </object>
    </constant>
    
    <!--constant name="ConstantTrafo">
      <array class="double" length="16">
        <void index="0"><double>1</double></void>
        <void index="1"><double>0</double></void>
        <void index="2"><double>0</double></void>
        <void index="3"><double>3</double></void>
        <void index="4"><double>0</double></void>
        <void index="5"><double>1</double></void>
        <void index="6"><double>0</double></void>
        <void index="7"><double>3</double></void>
        <void index="8"><double>0</double></void>
        <void index="9"><double>0</double></void>
        <void index="10"><double>1</double></void>
        <void index="11"><double>3</double></void>
        <void index="12"><double>0</double></void>
        <void index="13"><double>0</double></void>
        <void index="14"><double>0</double></void>
        <void index="15"><double>1</double></void>
      </array>
    </constant-->

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualSwitchAndInvertAxis">
      <inputslot>LookSwitch</inputslot>
      <inputslot>PrimarySelection</inputslot>
      <outputslot>ShipRotateActivation</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualCoupledAxis">
      <inputslot>PrimaryAction</inputslot>
      <inputslot>Secondary</inputslot>
      <outputslot>SecondaryAction</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualCoupledAxis">
      <inputslot>PrimarySelection</inputslot>
      <inputslot>Secondary</inputslot>
      <outputslot>SecondarySelection</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualCoupledAxis">
      <inputslot>PrimaryMenu</inputslot>
      <inputslot>Secondary</inputslot>
      <outputslot>SecondaryMenu</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMap">
      <inputslot>PrimaryAction</inputslot>
      <outputslot>PickShowActivation</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualInvertMatrix">
      <inputslot>CameraToNDC</inputslot>
      <outputslot>NDCToCamera</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualInvertMatrix">
      <inputslot>WorldToCamera</inputslot>
      <outputslot>CameraToWorld</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualProductMatrix">
      <inputslot>CameraToNDC</inputslot>
      <inputslot>WorldToCamera</inputslot>
      <outputslot>WorldToNDC</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualProductMatrix">
      <inputslot>CameraToWorld</inputslot>
      <inputslot>NDCToCamera</inputslot>
      <outputslot>NDCToWorld</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMousePointerTrafo">
      <inputslot>NDCToWorld</inputslot>
      <inputslot>PointerNDC</inputslot>
      <outputslot>PointerTransformation</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualInvertMatrix">
      <inputslot>AvatarTransformation</inputslot>
      <outputslot>AvatarInverseTransformation</outputslot>
    </virtualdevice>    
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualProductMatrix">
      <inputslot>AvatarInverseTransformation</inputslot>
      <inputslot>PointerTransformation</inputslot>
      <outputslot>PointerShipTransformation</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualExtractTranslationTrafo">
      <inputslot>PointerTransformation</inputslot>
      <outputslot>PointerTranslation</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualEvolutionOperator">
      <inputslot>PointerTranslation</inputslot>
      <outputslot>DeltaTranslation</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMergedAxis">
      <inputslot>forward</inputslot>
      <inputslot>backward</inputslot>
      <outputslot>ForwardBackwardAxis</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMergedAxis">
      <inputslot>right</inputslot>
      <inputslot>left</inputslot>
      <outputslot>LeftRightAxis</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualReverseAxis">
      <inputslot>LeftRightAxis</inputslot>
      <outputslot>RightLeftAxis</outputslot>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualRotation">
      <inputslot>PointerNDC</inputslot>
      <inputslot>CameraToWorld</inputslot>
      <outputslot>TrackballTransformation</outputslot>
      <prop name="gain">
        <double>3.14</double>
      </prop>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualEvolutionOperator">
      <inputslot>PointerTransformation</inputslot>
      <outputslot>PointerEvolution</outputslot>
    </virtualdevice>
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualExtractAxis">
      <inputslot>PointerNDC</inputslot>
      <outputslot>PointerNdcX</outputslot>
      <prop name="axis">
        <string>translationX</string>
      </prop>
    </virtualdevice>

    <!-- virtualdevice type="de.jreality.toolsystem.virtual.VirtualEvolutionOperator">
      <inputslot>PointerNdcX</inputslot>
      <outputslot>PointerNdcXevolution</outputslot>
      <prop name="slottype">
        <string>axis</string>
      </prop>
    </virtualdevice -->

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualExtractAxis">
      <inputslot>PointerNDCevolution</inputslot>
      <outputslot>PointerNdcXevolution</outputslot>
      <prop name="axis">
        <string>translationX</string>
      </prop>
    </virtualdevice>

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualExtractAxis">
      <inputslot>PointerNDC</inputslot>
      <outputslot>PointerNdcY</outputslot>
      <prop name="axis">
        <string>translationY</string>
      </prop>
    </virtualdevice>

    <!-- virtualdevice type="de.jreality.toolsystem.virtual.VirtualEvolutionOperator">
      <inputslot>PointerNdcY</inputslot>
      <outputslot>PointerNdcYevolution</outputslot>
      <prop name="slottype">
        <string>axis</string>
      </prop>
    </virtualdevice -->

    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualExtractAxis">
      <inputslot>PointerNDCevolution</inputslot>
      <outputslot>PointerNdcYevolution</outputslot>
      <prop name="axis">
        <string>translationY</string>
      </prop>
    </virtualdevice>

    <!-- big example for passing config properties -->
    
    <virtualdevice type="de.jreality.toolsystem.virtual.VirtualMap">
      <inputslot>PrimaryUp</inputslot>
      <outputslot>FooSlot</outputslot>
      <!-- example of how to pass a string -->
      <prop name="foo">
        <string>bla</string>
      </prop>
      <!-- example of how to pass an int-->
      <prop name="bar">
        <int>42</int>
      </prop>
      <!-- example of how to pass a double -->
      <prop name="baz">
        <double>3.14</double>
      </prop>
      <!-- example of how to pass a color -->
      <prop name="coolColor">
        <object class="java.awt.Color">
          <int>123</int>
          <int>55</int>
          <int>76</int>
          <int>200</int>
        </object>
      </prop>
      <!-- example of how to pass a matrix -->
      <prop name="matrix">
        <object class="de.jreality.math.Matrix">
          <array class="double" length="16">
            <void index="0"><double>1</double></void>
            <void index="1"><double>0</double></void>
            <void index="2"><double>0</double></void>
            <void index="3"><double>3</double></void>
            <void index="4"><double>0</double></void>
            <void index="5"><double>1</double></void>
            <void index="6"><double>0</double></void>
            <void index="7"><double>3</double></void>
            <void index="8"><double>0</double></void>
            <void index="9"><double>0</double></void>
            <void index="10"><double>1</double></void>
            <void index="11"><double>3</double></void>
            <void index="12"><double>0</double></void>
            <void index="13"><double>0</double></void>
            <void index="14"><double>0</double></void>
            <void index="15"><double>1</double></void>
          </array>
        </object>
      </prop>
      <!-- example of how to pass an array -->
      <prop name="array">
        <array class="double" length="8">
          <void index="0"><double>1</double></void>
          <void index="1"><double>0</double></void>
          <void index="2"><double>0</double></void>
          <void index="3"><double>3</double></void>
          <void index="4"><double>0</double></void>
          <void index="5"><double>1</double></void>
          <void index="6"><double>0</double></void>
          <void index="7"><double>3</double></void>
        </array>
      </prop>
    </virtualdevice>

  </virtualdevices>
</toolconfig>
