#include #include #include FILE *f = NULL; float width; int count = 0; SHADEOP_CLEANUP(facehair_cleanup) { if(f != NULL) { fprintf(f, "## hair count: %d \n", count); fclose(f); count = 0; } f = NULL; } SHADEOP_TABLE(facehair) = { { "float facehair (string, point, point, point, float,float)", "", "facehair_cleanup" }, { "" } }; SHADEOP (facehair) { STRING_DESC *filepath = (STRING_DESC *)argv[1]; float *base = (float *)argv[2]; float *mid = (float *)argv[3]; float *tip = (float *)argv[4]; float basewidth = *(float *)argv[5]; float tipwidth = *(float *)argv[6]; if(f == NULL) { f = fopen(filepath->s, "w"); fprintf(f, "Basis \"bezier\" 3 \"bezier\" 3\n"); count = 0; } fprintf(f, "Curves \"cubic\" [4] \"nonperiodic\" \"P\" "); fprintf(f, "[%1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f %1.3f] ", base[0], base[1], base[2], mid[0], mid[1], mid[2], mid[0], mid[1], mid[2], tip[0], tip[1], tip[2]); fprintf(f, "\"width\" [%1.3f %1.3f]\n", basewidth, tipwidth); count++; return 0; }