• ### What is your GameDev Story?

This topic is 4883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok, so I get parser errors while using D3DXLoadMeshFromX(), and I'm told that the parser has been rewritten in dx9 to be more strict, that I should parse my .x files manually. So, I have a simple cube exported from Blender. D3DXLoadMeshFromX loads the mesh! However, if I try to use the ID3DXFile interfaces, it all comes tumbling down.. Here is my results with particular functions so far: D3DXFileCreate(): S_OK. Works. No problems here. ID3DXFile::RegisterTemplates(): D3DXFERR_PARSEERROR. This doesn't work period. Copying from the example in the SDK doesn't work either. My file doesn't contain the template headers, so do I even need to use this? What am I doing wrong? See code further down. CreateEnumObjects(): S_OK. This actually works! So I at least have something right... I think... ID3DXFileEnumObject::GetChildren(): S_OK. Works, except it always returns 0. ID3DXFileEnumObject::GetChild(0, e): D3DXFERR_NOMOREOBJECTS. Well, I expected that after getting 0 with the last call. Here is my code.. it's not spectacular, nor is it really any different from all the examples I've seen, except that it doesn't work.
//
bool ParseX::Paser(char *Xfilename,void **pData)
{
LPD3DXFILE lpd3dxfile;
LPD3DXFILEENUMOBJECT lpd3dxfilenumobj;
LPD3DXFILEDATA lpd3dxfiledata;

//
if (NULL==Xfilename)
return false;

//
HRESULT hr=D3DXFileCreate(&lpd3dxfile);
if FAILED(hr)
return false;

//
hr=lpd3dxfile-&gt;RegisterTemplates( (LPVOID)XSKINEXP_TEMPLATES, sizeof( XSKINEXP_TEMPLATES ) - 1);//strlen(XSKINEXP_TEMPLATES));
if FAILED(hr)
{
lpd3dxfile-&gt;Release();

DXTRACE_ERR("RegisterTemplates:=",hr);
return false;
}

[Edited by - Coder on September 9, 2005 2:53:40 AM]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 10
• 9
• 34
• 16
• ### Forum Statistics

• Total Topics
634125
• Total Posts
3015669
×