Jump to content


need help with animation mesh code


2 replies to this topic

#1 Anddos

    Valued Member

  • Members
  • PipPipPip
  • 177 posts

Posted 20 October 2008 - 06:21 AM

so far i have the loading .x file code
but i am getting compile error's ,

//class

class CAllocateHierarchy: public ID3DXAllocateHierarchy 

{ 

public:	

    // callback to create a D3DXFRAME extended object and initialize it

    STDMETHOD( CreateFrame )(LPCSTR Name, LPD3DXFRAME *retNewFrame );


    // callback to create a D3DXMESHCONTAINER extended object and initialize it

    STDMETHOD( CreateMeshContainer )(LPCSTR Name, CONST D3DXMESHDATA * meshData, 

                            CONST D3DXMATERIAL * materials, CONST D3DXEFFECTINSTANCE * effectInstances,

                            DWORD numMaterials, CONST DWORD * adjacency, LPD3DXSKININFO skinInfo, 

                            LPD3DXMESHCONTAINER * retNewMeshContainer );


    // callback to release a D3DXFRAME extended object

    STDMETHOD( DestroyFrame )(LPD3DXFRAME frameToFree );


    // callback to release a D3DXMESHCONTAINER extended object

    STDMETHOD( DestroyMeshContainer )(LPD3DXMESHCONTAINER meshContainerToFree );

};


struct D3DXMESHCONTAINER_EXTENDED: public D3DXMESHCONTAINER

{

	// The base D3DXMESHCONTAINER has a pMaterials member which is a D3DXMATERIAL structure 

	// that contains a texture filename and material data. It is easier to ignore this and 

	// instead store the data in arrays of textures and materials in this extended structure:

    IDirect3DTexture9**  exTextures;		// Array of texture pointers  

	D3DMATERIAL9*		 exMaterials;		// Array of materials

                                

	// Skinned mesh variables

	ID3DXMesh*           exSkinMesh;			// The skin mesh

	D3DXMATRIX*			 exBoneOffsets;			// The bone matrix Offsets, one per bone

	D3DXMATRIX**		 exFrameCombinedMatrixPointer;	// Array of frame matrix pointers

};


/**

 * \struct D3DXFRAME_EXTENDED

 * \brief Structure derived from D3DXFRAME and extended so we can add some app-specific

 * info that will be stored with each frame. To help detect which data is extended and which is

 * from the base each variable begins with ex

 * \author Keith Ditchburn

*/

struct D3DXFRAME_EXTENDED: public D3DXFRAME

{

    D3DXMATRIX exCombinedTransformationMatrix;

};


void LoadXFileAnimation(char *filename)

{

	CAllocateHierarchy *memoryAllocator=new CAllocateHierarchy;

	LPD3DXFRAME m_pFrameRoot;

	LPD3DXANIMATIONCONTROLLER   AnimController;

	HRESULT hr;

	

    hr = D3DXLoadMeshHierarchyFromX(filename, 

		                            D3DXMESH_MANAGED, 

									m_d3dDevice, 

									memoryAllocator, 

									NULL, 

									&m_pFrameRoot, 

									&AnimController);

   

}


--------------------Configuration: animation - Win32 Debug--------------------
Compiling...
animation.cpp
Linking...
animation.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CAllocateHierarchy::DestroyMeshContainer(struct _D3DXMESHCONTAINER *)" (?DestroyMeshContainer@CAllocateHierarchy@@UAGJPAU_D3DXMESHCONTAINER@@@Z)
animation.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CAllocateHierarchy::DestroyFrame(struct _D3DXFRAME *)" (?DestroyFrame@CAllocateHierarchy@@UAGJPAU_D3DXFRAME@@@Z)
animation.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CAllocateHierarchy::CreateMeshContainer(char const *,struct _D3DXMESHDATA const *,struct _D3DXMATERIAL const *,struct _D3DXEFFECTINSTANCE const *,unsigned long
,unsigned long const *,struct ID3DXSkinInfo *,struct _D3DXMESHCONTAINER * *)" (?CreateMeshContainer@CAllocateHierarchy@@UAGJPBDPBU_D3DXMESHDATA@@PBU_D3DXMATERIAL@@PBU_D3DXEFFECTINSTANCE@@KPBKPAUID3DXSkinInfo@@PAPAU_D3DXMESHCONTAINER@@@Z)
animation.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CAllocateHierarchy::CreateFrame(char const *,struct _D3DXFRAME * *)" (?CreateFrame@CAllocateHierarchy@@UAGJPBDPAPAU_D3DXFRAME@@@Z)
Debug/animation.exe : fatal error LNK1120: 4 unresolved externals

#2 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 20 October 2008 - 07:34 AM

That's not a compile error, but a link error. You seem to be missing a source file or a library, one that contains the class CAllocateHierarchy.
http://iki.fi/sol - my schtuphh

#3 Anddos

    Valued Member

  • Members
  • PipPipPip
  • 177 posts

Posted 20 October 2008 - 08:18 AM

yeh ive got that fixed now but i am lost after loading x file , i have a frameroot and animatoncontroller





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users