Microsoft DirectX 8.1 (C++)

D3DXSaveMeshToX

Saves a mesh to a Microsoft® DirectX® .x file.

HRESULT D3DXSaveMeshToX(
  LPSTR pFilename,
  LPD3DXMESH pMesh,
  CONST DWORD* pAdjacency,
  CONST LPD3DXMATERIAL pMaterials,
  DWORD NumMaterials,
  DWORD Format
);

Parameters

pFilename
[in] Pointer to a string that specifies the name of the DirectX file identifying the saved mesh.
pMesh
[in] Pointer to an ID3DXMesh interface, representing the mesh to save to a DirectX file.
pAdjacency
[in] Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh.
pMaterials
[in] Pointer to an array of D3DXMATERIAL structures, containing material information to be saved in the DirectX file.
NumMaterials
[in] Number of D3DXMATERIAL structures in the rgMaterials array
Format
[in] Indicates the format to use when saving the DirectX file. For more information, see Remarks.
DXFILEFORMAT_BINARY
Indicates a binary file.
DXFILEFORMAT_COMPRESSED
Indicates a compressed file.
DXFILEFORMAT_TEXT
Indicates a text file.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be D3DERR_INVALIDCALL.

Remarks

The default value for the file format is DXFILEFORMAT_BINARY. DXFILEFORMAT_COMPRESSED can be combined (using a logical OR) with either the text or binary flag to reduce the file size. If a file is specified with both binary (DXFILEFORMAT_BINARY) and text (DXFILEFORMAT_TEXT) flags, it will be saved as a text file.

Requirements

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