Engines/FlatRedBallXNA/FlatRedBall.Content/ModelAnimation/X File/XModelImporter.cs
// A frame can store any data, but is constrained such that each frame must haveB
// a transform matrix for .X meshes.
// template Frame
// {
//    [...]			
// } 
/// <summary>
/// Imports a data Node in a directx file, usually a Frame node.
/// </summary>
/// <returns>The imported node</returns>
Imports a data Node in a directx file, usually a Frame node.
Imports a data Node in a directx file usually a Frame node .
private NodeContent ImportNode()
        {
            NodeContent c;
            if (meshes.Count==0)
            {
                c = new NodeContent();
            }
            else
            {
                c = new BoneContent();
            }
            c.Name = tokens.ReadName();
            if (c.Name == null)
                c.Name = "Node" + c.GetHashCode();
            for (string next = tokens.NextToken(); next != "}"; next = tokens.NextToken())
            {
                if (next == "Frame")
                    c.Children.Add(ImportNode());
                else if (next == "FrameTransformMatrix")
                    c.Transform = ImportFrameTransformMatrix();
                else if (next == "Mesh")
                {
                    XMeshImporter meshImporter = new XMeshImporter(this);
                    c.Children.Add(meshImporter.ImportMesh());
                }
                else if (next == "template")
                    tokens.SkipName().SkipNode();
                else if (next == "SkinWeights")
                    meshes[0].ImportSkinWeights();
                else if (next == "{")
                    tokens.SkipNode();
            }
            return c;
        }
private NodeContent ImportNode ( ) { NodeContent c ; if ( meshes . Count == 0 ) { c = new NodeContent ( ) ; } else { c = new BoneContent ( ) ; } c . Name = tokens . ReadName ( ) ; if ( c . Name == null ) c . Name = " " + c . GetHashCode ( ) ; for ( string next = tokens . NextToken ( ) ; next != " " ; next = tokens . NextToken ( ) ) { if ( next == " " ) c . Children . Add ( ImportNode ( ) ) ; else if ( next == " " ) c . Transform = ImportFrameTransformMatrix ( ) ; else if ( next == " " ) { XMeshImporter meshImporter = new XMeshImporter ( this ) ; c . Children . Add ( meshImporter . ImportMesh ( ) ) ; } else if ( next == " " ) tokens . SkipName ( ) . SkipNode ( ) ; else if ( next == " " ) meshes [ 0 ] . ImportSkinWeights ( ) ; else if ( next == " " ) tokens . SkipNode ( ) ; } return c ; }
Imports a data Node in a directx file, usually a Frame node.
Imports a data Node in a directx file usually a Frame node .
// process all of this frame's children // Ignore templates, which define new structure that store data // for now, we only will work with the standard directx templates // Skin weight nodes can exist either inside meshes or inside frames. // When they exist in a frame, they will refer to a universal mesh // an data node that we are uninterested in
The imported node
The imported node