Jack
2009-10-04 13:37:43 UTC
Hello,
This is the standard code found in Direct3D.
[code]
DECLARE_INTERFACE(ID3DXAllocateHierarchy)
{
// ID3DXAllocateHierarchy
//------------------------------------------------------------------------
// CreateFrame:
// ------------
// Requests allocation of a frame object.
//
// Parameters:
// Name
// Name of the frame to be created
// ppNewFrame
// Returns the created frame object
//
//------------------------------------------------------------------------
STDMETHOD(CreateFrame)(THIS_ LPCSTR Name,
LPD3DXFRAME *ppNewFrame) PURE;
//------------------------------------------------------------------------
// CreateMeshContainer:
// --------------------
// Requests allocation of a mesh container object.
//
// Parameters:
// Name
// Name of the mesh
// pMesh
// Pointer to the mesh object if basic polygon data found
// pPMesh
// Pointer to the progressive mesh object if progressive mesh data found
// pPatchMesh
// Pointer to the patch mesh object if patch data found
// pMaterials
// Array of materials used in the mesh
// pEffectInstances
// Array of effect instances used in the mesh
// NumMaterials
// Num elements in the pMaterials array
// pAdjacency
// Adjacency array for the mesh
// pSkinInfo
// Pointer to the skininfo object if the mesh is skinned
// pBoneNames
// Array of names, one for each bone in the skinned mesh.
// The numberof bones can be found from the pSkinMesh object
// pBoneOffsetMatrices
// Array of matrices, one for each bone in the skinned mesh.
//
//------------------------------------------------------------------------
STDMETHOD(CreateMeshContainer)(THIS_
LPCSTR Name,
CONST D3DXMESHDATA *pMeshData,
CONST D3DXMATERIAL *pMaterials,
CONST D3DXEFFECTINSTANCE *pEffectInstances,
DWORD NumMaterials,
CONST DWORD *pAdjacency,
LPD3DXSKININFO pSkinInfo,
LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE;
//------------------------------------------------------------------------
// DestroyFrame:
// -------------
// Requests de-allocation of a frame object.
//
// Parameters:
// pFrameToFree
// Pointer to the frame to be de-allocated
//
//------------------------------------------------------------------------
STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE;
//------------------------------------------------------------------------
// DestroyMeshContainer:
// ---------------------
// Requests de-allocation of a mesh container object.
//
// Parameters:
// pMeshContainerToFree
// Pointer to the mesh container object to be de-allocated
//
//------------------------------------------------------------------------
STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER
pMeshContainerToFree) PURE;
};
[/code]
My declaration is....
[code]
class CAllocateHierarchy: public ID3DXAllocateHierarchy
{
private:
virtual HRESULT __stdcall CreateFrame(LPCTSTR Name, LPD3DXFRAME
*ppNewFrame);
virtual HRESULT __stdcall CreateMeshContainer(LPCTSTR Name, LPD3DXMESHDATA
pMeshData,
LPD3DXMATERIAL pMaterials, LPD3DXEFFECTINSTANCE pEffectInstances, DWORD
NumMaterials,
DWORD *pAdjacency, LPD3DXSKININFO pSkinInfo,
LPD3DXMESHCONTAINER *ppNewMeshContainer);
virtual HRESULT __stdcall DestroyFrame(LPD3DXFRAME pFrameToFree);
virtual HRESULT __stdcall DestroyMeshContainer(LPD3DXMESHCONTAINER
pMeshContainerBase);
};
[/code]
after that, I tried to create an object of class CAllocateHierarchy, the
compiler complains
Error 1 error C2259: 'CAllocateHierarchy' : cannot instantiate abstract
class c:\documents and
settings\garfield\project1\project_sim\project_sim\project_simview.cpp 78
Project_Sim
What's wrong?
Thanks
Jack
This is the standard code found in Direct3D.
[code]
DECLARE_INTERFACE(ID3DXAllocateHierarchy)
{
// ID3DXAllocateHierarchy
//------------------------------------------------------------------------
// CreateFrame:
// ------------
// Requests allocation of a frame object.
//
// Parameters:
// Name
// Name of the frame to be created
// ppNewFrame
// Returns the created frame object
//
//------------------------------------------------------------------------
STDMETHOD(CreateFrame)(THIS_ LPCSTR Name,
LPD3DXFRAME *ppNewFrame) PURE;
//------------------------------------------------------------------------
// CreateMeshContainer:
// --------------------
// Requests allocation of a mesh container object.
//
// Parameters:
// Name
// Name of the mesh
// pMesh
// Pointer to the mesh object if basic polygon data found
// pPMesh
// Pointer to the progressive mesh object if progressive mesh data found
// pPatchMesh
// Pointer to the patch mesh object if patch data found
// pMaterials
// Array of materials used in the mesh
// pEffectInstances
// Array of effect instances used in the mesh
// NumMaterials
// Num elements in the pMaterials array
// pAdjacency
// Adjacency array for the mesh
// pSkinInfo
// Pointer to the skininfo object if the mesh is skinned
// pBoneNames
// Array of names, one for each bone in the skinned mesh.
// The numberof bones can be found from the pSkinMesh object
// pBoneOffsetMatrices
// Array of matrices, one for each bone in the skinned mesh.
//
//------------------------------------------------------------------------
STDMETHOD(CreateMeshContainer)(THIS_
LPCSTR Name,
CONST D3DXMESHDATA *pMeshData,
CONST D3DXMATERIAL *pMaterials,
CONST D3DXEFFECTINSTANCE *pEffectInstances,
DWORD NumMaterials,
CONST DWORD *pAdjacency,
LPD3DXSKININFO pSkinInfo,
LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE;
//------------------------------------------------------------------------
// DestroyFrame:
// -------------
// Requests de-allocation of a frame object.
//
// Parameters:
// pFrameToFree
// Pointer to the frame to be de-allocated
//
//------------------------------------------------------------------------
STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE;
//------------------------------------------------------------------------
// DestroyMeshContainer:
// ---------------------
// Requests de-allocation of a mesh container object.
//
// Parameters:
// pMeshContainerToFree
// Pointer to the mesh container object to be de-allocated
//
//------------------------------------------------------------------------
STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER
pMeshContainerToFree) PURE;
};
[/code]
My declaration is....
[code]
class CAllocateHierarchy: public ID3DXAllocateHierarchy
{
private:
virtual HRESULT __stdcall CreateFrame(LPCTSTR Name, LPD3DXFRAME
*ppNewFrame);
virtual HRESULT __stdcall CreateMeshContainer(LPCTSTR Name, LPD3DXMESHDATA
pMeshData,
LPD3DXMATERIAL pMaterials, LPD3DXEFFECTINSTANCE pEffectInstances, DWORD
NumMaterials,
DWORD *pAdjacency, LPD3DXSKININFO pSkinInfo,
LPD3DXMESHCONTAINER *ppNewMeshContainer);
virtual HRESULT __stdcall DestroyFrame(LPD3DXFRAME pFrameToFree);
virtual HRESULT __stdcall DestroyMeshContainer(LPD3DXMESHCONTAINER
pMeshContainerBase);
};
[/code]
after that, I tried to create an object of class CAllocateHierarchy, the
compiler complains
Error 1 error C2259: 'CAllocateHierarchy' : cannot instantiate abstract
class c:\documents and
settings\garfield\project1\project_sim\project_sim\project_simview.cpp 78
Project_Sim
What's wrong?
Thanks
Jack