void cMesh::ParseXFileData(ID3DXFileData *pDataObj, sFrame *ParentFrame, char *TexturePath)
{
GUID *Type = NULL;
char *Name = NULL;
DWORD Size;
sFrame *SubFrame = NULL;
char Path[MAX_PATH];
sFrame *Frame = NULL;
D3DXMATRIX *FrameMatrix = NULL;
sMesh *Mesh = NULL;
ID3DXBuffer *MaterialBuffer = NULL;
D3DXMATERIAL *Materials = NULL;
ID3DXBuffer *Adjecancy = NULL;
DWORD *ADjecancyIn = NULL;
DWORD *AdjecancyOut = NULL;
DWORD i;
BYTE **Ptr;
if(FAILED(pDataObj->GetType(Type))) { return; }
if(FAILED(pDataObj->GetName(NULL, &Size))) { return; }
if(Size)
{
if((Name = new char[Size]) != NULL) { pDataObj->GetName(Name, &Size); }
}
if(Name == NULL)
{
if((Name = new char[9]) == NULL) { return; }
strcpy(Name, "%NoName%");
}
SubFrame = ParentFrame;
if(*Type == TID_D3DRMFrame)
{
Frame = new sFrame();
Frame->m_Name = Name;
Name = NULL;
Frame->m_Parent = ParentFrame;
Frame->m_Sibling = ParentFrame->m_Child;
ParentFrame->m_Child = Frame;
m_NumFrames++;
SubFrame = Frame;
}
if(*Type == TID_D3DRMFrameTransformationMatrix)
{
if(FAILED(pDataObj->GetData(NULL, &Size, (PVOID*)&FrameMatrix))) { return; }
ParentFrame->m_MatOriginal = *FrameMatrix;
}
}
IDirectXFileData-GetData() - Deprecated!
Hello,
I'll cut straight to the chase. I have a ParseXFileData function, which (of course) parses XFiles for their data. It first gives a call to ID3DXFileData->GetType() and stores the information into a GUID *Type. Then all the possible Types are checked:
Most of the function isn't that important but the last part of the function gives some errors. I'm converting code from a book that uses DirectX 9.0a so instead of IDirectXFileData I use ID3DXFileData. The problem is that ID3DXFileData doesn't have a GetData() function as used in the last part of the code.
Can someone help to convert this part to DirectX SDK9.0c?
(Also: I use C++, MVSC++, and the books' "programming Role Playing Games with DirectX")
-Stenny
If I'm not wrong, this should be it [smile]
I've changed this line as well (removing the * pointer), not sure if it's necessary:
if (Type == TID_D3DRMFrameTransformMatrix){ BYTE** DataPtr = NULL; if (FAILED(pDataObj->Lock(&Size, (LPCVOID*)&DataPtr))) return; memcpy(&ParentFrame->m_MatOriginal, (void*)DataPtr, Size); pDataObj->Unlock();}
I've changed this line as well (removing the * pointer), not sure if it's necessary:
GUID Type = GUID_NULL;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement