Eosie

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Eosie

  • Rank
    Newbie
  1. Your code does not work with one value - 1. You always get 0 after decoding because frac(1) = 0.
  2. 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(&num, 4); // sizeof(DWORD) == 4 num = texcoords2->SizeOfData() / 4; // number of DWORDs buf.Push(&num, 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.