![]() |
![]() |
![]() |
Registers custom templates.
Syntax
HRESULT RegisterTemplates(
LPCVOID pvData, SIZE_T cbSize );
Parameters
- pvData
- [in] Pointer to a buffer consisting of a .x file in text or binary format that contains templates.
- cbSize
- [in] Size of the buffer pointed to by pvData, in bytes.
Return Value
If the method succeeds, the return value is S_OK.
If the method fails, the return value can be one of the following:
D3DXFERR_BADVALUE A variable is outside its expected range; typically returned when an object pointer is invalid. D3DXFERR_PARSEERROR Data stream could not be parsed.
Remarks
The following code fragment provides an example call to RegisterTemplates and example contents for the buffer to which pvData points.
#define XSKINEXP_TEMPLATES \ "xof 0303txt 0032\ template XSkinMeshHeader \ { \ <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ WORD nMaxSkinWeightsPerVertex; \ WORD nMaxSkinWeightsPerFace; \ WORD nBones; \ } \ template VertexDuplicationIndices \ { \ <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \ DWORD nIndices; \ DWORD nOriginalVertices; \ array DWORD indices[nIndices]; \ } \ template SkinWeights \ { \ <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ STRING transformNodeName;\ DWORD nWeights; \ array DWORD vertexIndices[nWeights]; \ array float weights[nWeights]; \ Matrix4x4 matrixOffset; \ }" . . . LPD3DXFILE pD3DXFile = NULL; if ( FAILED (hr = pD3DXFile->RegisterTemplates( (LPVOID)XSKINEXP_TEMPLATES, sizeof( XSKINEXP_TEMPLATES ) - 1 ) ) ) goto End;All templates must specify a name and a universally unique identifier (UUID).
This method calls the ID3DXFile::RegisterEnumTemplates method, obtaining an ID3DXFileEnumObject interface pointer by calling ID3DXFile::CreateEnumObject with pvData as the first parameter.
See Also
ID3DXFile::RegisterEnumTemplates