Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm playing with a sample X-file from:

 

http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/

 

When I run this file, I see the original mesh rendering while the animation plays. Anyone know how to fix this?

 

Regards,

 

Jason

 

The file is:

 

//////BEGIN FILE AFTER THIS LINE

 

xof 0302txt 0064

 

Material RedMaterial {

1.000000;0.000000;0.000000;1.000000;; // R = 1.0, G = 0.0, B = 0.0

0.000000;

0.000000;0.000000;0.000000;;

0.000000;0.000000;0.000000;;

}

 

Material GreenMaterial {

0.000000;1.000000;0.000000;1.000000;; // R = 0.0, G = 1.0, B = 0.0

0.000000;

0.000000;0.000000;0.000000;;

0.000000;0.000000;0.000000;;

}

 

 

//////////////////////////////////////////////////////////////////////////////

// Begin CUBE MESH

//////////////////////////////////////////////////////////////////////////////

Mesh CubeMesh {

8; // 8 vertices

1.000000;1.000000;-1.000000;, // vertex 0

-1.000000;1.000000;-1.000000;, // vertex 1

-1.000000;1.000000;1.000000;, // etc...

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; // 12 faces

3;0,1,2;, // face 0 has 3 vertices

3;0,2,3;, // etc...

3;0,4,5;,

3;0,5,1;,

3;1,5,6;,

3;1,6,2;,

3;2,6,7;,

3;2,7,3;,

3;3,7,4;,

3;3,4,0;,

3;4,7,6;,

3;4,6,5;;

 

// All required data has been defined. Now define optional data

// using the hierarchical nature of the file format.

MeshMaterialList {

2; // Number of materials used

12; // A material for each face

0, // face 0 uses the first

0, // material

0,

0,

0,

0,

0,

0,

1, // face 8 uses the second

1, // material

1,

1;;

{RedMaterial} // References to the definitions

{GreenMaterial} // of material 0 and 1

}

MeshNormals {

8; // define 8 normals

0.333333;0.666667;-0.666667;,

-0.816497;0.408248;-0.408248;,

-0.333333;0.666667;0.666667;,

0.816497;0.408248;0.408248;,

0.666667;-0.666667;-0.333333;,

-0.408248;-0.408248;-0.816497;,

-0.666667;-0.666667;0.333333;,

0.408248;-0.408248;0.816497;;

12; // For the 12 faces,

3;0,1,2;, // define the normals

3;0,2,3;,

3;0,4,5;,

3;0,5,1;,

3;1,5,6;,

3;1,6,2;,

3;2,6,7;,

3;2,7,3;,

3;3,7,4;,

3;3,4,0;,

3;4,7,6;,

3;4,6,5;;

}

MeshTextureCoords {

8; // Define texture coords

0.000000;1.000000; // for each of the vertices

1.000000;1.000000;

0.000000;1.000000;

1.000000;1.000000;

0.000000;0.000000;

1.000000;0.000000;

0.000000;0.000000;

1.000000;0.000000;;

}

}

//////////////////////////////////////////////////////////////////////////////

// END CUBE MESH

//////////////////////////////////////////////////////////////////////////////

Frame CubeFrame {

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;;

}

{CubeMesh} // You could have the mesh inline, but this // uses an object reference instead.

}

 

AnimationSet AnimationSet0 {

Animation Animation0 {

{CubeFrame} // Use the frame containing the cube.

AnimationKey {

2; // Position keys

9; // 9 keys

1000; 3; -100.000000, 0.000000, 0.000000;;,

2000; 3; -75.000000, 0.000000, 0.000000;;,

3000; 3; -50.000000, 0.000000, 0.000000;;,

4000; 3; -25.500000, 0.000000, 0.000000;;,

5000; 3; 3.000000, 0.000000, 0.000000;;,

6000; 3; 25.500000, 0.000000, 0.000000;;,

7000; 3; 50.000000, 0.000000, 0.000000;;,

8000; 3; 75.500000, 0.000000, 0.000000;;,

9000; 3; 100.000000, 0.000000, 0.000000;;;

}

}

}

 

///END File

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...