Go to the source code of this file.
Functions | |
static void | FUNC (ARGS, unsigned count) |
static void FUNC | ( | ARGS | , | |
unsigned | count | |||
) | [static] |
Definition at line 3 of file draw_pt_decompose.h.
References assert, DRAW_PIPE_EDGE_FLAG_0, DRAW_PIPE_EDGE_FLAG_1, DRAW_PIPE_EDGE_FLAG_2, DRAW_PIPE_EDGE_FLAG_ALL, DRAW_PIPE_RESET_STIPPLE, FLUSH, LINE, LOCAL_VARS, PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, PIPE_PRIM_TRIANGLES, POINT, QUAD, and TRIANGLE.
00005 { 00006 LOCAL_VARS; 00007 00008 switch (prim) { 00009 case PIPE_PRIM_POINTS: 00010 for (i = 0; i < count; i ++) { 00011 POINT( (i + 0) ); 00012 } 00013 break; 00014 00015 case PIPE_PRIM_LINES: 00016 for (i = 0; i+1 < count; i += 2) { 00017 LINE( DRAW_PIPE_RESET_STIPPLE, 00018 (i + 0), 00019 (i + 1)); 00020 } 00021 break; 00022 00023 case PIPE_PRIM_LINE_LOOP: 00024 if (count >= 2) { 00025 flags = DRAW_PIPE_RESET_STIPPLE; 00026 00027 for (i = 1; i < count; i++, flags = 0) { 00028 LINE( flags, 00029 (i - 1), 00030 (i )); 00031 } 00032 00033 LINE( flags, 00034 (i - 1), 00035 (0 )); 00036 } 00037 break; 00038 00039 case PIPE_PRIM_LINE_STRIP: 00040 flags = DRAW_PIPE_RESET_STIPPLE; 00041 for (i = 1; i < count; i++, flags = 0) { 00042 LINE( flags, 00043 (i - 1), 00044 (i )); 00045 } 00046 break; 00047 00048 case PIPE_PRIM_TRIANGLES: 00049 for (i = 0; i+2 < count; i += 3) { 00050 TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, 00051 (i + 0), 00052 (i + 1), 00053 (i + 2 )); 00054 } 00055 break; 00056 00057 case PIPE_PRIM_TRIANGLE_STRIP: 00058 if (flatfirst) { 00059 for (i = 0; i+2 < count; i++) { 00060 TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, 00061 (i + 0), 00062 (i + 1 + (i&1)), 00063 (i + 2 - (i&1))); 00064 } 00065 } 00066 else { 00067 for (i = 0; i+2 < count; i++) { 00068 TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, 00069 (i + 0 + (i&1)), 00070 (i + 1 - (i&1)), 00071 (i + 2 )); 00072 } 00073 } 00074 break; 00075 00076 case PIPE_PRIM_TRIANGLE_FAN: 00077 if (count >= 3) { 00078 if (flatfirst) { 00079 for (i = 0; i+2 < count; i++) { 00080 TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, 00081 (i + 1), 00082 (i + 2), 00083 (0 )); 00084 } 00085 } 00086 else { 00087 for (i = 0; i+2 < count; i++) { 00088 TRIANGLE( DRAW_PIPE_RESET_STIPPLE | DRAW_PIPE_EDGE_FLAG_ALL, 00089 (0), 00090 (i + 1), 00091 (i + 2 )); 00092 } 00093 } 00094 } 00095 break; 00096 00097 00098 case PIPE_PRIM_QUADS: 00099 for (i = 0; i+3 < count; i += 4) { 00100 QUAD( (i + 0), 00101 (i + 1), 00102 (i + 2), 00103 (i + 3)); 00104 } 00105 break; 00106 00107 case PIPE_PRIM_QUAD_STRIP: 00108 for (i = 0; i+3 < count; i += 2) { 00109 QUAD( (i + 2), 00110 (i + 0), 00111 (i + 1), 00112 (i + 3)); 00113 } 00114 break; 00115 00116 case PIPE_PRIM_POLYGON: 00117 { 00118 /* These bitflags look a little odd because we submit the 00119 * vertices as (1,2,0) to satisfy flatshade requirements. 00120 */ 00121 const ushort edge_first = DRAW_PIPE_EDGE_FLAG_2; 00122 const ushort edge_middle = DRAW_PIPE_EDGE_FLAG_0; 00123 const ushort edge_last = DRAW_PIPE_EDGE_FLAG_1; 00124 00125 flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle; 00126 00127 for (i = 0; i+2 < count; i++, flags = edge_middle) { 00128 00129 if (i + 3 == count) 00130 flags |= edge_last; 00131 00132 TRIANGLE( flags, 00133 (i + 1), 00134 (i + 2), 00135 (0)); 00136 } 00137 } 00138 break; 00139 00140 default: 00141 assert(0); 00142 break; 00143 } 00144 00145 FLUSH; 00146 }