//#if Debug //static void dumpTriangles(ACTCEdge *e, FILE *fp) //{ // int i; // int c; // char v[12]; // c = fprintf(fp, " %d triangles: "); // for(i = 0; i < e.Triangles.Length; i++) { // if (c + 1 + sprintf(v, "%u", e.Triangles[i].FinalVert) > 78) { // fputs("\n", fp); // c = fprintf(fp, " "); // } // c += fprintf(fp, " %s", v); // } // fputs("\n", fp); //} //static void dumpEdges(ACTCVertex *vert, FILE *fp) //{ // int i; // int c; // char v[26]; /* two signed ints plus x plus NUL */ // for(i = 0; i < vert.Edges.Length; i++) { // fprintf(fp, " %u.%u (%d times)\n", vert.V, vert.Edges[i].V2.V, // vert.Edges[i].Count); // dumpTriangles(&vert.Edges[i], fp); // } // fputs("\n", fp); //} //static void dumpVertices(ACTCData *tc, FILE *fp) //{ // int i; // ACTCVertex *v; // if (!tc.UsingStaticVerts) // tableResetIterator(tc.VertexIterator); // fprintf(fp, "%d vertices in valences list\n", tc.VertexCount); // if (tc.UsingStaticVerts) { // for(i = 0; i < tc.VertRange; i++) { // v = &tc.StaticVerts[i]; // if (v.Count > 0) { // fprintf(fp, " vertex %u, valence %d, %d edges\n", v.V, // v.Count, v.Edges.Length); // dumpEdges(v, fp); // } // } // } else { // for(i = 0; i < tc.VertexCount; i++) { // if (tableIterate(tc.Vertices, tc.VertexIterator, null, // (void **)&v) == 0) { // fprintf(fp, "ACTC::dumpVertices : fewer vertices in the table " // "than we expected!\n"); // fprintf(stderr, "ACTC::dumpVertices : fewer vertices in the table " // "than we expected!\n"); // } // if (v == null) { // fprintf(fp, "ACTC::dumpVertices : did not expect to get a null" // "Vertex from the table iterator!\n"); // fprintf(stderr, "ACTC::dumpVertices : did not expect to get a null" // "Vertex from the table iterator!\n"); // } // fprintf(fp, " vertex %u, valence %d, %d edges\n", v.V, v.Count, // v.Edges.Length); // dumpEdges(v, fp); // } // } //} //static void dumpVertexBins(ACTCData *tc, FILE *fp) //{ // ACTCVertex *cur; // int i; // int c; // char v[26]; /* two signed ints plus x plus NUL */ // fprintf(fp, "vertex bins:\n"); // if (tc.VertexBins == null) { // fprintf(fp, " empty.\n"); // return; // } // for(i = 1; i <= tc.CurMaxVertValence; i++) { // cur = tc.VertexBins[i]; // c = fprintf(fp, " bin %d . ", i); // while(cur != null) { // if (c + 1 + sprintf(v, "%ux%d", cur.V, cur.Count) > 78) { // fputs("\n", fp); // c = fprintf(fp, " "); // } // c += fprintf(fp, " %s", v); // cur = cur.Next; // } // fputs("\n", fp); // } //} //void actcDumpState(ACTCData *tc, FILE *fp) //{ // dumpVertices(tc, fp); // dumpVertexBins(tc, fp); //} //static int abortWithOptionalDump(ACTCData *tc) //{ // (int)ACTC_.INFO(actcDumpState(tc, stderr)); // abort(); //} //#endif Debug static ACTC_var actcGetError(ACTCData tc) { ACTC_var error = tc.Error; tc.Error = ACTC_var.NO_ERROR; return(error); }
static ACTC_var actcParamu(ACTCData tc, ACTC_var param, uint value) { /* * XXX - yes, this is questionable, but I consulted industry * experts and we agreed that most common behavior is to copy the * bits directly, which is what I want. */ return(actcParami(tc, param, (int)value)); }
//public static void tableGetStats(TableRoot table, int totalBytes, int emptyCount, int totalCount) //{ // if (emptyCount != -1) // emptyCount = table.EmptyEntryCount; // if (totalCount != -1) // totalCount = (int)table.TotalEntryCount; // if (totalBytes != -1) // totalBytes = (int)table.TotalAllocatedBytes; //} ///* "table.c" ENDSNIPPET */ //#if !defined(MEM_CHART) //#define //chartedSetLabel(a) //#endif //#if defined(DEBUG) //#define ACTC_DEBUG(a) a //#else //#define ACTC_DEBUG(a) //#endif //#if defined(INFO) //#define ACTC_INFO(a) a //#else //#define ACTC_INFO(a) //#endif public static ACTC_var ACTC_CHECK(ACTC_var a) { ACTC_var theErrorNow; theErrorNow = a; if (theErrorNow < 0) { MessageBox.Show(a.ToString()); } return(theErrorNow); }
static ACTC_var actcGetParami(ACTCData tc, ACTC_var param, int *value) { switch (param) { case ACTC_var.MAJOR_VERSION: *value = 1; break; case ACTC_var.MINOR_VERSION: *value = 1; break; case ACTC_var.IN_MAX_VERT: *value = (int)tc.MaxInputVert; break; case ACTC_var.IN_MIN_VERT: *value = (int)tc.MinInputVert; break; case ACTC_var.IN_MAX_EDGE_SHARING: *value = tc.MaxEdgeShare; break; case ACTC_var.IN_MAX_VERT_SHARING: *value = tc.MaxVertShare; break; case ACTC_var.OUT_MIN_FAN_VERTS: *value = tc.MinFanVerts; break; case ACTC_var.OUT_HONOR_WINDING: *value = tc.HonorWinding; break; case ACTC_var.OUT_MAX_PRIM_VERTS: *value = tc.MaxPrimVerts; break; default: *value = 0; return(tc.Error = ACTC_var.INVALID_VALUE); } return(ACTC_var.NO_ERROR); }
static ACTC_var actcGetParamu(ACTCData tc, ACTC_var param, uint *value) { return(actcGetParami(tc, param, (int *)value)); }
static ACTC_var actcParami(ACTCData tc, ACTC_var param, int value) { if (tc.IsInputting != 0) { //(int)ACTC_.DEBUG(fprintf(stderr, "actcParami : within BeginInput/" // "EndInput\n");) return(tc.Error = ACTC_var.DURING_INPUT); } if (tc.IsOutputting != 0) { //(int)ACTC_.DEBUG(fprintf(stderr, "actcParami : within BeginOutput/" // "EndOutput\n");) return(tc.Error = ACTC_var.DURING_OUTPUT); } switch (param) { case ACTC_var.OUT_MIN_FAN_VERTS: tc.MinFanVerts = value; break; case ACTC_var.IN_MAX_VERT: if (value < tc.MinInputVert) { //(int)ACTC_.DEBUG(fprintf(stderr, "actcParami : tried to set " // "MAX_INPUT_VERT to %d, less than MIN_INPUT_VERT (%d)\n", // value, tc.MinInputVert);) return(tc.Error = ACTC_var.INVALID_VALUE); } tc.MaxInputVert = (uint)value; break; case ACTC_var.IN_MIN_VERT: if (value > tc.MaxInputVert) { //(int)ACTC_.DEBUG(fprintf(stderr, "actcParami : tried to set " // "MIN_INPUT_VERT to %d, greater than MAX_INPUT_VERT (%d)\n", // value, tc.MaxInputVert);) return(tc.Error = ACTC_var.INVALID_VALUE); } tc.MinInputVert = (uint)value; break; case ACTC_var.IN_MAX_EDGE_SHARING: tc.MaxEdgeShare = value; break; case ACTC_var.IN_MAX_VERT_SHARING: tc.MaxVertShare = value; break; case ACTC_var.OUT_HONOR_WINDING: tc.HonorWinding = value; break; case ACTC_var.OUT_MAX_PRIM_VERTS: if (value < 3) { //(int)ACTC_.DEBUG(fprintf(stderr, "actcParami : tried to set " // "MAX_PRIM_VERTS to %d (needed to be 3 or more)\n", value);) return(tc.Error = ACTC_var.INVALID_VALUE); } tc.MaxPrimVerts = value; break; } return(ACTC_var.NO_ERROR); }