custom maya exporter writing decldata

Started by
1 comment, last by chadmv 17 years, 9 months ago
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?
Advertisement
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.
--------------------------Most of what I know came from Frank D. Luna's DirectX books
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.x);DWORD * dtx = (DWORD*)(&tx);float ty = (float)(tangents.y);DWORD * dty = (DWORD*)(&ty);float tz = (float)(tangents.z);DWORD * dtz = (DWORD*)(&tz);float bx = (float)(binormals.x);DWORD * btx = (DWORD*)(&bx);float by = (float)(binormals.y);DWORD * bty = (DWORD*)(&by);float bz = (float)(binormals.z);DWORD * btz = (DWORD*)(&bz);

This topic is closed to new replies.

Advertisement