/*!*********************************************************************** @Function FillBatch @Modified batch The batch to fill @Input pui32Idx Input index array for triangle list @Input pVtx Input vertices @Input nStride Size of a vertex (in bytes) @Input nOffsetWeight Offset in bytes to the vertex bone-weights @Input eTypeWeight Data type of the vertex bone-weights @Input nOffsetIdx Offset in bytes to the vertex bone-indices @Input eTypeIdx Data type of the vertex bone-indices @Input nVertexBones Number of bones affecting each vertex @Returns True if successful @Description Creates a bone batch from a triangle. *************************************************************************/ static bool FillBatch( CBatch &batch, const unsigned int * const pui32Idx, const char * const pVtx, const int nStride, const int nOffsetWeight, EPVRTDataType eTypeWeight, const int nOffsetIdx, EPVRTDataType eTypeIdx, const int nVertexBones) { PVRTVECTOR4 vWeight, vIdx; const char *pV; int i; bool bOk; bOk = true; batch.Clear(); for(i = 0; i < 3; ++i) { pV = &pVtx[pui32Idx[i] * nStride]; memset(&vWeight, 0, sizeof(vWeight)); PVRTVertexRead(&vWeight, &pV[nOffsetWeight], eTypeWeight, nVertexBones); PVRTVertexRead(&vIdx, &pV[nOffsetIdx], eTypeIdx, nVertexBones); if(nVertexBones >= 1 && vWeight.x != 0) bOk &= batch.Add((int)vIdx.x); if(nVertexBones >= 2 && vWeight.y != 0) bOk &= batch.Add((int)vIdx.y); if(nVertexBones >= 3 && vWeight.z != 0) bOk &= batch.Add((int)vIdx.z); if(nVertexBones >= 4 && vWeight.w != 0) bOk &= batch.Add((int)vIdx.w); } return bOk; }
/**************************************************************************** * Function Name : FillBatch * Inputs : * Returns : * Description : Creates a bone batch from a triangle. ****************************************************************************/ static bool FillBatch( CBatch &batch, const unsigned short * const pwIdx, // input index array for triangle list const char * const pVtx, // Input vertices const int nStride, // Size of a vertex (in bytes) const int nOffsetWeight, // Offset in bytes to the vertex bone-weights EPVRTDataType eTypeWeight, // Data type of the vertex bone-weights const int nOffsetIdx, // Offset in bytes to the vertex bone-indices EPVRTDataType eTypeIdx, // Data type of the vertex bone-indices const int nVertexBones) // Number of bones affecting each vertex { PVRTVECTOR4 vWeight, vIdx; const char *pV; int i; bool bOk; bOk = true; batch.Clear(); for(i = 0; i < 3; ++i) { pV = &pVtx[pwIdx[i] * nStride]; memset(&vWeight, 0, sizeof(vWeight)); PVRTDataTypeRead(&vWeight, &pV[nOffsetWeight], eTypeWeight, nVertexBones); PVRTDataTypeRead(&vIdx, &pV[nOffsetIdx], eTypeIdx, nVertexBones); if(nVertexBones >= 1 && vWeight.x != 0) bOk &= batch.Add((int)vIdx.x); if(nVertexBones >= 2 && vWeight.y != 0) bOk &= batch.Add((int)vIdx.y); if(nVertexBones >= 3 && vWeight.z != 0) bOk &= batch.Add((int)vIdx.z); if(nVertexBones >= 4 && vWeight.w != 0) bOk &= batch.Add((int)vIdx.w); } return bOk; }