-/* $Id: lines.c,v 1.5 1999/11/08 14:36:32 brianp Exp $ */
+/* $Id: lines.c,v 1.10 2000/05/10 22:36:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
*/
-
-
-
#ifdef PC_HEADER
#include "all.h"
#else
-#ifndef XFree86Server
-#include <assert.h>
-#else
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
#include "context.h"
#include "depth.h"
#include "feedback.h"
-void gl_LineWidth( GLcontext *ctx, GLfloat width )
+void
+_mesa_LineWidth( GLfloat width )
{
+ GET_CURRENT_CONTEXT(ctx);
if (width<=0.0) {
gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
return;
ctx->TriangleCaps &= ~DD_LINE_WIDTH;
if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH;
ctx->NewState |= NEW_RASTER_OPS;
+ if (ctx->Driver.LineWidth)
+ (*ctx->Driver.LineWidth)(ctx, width);
}
}
-void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
+void
+_mesa_LineStipple( GLint factor, GLushort pattern )
{
+ GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
ctx->Line.StipplePattern = pattern;
ctx->NewState |= NEW_RASTER_OPS;
+
+ if (ctx->Driver.LineStipple)
+ ctx->Driver.LineStipple( ctx, factor, pattern );
}
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;
+ PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
#define INTERP_XY 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- count++;
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
#include "linetemp.h"
- ctx->PB->count = count;
gl_flush_pb(ctx);
}
static void flat_ci_z_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;
+ PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
#define INTERP_XY 1
#define INTERP_Z 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- count++;
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#include "linetemp.h"
- ctx->PB->count = count;
gl_flush_pb(ctx);
}
static void flat_rgba_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert )
{
- GLint count;
- GLint *pbx = ctx->PB->x;
- GLint *pby = ctx->PB->y;
- GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
- count = ctx->PB->count;
+ const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
#define INTERP_XY 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- count++;
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
#include "linetemp.h"
- ctx->PB->count = count;
gl_flush_pb(ctx);
}
static void flat_rgba_z_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;
- GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
- count = ctx->PB->count;
+ const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
#define INTERP_XY 1
#define INTERP_Z 1
-
-#define PLOT(X,Y) \
- pbx[count] = X; \
- pby[count] = Y; \
- pbz[count] = Z; \
- count++;
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#include "linetemp.h"
- ctx->PB->count = count;
gl_flush_pb(ctx);
}
GLint count = ctx->PB->count;
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
- GLuint *pbi = ctx->PB->i;
+ GLuint *pbi = ctx->PB->index;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
#define INTERP_XY 1
#define INTERP_INDEX 1
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
- GLuint *pbi = ctx->PB->i;
+ GLuint *pbi = ctx->PB->index;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_INDEX 1
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
#define INTERP_XY 1
#define INTERP_RGB 1
#define INTERP_ALPHA 1
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
#define INTERP_XY 1
#define INTERP_Z 1
#define INTERP_RGB 1
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
- GLuint *pbi = ctx->PB->i;
+ GLuint *pbi = ctx->PB->index;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
if (ctx->Line.StippleFlag) {
/* stippled */
#define INTERP_XY 1
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] );
+ PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
count = ctx->PB->count;
if (ctx->Line.StippleFlag) {
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
if (ctx->Line.StippleFlag) {
/* stippled */
#define INTERP_XY 1
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
+ PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
count = ctx->PB->count;
if (ctx->Line.StippleFlag) {
GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0];
GLubyte *color = ctx->VB->ColorPtr->data[pv];
- PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
+ PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
count = ctx->PB->count;
if (ctx->Line.StippleFlag) {
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
if (ctx->Line.StippleFlag) {
/* stippled */
#define INTERP_XY 1
GLubyte (*pbspec)[3] = ctx->PB->spec;
(void) pvert;
+ ctx->PB->mono = GL_FALSE;
+
if (ctx->Line.StippleFlag) {
/* stippled */
#define INTERP_XY 1
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* Width==1, non-stippled, smooth-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = smooth_rgba_z_line;
else
}
else {
/* Width==1, non-stippled, flat-shaded */
- if (ctx->Depth.Test
- || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+ if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
if (rgbmode)
ctx->Driver.LineFunc = flat_rgba_z_line;
else