void akMeshLoaderUtils_getSmoothFaces(Blender::Mesh* bmesh, utArray<utArray<UTuint32> >& faces) { faces.resize(bmesh->totvert); for (int i = 0; i< bmesh->totvert; i++) { for (int j = 0; j< bmesh->totface; j++) { const Blender::MFace& bface = bmesh->mface[j]; if( (bface.flag & ME_SMOOTH) && (bface.v1 == i || bface.v2 == i || bface.v3 == i || bface.v4 == i )) { faces[i].push_back(j); } } } }
void akMeshLoaderUtils_getShapeKeysNormals(Blender::Mesh* bmesh, UTuint32 numshape, utArray<btAlignedObjectArray<akVector3> >& shapenormals) { Blender::Key* bk = bmesh->key; if(bk) { shapenormals.resize(numshape); Blender::KeyBlock* bkb = (Blender::KeyBlock*)bk->block.first; // skip first shape key (basis) UTuint32 shape=0; if(bkb) bkb = bkb->next; while(bkb) { if(bkb->type == KEY_RELATIVE) { Blender::KeyBlock* basis = (Blender::KeyBlock*)bk->block.first; for(int i=0; basis && i<bkb->relative; i++) basis = basis->next; if(basis) { float* pos = (float*)bkb->data; shapenormals[shape].resize(bmesh->totface); for(int i=0; i<bmesh->totface; i++) { const Blender::MFace& bface = bmesh->mface[i]; akVector3 normal = akMeshLoaderUtils_calcMorphNormal(bface, pos); shapenormals[shape][i]=normal; } shape++; } } bkb = bkb->next; } } }