Results 1 to 10 of 10

Thread: loading .X files into a 3D World and giving them coordinates

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    5

    loading .X files into a 3D World and giving them coordinates

    I have created a 3D world that you can walk around in using the keyboard. Everything in the world so far I have had to create by entering vertices. I've made some .X files that I would like to load into the world but I cannot figure out how. I've downloaded .X file viewers and my files load in those so I know that the files are okay. I looked in the DirectX 8.0 SDK and read the tutorial on how to load .X files but it didn't work for me. I also need to learn how to give the .X files coordinates in the 3D world. One way I've seen is in the book "Windows Game Programming with Visual Basic and DirectX" where the meshes are moved to coordinates by matrix translations. If anyone could help me with these problems, please do. I can send you my code if needed. Thanks in advance!

    Simbro

  2. #2
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280
    Are talking about Binary X files or Text X files? I can help you out with the Text X files....however, if you're using DX, then RIP

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    5
    what's the difference? I created the files in MilkShape and exported them as DirectX Files.

  4. #4
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280
    Open the X-File in Notepad.

    If you see ASCII characters (especially ";" marks) and in the first lines the characters "txt" appear, then you are using Text X-Files

    If you just see jiberish, than you are using Binary X-Files.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    5
    here's the beginning of one of the .X files:

    xof 0303txt 0032
    template XSkinMeshHeader {
    <3cf169ce-ff7c-44ab-93c0-f78f62d172e2>
    WORD nMaxSkinWeightsPerVertex;
    WORD nMaxSkinWeightsPerFace;
    WORD nBones;
    }

    template VertexDuplicationIndices {
    <b8d65549-d7c9-4995-89cf-53a9a8b031e3>
    DWORD nIndices;
    DWORD nOriginalVertices;
    array DWORD indices[nIndices];
    }

    template SkinWeights {
    <6f0d123b-bad2-4167-a0d0-80224f25fabb>
    STRING transformNodeName;
    DWORD nWeights;
    array DWORD vertexIndices[nWeights];
    array FLOAT weights[nWeights];
    Matrix4x4 matrixOffset;
    }


    does this help?

  6. #6
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280
    Yes....now...are you using DX or OpenGL? Or something else...btw...you are using a text X-File

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    5
    I'm using DirectX 8.0

  8. #8
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Look for "D3DXLoadMeshFromX" in the DX SDK.
    ICQ: 128716725

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    5
    I did look in the SDK for "D3DXLoadMeshFromX". I also took the tutorial on loading .X files. I always got a subscript error. I think there is a problem with loading the textures if there is more than one.


    BTW...I like your gates joke, lol

  10. #10
    Member
    Join Date
    Jun 2002
    Location
    Netherlands
    Posts
    43
    Hey,

    i had some problems loading x files too. But i have found the problem for me so maybe this works for you too.

    The first problem is if your textures are .gif files, this didn't work at all, try to convert your textures to .jpg. then open the .x file with notepad and replace the texture references (for example i had to replace bubing_2.gif with wood 001.jpg). You can try this best with a very simple model. For example I started working with a chair, build up of 10 boxes (and therefore about 120 faces)

    The next thing is to load the texture, use the createtexturefromfile() method and not the createtexturefromfileex() version.

    I hope this helps you out.

    Jordi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width