Microsoft DirectX 8.1 (C++)

D3DXLoadMeshFromXInMemory

Loads a mesh from memory.

HRESULT D3DXLoadMeshFromXInMemory(
  PBYTE             Memory,
  DWORD             SizeOfMemory,  
  DWORD             Options,
  LPDIRECT3DDEVICE8 pDevice,
  LPD3DXBUFFER*     ppAdjacency,
  LPD3DXBUFFER*     ppMaterials,
  DWORD*            pNumMaterials,
  LPD3DXMESH*       ppMesh
);

Parameters

Memory
[in] Pointer to the file in memory from which to create the mesh.
SizeOfMemory
[in] Size of the file in memory, in bytes.
Options
[in] A combination of one or more flags from the D3DXMESH enumeration, specifying creation options for the mesh.
pDevice
[in] Pointer to an IDirect3DDevice8 interface, the device object associated with the mesh.
ppAdjacency
[out] Address of a pointer to an ID3DXBuffer interface. When the method returns, this parameter is filled with an array of three DWORDs per face that specify the three neighbors for each face in the mesh.
ppMaterials
[out] Address of a pointer to an ID3DXBuffer interface. When this method returns, this parameter is filled with an array of D3DXMATERIAL structures, containing information saved in the Microsoft® DirectX® file.
pNumMaterials
[out] Pointer to the number of D3DXMATERIAL structures in the ppMaterials array, when the method returns.
ppMesh
[out] Address of a pointer to an ID3DXMesh interface, representing the loaded mesh.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_INVALIDCALL
E_OUTOFMEMORY

Note  All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.

Requirements

  Header: Declared in D3dx8mesh.h.
  Import Library: Use D3dx8.lib.