Microsoft DirectX 9.0

D3DXSaveMeshHierarchyToFile Function

Creates an .x file and saves the mesh hierarchy and corresponding animations in it.


HRESULT D3DXSaveMeshHierarchyToFile(      

    LPCTSTR pFilename,     DWORD XFormat,     LPD3DXFRAME pFrameRoot,     LPD3DXANIMATIONCONTROLLER pAnimController,     LPD3DXSAVEUSERDATA pUserDataSaver );


[in] Pointer to a string that specifies the name of the .x file identifying the saved mesh. See Remarks.
[in] Format of the .x file (text or binary, compressed or not, etc.). See Remarks.
[in] Root node of the hierarchy to be saved. See D3DXFRAME.
[in] Animation controller whose animation sets are to be stored. See ID3DXAnimationController.
[in] Application-provided interface that allows saving of user data. See ID3DXSaveUserData.

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.


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

For more information about .x files, see X Files.

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

Import libraryd3dx9.lib
Minimum operating systems Windows 98

© 2002 Microsoft Corporation. All rights reserved.