Microsoft DirectX 9.0

D3DXLoadPatchMeshFromXof Function

Loads a patch mesh from an IDirectXFileData object.


HRESULT D3DXLoadPatchMeshFromXof(      

    LPDIRECTXFILEDATA pXofObjMesh,     DWORD Options,     LPDIRECT3DDEVICE9 pDevice,     LPD3DXBUFFER *ppMaterials,     LPD3DXBUFFER* ppEffectInstances,     PDWORD pNumMaterials,     LPD3DXPATCHMESH* ppMesh );


[in] Pointer to an IDirectXFileData interface, representing the file data object to load.
[in] Combination of one or more D3DXMESH flags, specifying creation options for the mesh.
[in] Pointer to the device that the mesh is created from.
[out] Array of materials contained in the mesh. Each material is indexed by an ID3DXBuffer interface.
[out] Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See D3DXEFFECTINSTANCE. For more information about accessing the buffer, see ID3DXBuffer.
[out] Pointer that contains the number of materials in the mesh.
[out, retval] Address of a pointer to an ID3DXPatchMesh interface, representing the loaded mesh.

Return Value

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_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
D3DXERR_INVALIDDATAThe data is invalid.
E_OUTOFMEMORYMicrosoft?Direct3D?could not allocate sufficient memory to complete the call.


For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the D3DMATERIAL9 structure.

The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.

Function Information

Import libraryd3dx9.lib
Minimum operating systems Windows 98

See Also


© 2002 Microsoft Corporation. All rights reserved.