custom maya exporter writing decldata

Recommended Posts

Hello, I'm writing a Maya .x exporter and I'm currently working on outputting the DeclData. I'm not quite sure how the data is supposed to be formatted. I have the tangents and binormals both in their own MVectorArray's (Maya API class for 3 floats). The exporter that ships with the sdk writes this: DeclData { 2; 2;0;6;0;, 2;0;7;0;; 24; 1065353216, 414956846, 851164462, 2998648110, 2776629248, 3212836864, ... The data that I export is: DeclData { 2; 2;0;6;0;, 2;0;7;0;; 24; 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, -1.000000, ... So, I'm guessing I need to change my floats into the format that is exported by the sdk exporter. My question is what format is the DeclData supposed to be stored as and how can I convert my data to that format?

Share on other sites
I don't think you should try to export the BINORMALS and TANGENTS, because you can easily use the D3DX functions (D3DXComputeTangentFrameEx or D3DXComputeTangent) to generate them for you. I have seen the same thing happen when I used the D3DXSaveMeshToX to save a mesh with them (ending up in decldata). Even the DX functions have no idea what to do with them.

Share on other sites
Oh well, I think I just figured it out anyways. I had to convert the doubles to floats and then the &floats to DWORD*'s and output the DWORDs.

float tx = (float)(tangents[i].x);DWORD * dtx = (DWORD*)(&tx);float ty = (float)(tangents[i].y);DWORD * dty = (DWORD*)(&ty);float tz = (float)(tangents[i].z);DWORD * dtz = (DWORD*)(&tz);float bx = (float)(binormals[i].x);DWORD * btx = (DWORD*)(&bx);float by = (float)(binormals[i].y);DWORD * bty = (DWORD*)(&by);float bz = (float)(binormals[i].z);DWORD * btz = (DWORD*)(&bz);

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

• Forum Statistics

• Total Topics
627767
• Total Posts
2978991

• 11
• 10
• 10
• 23
• 14