void draw_segment_color (int ncp, /* number of contour points */ gleDouble front_contour[][3], gleDouble back_contour[][3], float color_last[3], float color_next[3], int inext, double len) { int j; /* draw the tube segment */ BGNTMESH (inext, len); for (j=0; j<ncp; j++) { C3F (color_last); V3F (front_contour[j], j, FRONT); C3F (color_next); V3F (back_contour[j], j, BACK); } if (__TUBE_CLOSE_CONTOUR) { /* connect back up to first point of contour */ C3F (color_last); V3F (front_contour[0], 0, FRONT); C3F (color_next); V3F (back_contour[0], 0, BACK); } ENDTMESH (); }
void draw_binorm_segment_edge_n (int ncp, /* number of contour points */ double front_contour[][3], double back_contour[][3], double front_norm[][3], double back_norm[][3], int inext, double len) { int j; /* draw the tube segment */ BGNTMESH (inext, len); for (j=0; j<ncp; j++) { N3F_D (front_norm[j]); V3F_D (front_contour[j], j, FRONT); N3F_D (back_norm[j]); V3F_D (back_contour[j], j, BACK); } if (__TUBE_CLOSE_CONTOUR) { /* connect back up to first point of contour */ N3F_D (front_norm[0]); V3F_D (front_contour[0], 0, FRONT); N3F_D (back_norm[0]); V3F_D (back_contour[0], 0, BACK); } ENDTMESH (); }
void draw_segment_facet_n (int ncp, /* number of contour points */ gleDouble front_contour[][3], gleDouble back_contour[][3], double norm_cont[][3], int inext, double len) { int j; /* draw the tube segment */ BGNTMESH (inext, len); for (j=0; j<ncp-1; j++) { N3F_D (norm_cont[j]); V3F (front_contour[j], j, FRONT); V3F (back_contour[j], j, BACK); V3F (front_contour[j+1], j+1, FRONT); V3F (back_contour[j+1], j+1, BACK); } if (__TUBE_CLOSE_CONTOUR) { /* connect back up to first point of contour */ N3F_D (norm_cont[ncp-1]); V3F (front_contour[ncp-1], ncp-1, FRONT); V3F (back_contour[ncp-1], ncp-1, BACK); V3F (front_contour[0], 0, FRONT); V3F (back_contour[0], 0, BACK); } ENDTMESH (); }
void draw_binorm_segment_c_and_facet_n (int ncp, double front_contour[][3], double back_contour[][3], double front_norm[][3], double back_norm[][3], float color_last[3], float color_next[3], int inext, double len) { int j; /* draw the tube segment */ BGNTMESH (inext, len); for (j=0; j<ncp-1; j++) { C3F (color_last); N3F_D (front_norm[j]); V3F_D (front_contour[j], j, FRONT); C3F (color_next); N3F_D (back_norm[j]); V3F_D (back_contour[j], j, BACK); C3F (color_last); N3F_D (front_norm[j]); V3F_D (front_contour[j+1], j+1, FRONT); C3F (color_next); N3F_D (back_norm[j]); V3F_D (back_contour[j+1], j+1, BACK); } if (__TUBE_CLOSE_CONTOUR) { /* connect back up to first point of contour */ C3F (color_last); N3F_D (front_norm[ncp-1]); V3F_D (front_contour[ncp-1], ncp-1, FRONT); C3F (color_next); N3F_D (back_norm[ncp-1]); V3F_D (back_contour[ncp-1], ncp-1, BACK); C3F (color_last); N3F_D (front_norm[ncp-1]); V3F_D (front_contour[0], 0, FRONT); C3F (color_next); N3F_D (back_norm[ncp-1]); V3F_D (back_contour[0], 0, BACK); } ENDTMESH (); }
/* * This little routine draws the little idd-biddy fillet triangle with * the right color, normal, etc. * * HACK ALERT -- there are two aspects to this routine/interface that * are "unfinished". * 1) the third point of the triangle should get a color thats * interpolated beween the front and back color. The interpolant * is not currently being computed. The error introduced by not * doing this should be tiny and/or non-exitant in almost all * expected uses of this code. * * 2) additional normal vectors should be supplied, and these should * be interpolated to fit. Currently, this is not being done. As * above, the expected error of not doing this should be tiny and/or * non-existant in almost all expected uses of this code. */ static void draw_fillet_triangle_n_norms (gleDouble va[3], gleDouble vb[3], gleDouble vc[3], int face, float front_color[3], float back_color[3], double na[3], double nb[3]) { if (front_color != NULL) C3F (front_color); BGNTMESH (-5, 0.0); if (__TUBE_DRAW_FACET_NORMALS) { N3F_D (na); if (face) { V3F (va, -1, FILLET); V3F (vb, -1, FILLET); } else { V3F (vb, -1, FILLET); V3F (va, -1, FILLET); } V3F (vc, -1, FILLET); } else { if (face) { N3F_D (na); V3F (va, -1, FILLET); N3F_D (nb); V3F (vb, -1, FILLET); } else { N3F_D (nb); V3F (vb, -1, FILLET); N3F_D (na); V3F (va, -1, FILLET); N3F_D (nb); } V3F (vc, -1, FILLET); } ENDTMESH (); }
/* ARGSUSED6 */ static void draw_fillet_triangle_plain (gleDouble va[3], gleDouble vb[3], gleDouble vc[3], int face, float front_color[3], float back_color[3]) { if (front_color != NULL) C3F (front_color); BGNTMESH (-5, 0.0); if (face) { V3F (va, -1, FILLET); V3F (vb, -1, FILLET); } else { V3F (vb, -1, FILLET); V3F (va, -1, FILLET); } V3F (vc, -1, FILLET); ENDTMESH (); }
void draw_segment_c_and_facet_n (int ncp, /* number of contour points */ gleDouble front_contour[][3], gleDouble back_contour[][3], double norm_cont[][3], float color_last[3], float color_next[3], int inext, double len) { int j; /* Note about this code: * At first, when looking at this code, it appears to be really dumb: * the N3F() call appears to be repeated multiple times, for no * apparent purpose. It would seem that a performance improvement * would be gained by stripping it out. !DONT DO IT! * When there are no local lights or viewers, the V3F() subroutine * does not trigger a recalculation of the lighting equations. * However, we MUST trigger lighting, since otherwise colors come out * wrong. Trigger lighting by doing an N3F call. */ /* draw the tube segment */ BGNTMESH (inext, len); for (j=0; j<ncp-1; j++) { C3F (color_last); N3F_D (norm_cont[j]); V3F (front_contour[j], j, FRONT); C3F (color_next); N3F_D (norm_cont[j]); V3F (back_contour[j], j, BACK); C3F (color_last); N3F_D (norm_cont[j]); V3F (front_contour[j+1], j+1, FRONT); C3F (color_next); N3F_D (norm_cont[j]); V3F (back_contour[j+1], j+1, BACK); } if (__TUBE_CLOSE_CONTOUR) { /* connect back up to first point of contour */ C3F (color_last); N3F_D (norm_cont[ncp-1]); V3F (front_contour[ncp-1], ncp-1, FRONT); C3F (color_next); N3F_D (norm_cont[ncp-1]); V3F (back_contour[ncp-1], ncp-1, BACK); C3F (color_last); N3F_D (norm_cont[ncp-1]); V3F (front_contour[0], 0, FRONT); C3F (color_next); N3F_D (norm_cont[ncp-1]); V3F (back_contour[0], 0, BACK); } ENDTMESH (); }