D3DXCreatePMeshFromStream

Bb172784.XDK_CHM_BANNER_left(en-us,VS.85).jpgBb172784.XDK_CHM_BANNER_right(en-us,VS.85).jpg

D3DXCreatePMeshFromStream

Creates a progressive mesh from a stream object.

HRESULT D3DXCreatePMeshFromStream(
  IStream * pStream,
  DWORD Options,
  LPDIRECT3DDEVICE9 pDevice,
  LPD3DXBUFFER * ppMaterials,
  LPD3DXBUFFER * ppEffectInstances,
  DWORD * pNumMaterials,
  LPD3DXPMESH * ppPMesh
);

Parameters

pStream
[in] Pointer to an IStream interface, representing the stream object from which to create the progressive mesh. The data in this stream was generated with the ID3DXPMesh::Save method.
Options
[in] Combination of one or more flags from the D3DXMESH enumeration, specifying creation options for the mesh.
pDevice
[in] Pointer to an IDirect3DDevice9 interface, the device object to be associated with the progressive 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 stream object.
ppEffectInstances
[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. For more information about accessing the buffer, see ID3DXBuffer.
pNumMaterials
[out] Pointer to the number of D3DXMATERIAL structures in the ppMaterials array, when the method returns.
ppPMesh
[out] Address of a pointer to an ID3DXPMesh interface, representing the created progressive 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: D3DERR_INVALIDCALL.

D3DXERR_INVALIDDATA E_OUTOFMEMORY

Remarks

For more information about the IStream interface, see the Platform SDK.

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.

Requirements

Header: Declared in D3DX9Mesh.h.

Library: Use D3dx9.lib.

See Also

ID3DXPMesh::Save

Show: