XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

How do I get the mesh name list in static XFile

Last post 29/06/2009 2:37 by legalize. 2 replies.
  • 22/06/2009 3:39

    How do I get the mesh name list in static XFile

    How do I get the mesh name list in static XFile?
    I have a special requirement to get the mesh name list from a static XFile(without animation).
    Which function should I use? Or I must parse the XFile with DirectX function?
  • 28/06/2009 11:02 In reply to

    Re: How do I get the mesh name list in static XFile

    You need to use the ID3DXFileData::GetName() to get the name of an object. Something along these lines:

    // Get size of buffer first
    SIZE_T sz = 0;
    xdata->GetName(0, &sz);

    // Load if not empty
    char* name = 0;
    if(sz > 1)
    {
        name = new char[sz];
        xdata->GetName(name, &sz);
    }

  • 29/06/2009 2:37 In reply to

    Re: How do I get the mesh name list in static XFile

    When you use D3DXLoadMeshHierarchyFromX, it will call into your ID3DXAllocateHierarchy implementation once for each mesh in the file.  You can simply make an implementation of this interface that records the names of the meshes it is asked to create without actually creating them.  ID3DXAllocateHierarchy::CreateMeshContainer is passed the name of the mesh.  You will want to release the mesh data that is passed to you, or you will leak memory.
Page 1 of 1 (3 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG