#include #include "xtools.h" int main(int argc, char** argv) { char buf[LNAME]; int i, j, vnum, fnum; unsigned char u8; unsigned short u16; short int s16; unsigned int u32; int s32; int hasWeights, hasDetailTexCoords; float* vertex = NULL; short* face = NULL; float* weight = NULL; if (argc<3) { print_message("Usage ... %s -f llm_file [-m morph_name]\n", argv[0]); exit(0); } // 引数処理 Buffer fname = make_Buffer(LNAME); Buffer morph = make_Buffer_str("Normal"); for (i=1; i %f\n", i, weight[i]); //fseek(fp, 4*vnum, SEEK_CUR); } // FACE fread(&u16, 2, 1, fp); fnum = (int)u16; printf("FACE NUM = %d\n", fnum); face = (short*)malloc(6*fnum); if (face==NULL) { free(vertex); free(weight); print_message("No More Momory of Face.\n"); exit(1); } fread(face, 6, fnum, fp); // SKIN if (hasWeights) { fread(&u16, 2, 1, fp); int wnum = (int)u16; //fseek(fp, 64*wnum, SEEK_CUR); printf("SKIN NUM = %d\n", wnum); for (i=0; i=3*vnum) { print_message("Algorithm Error!! %d>%d\n", index+2, vnum); fclose(wf); exit(1); } float xx = vertex[index]; float yy = vertex[index+1]; float zz = vertex[index+2]; fprintf(wf, " vertex %f %f %f\n", xx, yy, zz); } fprintf(wf, "endloop\n"); fprintf(wf, "endfacet\n"); } } fprintf(wf, "endsolid %s\n", morph.buf); fclose(wf); free_Buffer(&morph); free_Buffer(&stlfn); free(vertex); free(weight); free(face); return 0; }