?/TD>
Microsoft DirectX 9.0

D3DXSaveMeshToX Function


Saves a mesh to an .x file.

Syntax

HRESULT D3DXSaveMeshToX(      

    LPCTSTR pFilename,     LPD3DXMESH pMesh,     CONST DWORD* pAdjacency,     CONST D3DXMATERIAL* pMaterials,     CONST D3DXEFFECTINSTANCE* pEffectInstances,     DWORD NumMaterials,     DWORD Format );

Parameters

pFilename
[in] Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
pMesh
[in] Pointer to an ID3DXMesh interface, representing the mesh to save to an .x 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 .x file.
pEffectInstances
[in] Pointer to an array of effect instances, one per attribute group in the mesh. An effect instance is a particular instance of state information used to initialize an effect. For more information, see D3DXEFFECTINSTANCE.
NumMaterials
[in] Number of D3DXMATERIAL structures in the pMaterials array.
Format
[in] Indicates the format to use when saving the .x file. For more information, see Remarks.

Return Value

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


Remarks

The compiler setting also determines the function version. If Unicode is defined, the function call resolves to D3DXSaveMeshToXW. Otherwise, the function call resolves to D3DXSaveMeshToXA because ANSI strings are being used.

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.

Function Information

Headerd3dx9mesh.h
Import libraryd3dx9.lib
Minimum operating systems Windows 98

See Also

D3DXEFFECTDEFAULT, D3DXEFFECTINSTANCE


© 2002 Microsoft Corporation. All rights reserved.