DirectX ASC to BIN

Blitz3D Forums/Blitz3D Programming/DirectX ASC to BIN

I want to convert some .x ascii files to see if I can get the animation in my file working.

Blitz will load ASCII .X files, and whether they're ASCII or binary shouldn't make any difference to their animations.


And before you say Blitz3d doesn't run .x animations, the Markio character is a .x file.

Blitz supports the older 'retained mode' animated .X files. The newer DirectX 8 boned format is not supported however (only the mesh is loaded AFAIK).

Here's an example of an animated ASCII .X model for you to try...
xof 0303txt 0032

// DirectX - from MilkShape3D

Frame joint1
{
    FrameTransformMatrix
    {
        1.000000,0.000000,0.000000,0.000000,
        0.000000,1.000000,0.000000,0.000000,
        0.000000,0.000000,1.000000,0.000000,
        2.000000,2.000000,0.000000,1.000000;;
    }

    Mesh joint1Mesh
    {
        20;
        -1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;1.000000;,
        1.000000;-1.000000;1.000000;,
        1.000000;1.000000;1.000000;,
        1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;1.000000;,
        -1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;1.000000;,
        -1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        -1.000000;1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;;
        12;
        3;0,2,1;,
        3;1,2,3;,
        3;4,6,5;,
        3;5,6,7;,
        3;8,10,9;,
        3;9,10,11;,
        3;12,14,13;,
        3;13,14,15;,
        3;12,6,16;,
        3;16,6,17;,
        3;18,19,13;,
        3;13,19,7;;

        MeshNormals
        {
            6;
            0.000000;0.000000;-1.000000;,
            1.000000;0.000000;0.000000;,
            0.000000;0.000000;1.000000;,
            -1.000000;0.000000;0.000000;,
            0.000000;1.000000;0.000000;,
            0.000000;-1.000000;0.000000;;
            12;
            3;0,0,0;,
            3;0,0,0;,
            3;1,1,1;,
            3;1,1,1;,
            3;2,2,2;,
            3;2,2,2;,
            3;3,3,3;,
            3;3,3,3;,
            3;4,4,4;,
            3;4,4,4;,
            3;5,5,5;,
            3;5,5,5;;
        }

        MeshTextureCoords
        {
            20;
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;1.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            1.000000;0.000000;;
        }
    }
}
Frame joint2
{
    FrameTransformMatrix
    {
        1.000000,0.000000,0.000000,0.000000,
        0.000000,1.000000,0.000000,0.000000,
        0.000000,0.000000,1.000000,0.000000,
        0.000000,0.000000,0.000000,1.000000;;
    }

    Mesh joint2Mesh
    {
        20;
        -1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;,
        1.000000;1.000000;1.000000;,
        1.000000;-1.000000;1.000000;,
        1.000000;1.000000;1.000000;,
        1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;1.000000;,
        -1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;1.000000;,
        -1.000000;-1.000000;1.000000;,
        -1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        -1.000000;1.000000;-1.000000;,
        1.000000;1.000000;-1.000000;,
        -1.000000;-1.000000;-1.000000;,
        1.000000;-1.000000;-1.000000;;
        12;
        3;0,2,1;,
        3;1,2,3;,
        3;4,6,5;,
        3;5,6,7;,
        3;8,10,9;,
        3;9,10,11;,
        3;12,14,13;,
        3;13,14,15;,
        3;12,6,16;,
        3;16,6,17;,
        3;18,19,13;,
        3;13,19,7;;

        MeshNormals
        {
            6;
            0.000000;0.000000;-1.000000;,
            1.000000;0.000000;0.000000;,
            0.000000;0.000000;1.000000;,
            -1.000000;0.000000;0.000000;,
            0.000000;1.000000;0.000000;,
            0.000000;-1.000000;0.000000;;
            12;
            3;0,0,0;,
            3;0,0,0;,
            3;1,1,1;,
            3;1,1,1;,
            3;2,2,2;,
            3;2,2,2;,
            3;3,3,3;,
            3;3,3,3;,
            3;4,4,4;,
            3;4,4,4;,
            3;5,5,5;,
            3;5,5,5;;
        }

        MeshTextureCoords
        {
            20;
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            0.000000;1.000000;,
            1.000000;0.000000;,
            1.000000;1.000000;,
            0.000000;1.000000;,
            1.000000;1.000000;,
            0.000000;0.000000;,
            1.000000;0.000000;;
        }
    }
}
AnimationSet AnimationSet0
{
    Animation joint1Animation
    {
        {joint1}

        AnimationKey
        {
            2;
            3;
            0;3;2.000000,2.000000,0.000000;;,
            14;3;-0.004009,2.000000,0.000000;;,
            29;3;-2.000000,2.000000,0.000000;;;
        }

        AnimationKey
        {
            0;
            3;
            0;4;1.000000,0.000000,0.000000,0.000000;;,
            14;4;1.000000,0.000000,0.000000,0.000000;;,
            29;4;1.000000,0.000000,0.000000,0.000000;;;
        }
    }

    Animation joint2Animation
    {
        {joint2}

        AnimationKey
        {
            2;
            1;
            0;3;0.000000,0.000000,0.000000;;;
        }

        AnimationKey
        {
            0;
            1;
            0;4;1.000000,0.000000,0.000000,0.000000;;;
        }
    }
}


YAN