Skip to main content
GameDev.net gamedev.net
🔒 Locked

X mesh saving & FVFData

Started by Eosie Apr 10, 2007 at 7:11 PM 0 replies 1.7k views
Original Post
Eosie
Eosie
Hi, I am working on a .X mesh saving using ID3DXFile and have troubles with the second texture coordinates. I am saving them using FVFData template however ID3DXFileSaveData::AddDataObject returns D3DXFERR_BADTYPE which does not make any sense to me and there is no more debugging info in the output window. But loading of these texture coordinates directly from FVFData works fine. The code of the registered template:
template FVFData
{
    <B6E70A0E-8EF9-4E83-94AD-ECC8B0C04897>
    DWORD dwFVF;
    DWORD nDWords;
    array DWORD data[nDWords];
}
FVFData is not defined in rmxfguid.h so I have to do it manually:
#define INITGUID
#include <d3dx9.h>
#include <rmxfguid.h>
DEFINE_GUID(TID_D3DRMFVFData, 0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97);
And finally, the main code:
// buf here is something like a memory stream
num = D3DFVF_TEX1 & D3DFVF_XYZ;         // dwFVF
buf.Push(#, 4);                      // sizeof(DWORD) == 4
num = texcoords2->SizeOfData() / 4;     // number of DWORDs
buf.Push(#, 4);
buf.Push(texcoords2->GetPtr(), texcoords2->SizeOfData());   // push the data

CDXPointer<ID3DXFileSaveData> texcoordData;
// always returns D3DXFERR_BADTYPE:
CHECK(mesh->AddDataObject(TID_D3DRMFVFData, 0, 0, m_buf.SizeOfData(), m_buf.GetData(), &texcoordData));
Am I doing anything wrong? And no, I dont want to use ID3DXMesh.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.