- May 27, 2008 at 10:49 am #29532
I’ve written my own FBX to POD exporter. I’m trying to add animation support but I can’t understand how bones are linked to mesh :
for each mesh I fill sBoneIdx and sBoneWeight structures like this :
mesh.sBoneIdx.eType = EPODDataInt;
mesh.sBoneIdx.n = 4;
mesh.sBoneIdx.nStride = mesh.sBoneIdx.n * sizeof(int);
mesh.sBoneIdx.pData = (unsigned char*)malloc( mesh.sBoneIdx.nStride * mesh.nNumVertex);
mesh.sBoneWeight.eType = EPODDataFloat;
mesh.sBoneWeight.n = 4;
mesh.sBoneWeight.nStride = mesh.sBoneWeight.n * sizeof(int);
mesh.sBoneWeight.pData = (unsigned char*)malloc( mesh.sBoneWeight.nStride * mesh.nNumVertex);
next, for each vertex I fill sBoneIdx.pData with 4 index to SPODNode and sBoneWeight.pData with 4 weight float. I guess this is ok. If the vertex is not linked to a bone, its bone index will be 0 and its weight 0.
I don’t know how to fill sBoneBatches, this structure doesn’t mean anything to me.
If I try to load my pod with only sBoneIdx and sBoneWeight filled into PVRShaman, it crashes so I guess I must fill sBoneBatches.
One more thing, I’ve tried to export a simple bones animated scene from maya and to load it in PVRShaman, it loads but animations are not visible, the pod file seems to have all the necessary data so I guess this is a PVRShaman problem ?
I can release my FBX2POD source code if someone needs it, it’s dirty but works well and a little bit better than maya PODExporter (faster and less vertices).May 27, 2008 at 3:44 pm #32135
Hi,You should be able to simply clear sBoneBatches to zero. If it’s non-zero, PVRShaman will attempt to use the data, producing the crash you’re seeing.As an alternative to the code you’ve shown, note that you could also use PVRTModelPODDataStride() to set the strides, e.g:mesh.sBoneIdx.nStride = (unsigned int)PVRTModelPODDataStride(mesh.sBoneIdx);June 11, 2008 at 3:05 pm #32136
In fact sBoneBatches is cleared to zero. I’ve also tried to call sBoneBatches.Release() but it still crashes.