I thought of quicksorting the faceindices from the very beginning but for some unknown reason
I feared there'd be a reason for their scrambling and Qsort would spoil erverything.
gosh, it didn't.
Only problem is the multitexture for the body_a4 submesh.
Still no clue how to separate them other than manually placing "g forced_submesh_a4_x" lines.
(Also I've the strange feeling that we need to figure out the difference between material submeshes
and lod submeshes.)
Be informed that the quicksort version can handle ONE modelbin file only so far. You wouldn't believe about the simplicity of the code used for creating the groups, would you?
Code: Select all
for (i=0;i<FIcnt/3;i++) indArr[i]= i ;
quickSort((int*)FImedian, (int*)indArr, 0, FIcnt/3) ;
cntEx= 0 ;
for (i=0;i<FIcnt/3;i++) {
a= FIarr[0][indArr[i]] ; b= FIarr[1][indArr[i]] ; c= FIarr[2][indArr[i]] ;
if (((a+b+c)/3 > dwUVsum[cntEx])&&(cntEx<cntMax)) { // next Material-Submesh
_itoa(cntEx, szNo, 10) ; //
strcpy(szFileName, szTmp) ; strcat(szFileName, szNo) ;
if (bUV_28[cntEx+1]) strcat(szFileName, "_UVB28") ; // +1, warum auch immer
fprintf( stream, "g %s\n", szFileName) ;
cntEx++ ;
}
fprintf( stream, "f %d/%d %d/%d %d/%d\n", a,a, b,b, c,c) ;
}