/* * Flat shaded, width=1, non-stippled, color index line. */ static void flat_ci_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLint x1 = (GLint) VB->Win[v1][0]; GLint y1 = (GLint) VB->Win[v1][1]; GLint x2 = (GLint) VB->Win[v2][0]; GLint y2 = (GLint) VB->Win[v2][1]; GLint n; PB_SET_INDEX( ctx, PB, VB->Index[pv] ); /* compute pixel locations */ n = gl_bresenham( ctx, x1, y1, x2, y2, PB->x+PB->count, PB->y+PB->count ); /* interpolate z values */ if (ctx->Depth.Test) { GLdepth *zptr = PB->z + PB->count; GLint z1 = (GLint) (VB->Win[v1][2] + ctx->LineZoffset); GLint z2 = (GLint) (VB->Win[v2][2] + ctx->LineZoffset); GL_INTERPOLATE_Z( n, z1, z2, zptr ); } PB->count += n; PB_CHECK_FLUSH( ctx, PB ); }
/* * General CI points. */ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; GLint isize; isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); for (i=first;i<=last;i++) { if (VB->Unclipped[i]) { GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; x = (GLint) VB->Win[i][0]; y = (GLint) VB->Win[i][1]; z = (GLint) (VB->Win[i][2] + ctx->PointZoffset); if (isize&1) { /* odd size */ x0 = x - isize/2; x1 = x + isize/2; y0 = y - isize/2; y1 = y + isize/2; } else { /* even size */ x0 = (GLint) (x + 0.5F) - isize/2; x1 = x0 + isize-1; y0 = (GLint) (y + 0.5F) - isize/2; y1 = y0 + isize-1; } PB_SET_INDEX( ctx, PB, VB->Index[i] ); for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { PB_WRITE_PIXEL( PB, ix, iy, z ); } } PB_CHECK_FLUSH(ctx,PB) } }
/* Flat, color index line */ static void flat_ci_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { GLint count; GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); count = ctx->PB->count; #define INTERP_XY 1 #define PLOT(X,Y) \ pbx[count] = X; \ pby[count] = Y; \ count++; #include "linetemp.h" ctx->PB->count = count; gl_flush_pb(ctx); }
/* Flat shaded, color index, any width, maybe stippled */ static void general_flat_ci_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { GLint count; GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { /* stippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 #define WIDE 1 #define STIPPLE 1 #define PLOT(X,Y) \ pbx[count] = X; \ pby[count] = Y; \ pbz[count] = Z; \ count++; \ CHECK_FULL(count); #include "linetemp.h" } else { /* unstippled */ if (ctx->Line.Width==2.0F) { /* special case: unstippled and width=2 */ #define INTERP_XY 1 #define INTERP_Z 1 #define XMAJOR_PLOT(X,Y) \ pbx[count] = X; pbx[count+1] = X; \ pby[count] = Y; pby[count+1] = Y+1; \ pbz[count] = Z; pbz[count+1] = Z; \ count += 2; \ CHECK_FULL(count); #define YMAJOR_PLOT(X,Y) \ pbx[count] = X; pbx[count+1] = X+1; \ pby[count] = Y; pby[count+1] = Y; \ pbz[count] = Z; pbz[count+1] = Z; \ count += 2; \ CHECK_FULL(count); #include "linetemp.h" } else { /* unstippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 #define WIDE 1 #define PLOT(X,Y) \ pbx[count] = X; \ pby[count] = Y; \ pbz[count] = Z; \ count++; \ CHECK_FULL(count); #include "linetemp.h" } } ctx->PB->count = count; gl_flush_pb(ctx); }