IDirect3DRMProgressiveMesh::Load
Loads the progressive mesh object from memory, a file, a resource, or a URL. Loading can be done synchronously or asynchronously.
HRESULT Load(
LPVOID lpSource,
LPVOID lpObjID,
D3DRMLOADOPTIONS dloLoadflags,
D3DRMLOADTEXTURECALLBACK lpCallback,
LPVOID lpArg
)
Parameters
lpSource
Address of the source for the object to be loaded. This source can be a file, resource, memory block, or stream, depending on the source flags specified in the dloLoadflags parameter.
lpObjID
Address of the ID of the DirectX file record that is a Progressive Mesh. This can either be a string or a UUID (determined by dloLoadflags). If lpObjID is NULL, then dloLoadflags must be D3DRMLOAD_FIRST.
dloLoadflags
Value of the D3DRMLOADOPTIONS type describing how the load is to be performed. One flag from each of the following two groups must be included:
The following values determine which object in the DirectX file is loaded:
D3DRMLOAD_BYNAME | The lpObjID parameter is interpreted as a string. |
D3DRMLOAD_BYGUID | The lpObjID parameter is interpreted as a UUID. |
D3DRMLOAD_FIRST | The first progressive mesh found is loaded. |
The following flags determine the source of the DirectX file:
D3DRMLOAD_FROMFILE | The lpSource parameter is interpreted as a string representing a local file name. |
D3DRMLOAD_FROMRESOURCE | The lpSource parameter is interpreted as a pointer to a D3DRMLOADRESOURCE structure. |
D3DRMLOAD_FROMMEMORY | The lpSource parameter is interpreted as a pointer to a D3DRMLOADMEMORY structure. |
D3DRMLOAD_FROMURL | The lpSource parameter is interpreted as a URL. |
In addition, you can specify whether the download is synchronous or asynchronous. By default, loading is synchronous and the Load call will not return until all data has been loaded or an error occurs. To specify asynchronous loading, include the following flag:
D3DRMLOAD_ASYNCHRONOUS - The Load call will return immediately. It is up to the application to use events with IDirect3DRMProgressiveMesh::RegisterEvents and IDirect3DRMProgressiveMesh::GetLoadStatus to find out how the load is progressing.
lpCallback
Address of a D3DRMLOADTEXTURECALLBACK callback function that will be called to load any texture encountered. The callback will be called with the texture name as encountered by the loader and the user-defined lpArg parameter. A new thread is not spawned for the callback. If you want the application to download a texture progressively, it must spawn a thread and return with a LPDIRECT3DRMTEXTURE as normal.
lpArg
Address of user-defined data passed to the D3DRMLOADTEXTURECALLBACK callback function.
Return Values
Returns DD_OK if successful, or one of the following errors:
D3DRMERR_BADPMDATA
D3DRMERR_BADFILE
D3DRMERR_CONNECTIONLOST
D3DRMERR_INVALIDDATA
D3DRMERR_INVALIDOBJECT
D3DRMERR_INVALIDPARAMS
Remarks
The progressive mesh is not useful unless it has been initialized. If asynchronous download is specified, the API returns immediately and a separate thread is spawned to perform the download.
This method, IDirect3DRMProgressiveMesh::Clone, and IDirect3DRMProgressiveMesh::Duplicate all initialize a progressive mesh. You can only initialize an object once. Therefore, you cannot clone or duplicate a progressive mesh and then try to load into the cloned or duplicated mesh, nor can you load into a previously loaded mesh.