Sign in to follow this  
CCF

Programming RPG with DX 2nd edition book problem

Recommended Posts

Hi there, I'm having trouble with the .X file animation loading function on this book. I've done some search, and modified most of the codes to the new DX9 interface for .X parsing, but I'm still getting error compiling it. This is the error message I'm getting:
c:\Documents and Settings\Administrator\My Documents\DirectX9
Sandbox\CoreGraphics.cpp(2327): error
C2664: 'IDirectXFileEnumObject::GetNextDataObject' : cannot convert parameter 1
from 'ID3DXFileData **__w64  ' to 'LPDIRECTXFILEDATA * '
The error occurs on this part of the code (marked as ERROR HERE):
bool Animation::Load(char *filename, Mesh *mapMesh)
{
	IDirectXFile			*pDXFile = NULL;
	IDirectXFileEnumObject		*pDXEnum = NULL;
	ID3DXFileData			*pDXData = NULL;
	  
	// Free a prior animation
	Free();

	// Error checking
	if (filename == NULL)
		return FALSE;

	// Create the file object
	if (FAILED(DirectXFileCreate(&pDXFile)))
		return FALSE;

	// Register the templates
	if (FAILED(pDXFile->RegisterTemplates((LPVOID)D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES)))
	{
		pDXFile->Release();
		return FALSE;
	}

	// Create an enumeration object
	if (FAILED(pDXFile->CreateEnumObject((LPVOID)filename, DXFILELOAD_FROMFILE, &pDXEnum)))
	{
		pDXFile->Release();
		return FALSE;
	}

	// ******** ERROR HERE
	// Loop through all objects looking for the animation
	while (SUCCEEDED(pDXEnum->GetNextDataObject(&pDXData)))
	{
		ParseXFileData(pDXData, NULL, NULL);
		ReleaseCOM(pDXData);
	}
.
.   // *snip*
.
}

I've check the below pages, but none of them deals with this part of the code, unfortunately... http://www.gamedev.net/community/forums/topic.asp?topic_id=388255&PageSize=25&WhichPage=1 http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=104342&SiteID=1 Anyone knows what's wrong? Or did I mess up somewhere else? Thanks!

Share this post


Link to post
Share on other sites
I'm working trough this book, too. And encountered this problem. Because I'm writing my own rpg in parallel it is not so hard for me, I'll just write the x file handling stuff with the newer interfaces.
An excellent article about the ne ID3DX* interfaces is http://www.moon-labs.com/resources/d3dx_skinnedmesh.pdf
but it uses a shader for vertex blending. To use the fixed function pipeline for vertex blending you can find some information about it in this article http://www.xmission.com/~legalize/book/download/06-Vertex%20Transformations.pdf

Share this post


Link to post
Share on other sites
Finally found some time to look into this again. Thanks for the replies guys [smile]

I've successfully (or I think I have) replaced all the old interface with the new ones. It compiles without any errors but now there's another problem! Skin mesh isn't animating. It's just stucked at it's default T-figure pose. Anyone had the same problem?

Below is the code that I use to load and apply animation to the model, but I don't think the problem is located here...

The model is from the book's CD, I've checked that the animation name is correct, and the currentTicks timer is incrementing every loop... I'm out of ideas at the moment on how to fix this. Anyone who's familiar with the book, a point in the right direction would be greatly appreciated. Thanks! [smile]


// ** Inside initialize function
// Loading model
m_mesh.Load(&m_graphics, "warrior.x");

// Load anim and loop walk anim
m_anim.Load("warrior.x", &m_mesh);
m_anim.SetLoop(TRUE, "Walk");

// Create and position object
m_object.Create(&m_graphics, &m_mesh);
m_object.Move(0.0f, 0.0f, 300.0f);

// Apply walk anim to object
m_object.SetAnimation(&m_anim, "Walk", currentTicks);


// ** Inside render loop
m_object.UpdateAnimation(currentTicks, TRUE);
m_object.Render();



* if mods think this better belongs to the DirectX forum, please move the thread for me. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this