CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2007
    Posts
    10

    D3DXLoadMeshFromX question

    I am learning DX9 and am loading a x file with D3DXLoadMeshFromX ,no animations just a x file with 3 meshes. pretty simple. It does load and i can render the meshes using a for-next to render the subsets , textures and materials just fine.. The problem I am having is that the pointer returned for the seventh parameter of the D3DXLoadMeshFromX function of DWORD *pNumMaterials, is wrong... it returns that i have 9 material structures in the buffer when there are only three in the x files ... also the eighth parameter a pointer to the new mesh object contains 9 subsets when there only should be three.

    upon stepping thru the for-next rendering loop i find that the

    d3dDevice->SetMaterial(&pMaterialList[i]); 0-2 have the correct sequence of materials 3-5 and 6-8 are copies of 0-2

    same goes for d3dDevice->SetTexture(0,pTextureList[i]);

    but the 0-8 subsets there is no mesh rendered for subsets 0,1,3,5,7,8
    but subsets 2,4,6 contain what should be subsets 0,1,2

    I have checked the x file and it has only 3 materials and three meshes

    I used wings 3d
    here is part of the last of the x-file
    MeshMaterialList {
    3;
    6;
    0;
    0;
    0;
    0;
    0;
    0;
    ;
    {cube1_auv}
    {cube2_auv}
    {cube3_auv}
    }

    I'm not sure if it is the modeling program exporting wrong or something to do with D3DXLoadMeshFromX function.

    any comments will be greatly appreciated.

    thanx in advance.

  2. #2
    Join Date
    Feb 2007
    Posts
    10

    Re: D3DXLoadMeshFromX question

    I found the problem it was the exporter.. I had a different material for each of the three cubes (frame meshes) and the exporter attached all three materials to each of the meshes. 3x3 = 9


    MeshMaterialList {
    3;
    6;
    0;
    0;
    0;
    0;
    0;
    0;
    ;
    {cube1_auv}
    {cube2_auv}
    {cube3_auv}
    }

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

Featured