<!-- Trainz Mesh Import Format

    Designed to be a simple, understandable format, easily filled from any 3D source
    Any optional or safe value not present will be filled with Default, Zero, Identity, or Invalid as appropriate.
  
    NOTES:
    o All Position and Orientations are in World (or whole object) space, not local space (ie. not local to bone or parent)
    o Ids are used to relate some items.  These can be Indices or plain Id numbers, order, continuity and position in file is ignored 

    
    ROTATIONS (and ORIENTATIONS) are represented by Quaternions however they may be entered in different ways.  Scaling and Skewing is not supported.
    
    Default is normalized Quaternion
    <rotation>0,0,0,1</rotation>
    
    Explicit Quaternion, same as default
    <rotation format="quaternion">0,0,0,1</rotation>
    
    Axis Angle, where Axis is a unit vector3 and Angle is in Degrees
    <rotation format="axisangle">1,0,0,45</rotation>
    
    Matrix, where the format is 3 vector3s as AxisX, AxisY, AxisZ basis vectors 
    <rotation format="matrix">1,0,0, 0,1,0, 0,0,1</rotation>
-->
                                                  
<trainzImport>                                    <!-- File root block name -->
  <version>1</version>                            <!-- File version -->
  
  <mesh>                                          <!-- Mesh block -->                                
    <name>m.wheel</name>                          <!-- User name for mesh -->

    <triangles>                                   <!-- Geometry block, array of triangles -->
      <triangle>                                  <!-- Single polygon face -->
        <materialId>0</materialId>                <!-- Material Id/Index for face -->
        <vertex>                                  <!-- Expect 3 vertices, in Counter Clockwise Order -->
                                                  <!-- Currently supports 1 stream of [position, normal, texcoord] and up to 4 streams of [boneId, blend] other streams ignored -->
        
          <position>0,0,0</position>              <!-- Position x,y,z -->
          <normal>1,0,0</normal>                  <!-- Normal x,y,z -->
          <texcoord>0.5,0.25</texcoord>           <!-- Texture coordinates u,v (or s,t)-->
         
          <boneId stream="0">12</boneId>          <!-- Bone Id/Index, Attribute 'stream' for multiple values, default is 0 -->
          <blend stream="0">0.3</blend>           <!-- Blend amount 0-1 -->
    
          <boneId stream="1">0.25</boneId>
          <blend stream="1">0.75</blend>
          
        </vertex>      
        <!-- ...vertex[3] -->
      </triangle>
      <!-- ...triangle[] -->
    </triangles>

    <attachments>                                 <!-- Array of attachments (optional) -->
      <attachment>
        <name>a.smoke</name>                      <!-- Attachment name -->
        <position>1,0,1.5</position>              <!-- Position x,y,z -->
        <orientation>1,0,0,1</orientation>        <!-- Orientation x,y,z,w -->
      </attachment>
      <!-- ...attachment[] -->
    </attachments>  

  </mesh>
  
  <skeleton>                                      <!-- Skeleton block (Required for animation only) -->
    <bones>                                       <!-- Array of bones -->
      <bone>
        <id>0</id>                                <!-- Bone Id/Index to relate bone to vertex inflence -->
        <name>b.wheel</name>                      <!-- Name of bone (expects 'b.' prefix) -->
        <parentName></parentName>                 <!-- Parent bone name or empty for root. Allows tree style connectivity -->
        <position>1,0,1.5</position>              <!-- World Position x,y,z -->
        <orientation>1,0,0,1</orientation>        <!-- World Orientation x,y,z,w -->
      </bone>
      <!-- ...bone[] -->
    </bones>
  </skeleton>
  
  <materials>                                     <!-- Array of materials -->
    <material>
      <name>BrickWall</name>                      <!-- User name for material -->
      <id>0</id>                                  <!-- Id or index to match with triangle faces -->
      <ambient>0.1,0.1,0.1</ambient>              <!-- R,G,B (0.0 - 1.0 per channel) -->
      <diffuse>0.5,0.5,0.5</diffuse>              <!-- R,G,B -->
      <specular>0,0,0</specular>                  <!-- R,G,B -->
      <emissive>0,0,0</emissive>                  <!-- R,G,B -->
      <shine>0.3</shine>                          <!-- 0.0 - 1.0 Shininess or glossiness value -->
      <opacity>1.0</opacity>                      <!-- Level of opacity or transparency, 1.0 is completely opaque (Default is 1.0) -->
      <twoSided>false</twoSided>                  <!-- Is material double sided? (Default is false) -->
       <textures>                                 <!-- Array of textures used by material -->
        <texture>
          <textureName>c:/textures/brick.tga</textureName> <!-- Texture file, full path and file name -->
          <alphaSource>true</alphaSource>         <!-- Alpha channel from texture is used.  Causes .texture.txt files to contain 'Alpha=' with duplicated file name. (Default is false)
          <typeName>diffuse</typeName>            <!-- Texture type/usage [ambient, diffuse, specular, shine, shinestrength, selfillum, opacity, filtercolor, bump, reflect, refract, displacement] -->
          <tileU>true</tileU>                     <!-- Tile/wrap in horizontal direction -->
          <tileV>true</tileV>                     <!-- Tile/wrap in vertical direction -->
          <layerOpacity>1.0</layerOpacity>        <!-- Level of opacity or transparency for this texture stage (Default is 1.0) -->
          <flipGreen>false</flipGreen>            <!-- Flip green (Y) channel for normal maps (Default is false)
        </texture>
        <!-- ...texture[] -->
      </textures>        
   
    </material>
    <!-- ...material[] -->
  </materials>
  
  <animations>                                      <!-- Array of (or single) animations -->
    <animation>                                     
      <name>SpinBaby</name>                         <!-- Optional Name of animation used to name .KIN file -->
                                                    <!-- If name is empty, .KIN files wil use the output name for each animation: 'somename.kin, somename2.kin somename3.kin' etc. -->
      
      <frameRate>30</frameRate>                     <!-- Frame rate in Frames Per Second.  Gives frames a concept of time -->
      <useLocalSpace>false</useLocalSpace>          <!-- Optionally use local space keyframes. Default is FALSE -->
      
      <animationTracks>                             <!-- Array of animation tracks, 1 per bone -->    
        <animationTrack>
          <targetName>b.wheel</targetName>          <!-- Target bone name -->
          <keyFrames>                               <!-- Array of key frames -->
            <keyFrame>
              <position>0,0.5,1</position>          <!-- position x,y,z -->
              <rotation>1,0,0,1</rotation>          <!-- rotation x,y,z,q -->
            </keyFrame>
            <!-- ...keyFrame[] -->
          </keyFrames>
        </animationTrack>
        <!-- ...animationTrack[] -->    
      </animationTracks>
      
      <events>                                      <!-- Event array (optional) -->
        <event>
          <frameIndex>1</frameIndex>                <!-- Index into keyframe array --> 
          <typeName>sound</typeName>                <!-- [Sound, soundsync, sync, 3dsys, generic, effect, attach, detach, transfer, animcomplete, loopcomplete, destroyed] -->
          <eventName>badaboom</eventName>           <!-- Event name or text -->
        </event>
        <!-- ...event[] -->
      </events>
      
    </animation>
    <!-- ...animation[] -->
  </animations>
    
</trainzImport>
