-/* $Id: s_lines.c,v 1.5 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_lines.c,v 1.12 2001/03/03 20:33:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "glheader.h"
+#include "colormac.h"
#include "macros.h"
#include "mmath.h"
-#include "vb.h"
#include "s_aaline.h"
#include "s_pb.h"
#include "s_context.h"
/* Flat, color index line */
static void flat_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
#include "s_linetemp.h"
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Flat, color index line with Z interpolation/testing */
static void flat_ci_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
PB_SET_INDEX( PB, vert0->index );
#include "s_linetemp.h"
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Flat-shaded, RGBA line */
static void flat_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
- const GLchan *color = vert0->color;
+ const GLchan *color = vert1->color;
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
#include "s_linetemp.h"
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Flat-shaded, RGBA line with Z interpolation/testing */
static void flat_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
- const GLchan *color = vert0->color;
+ const GLchan *color = vert1->color;
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
#include "s_linetemp.h"
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Smooth shaded, color index line */
static void smooth_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
#include "s_linetemp.h"
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Smooth shaded, color index line with Z interpolation/testing */
static void smooth_ci_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
#include "s_linetemp.h"
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Smooth-shaded, RGBA line */
static void smooth_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
#include "s_linetemp.h"
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Smooth-shaded, RGBA line with Z interpolation/testing */
static void smooth_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
#include "s_linetemp.h"
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
#define CHECK_FULL(count) \
if (count >= PB_SIZE-MAX_WIDTH) { \
PB->count = count; \
- gl_flush_pb(ctx); \
+ _mesa_flush_pb(ctx); \
count = PB->count; \
}
/* Smooth shaded, color index, any width, maybe stippled */
static void general_smooth_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Flat shaded, color index, any width, maybe stippled */
static void general_flat_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
static void general_smooth_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
static void general_flat_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
- const GLchan *color = vert0->color;
+ const GLchan *color = vert1->color;
PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
if (ctx->Line.StippleFlag) {
}
}
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Flat-shaded, textured, any width, maybe stippled */
static void flat_textured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
GLfloat *pbs = PB->s[0];
GLfloat *pbt = PB->t[0];
GLfloat *pbu = PB->u[0];
- GLchan *color = vert0->color;
+ GLchan *color = (GLchan*) vert1->color;
PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
count = PB->count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
/* Smooth-shaded, textured, any width, maybe stippled */
static void smooth_textured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
* color interpolation.
*/
static void smooth_multitextured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
* color interpolation.
*/
static void flat_multitextured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
GLfixed *pbfog = PB->fog;
GLchan (*pbrgba)[4] = PB->rgba;
GLchan (*pbspec)[3] = PB->spec;
- GLchan *color = vert0->color;
- GLchan sRed = vert0->specular[0];
- GLchan sGreen = vert0->specular[1];
- GLchan sBlue = vert0->specular[2];
+ GLchan *color = (GLchan*) vert1->color;
+ GLchan sRed = vert1->specular[0];
+ GLchan sGreen = vert1->specular[1];
+ GLchan sBlue = vert1->specular[2];
PB->mono = GL_FALSE;
}
PB->count = count;
- gl_flush_pb(ctx);
+ _mesa_flush_pb(ctx);
}
+void _swrast_add_spec_terms_line( GLcontext *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1 )
+{
+ SWvertex *ncv0 = (SWvertex *)v0;
+ SWvertex *ncv1 = (SWvertex *)v1;
+ GLchan c[2][4];
+ COPY_CHAN4( c[0], ncv0->color );
+ COPY_CHAN4( c[1], ncv1->color );
+ ACC_3V( ncv0->color, ncv0->specular );
+ ACC_3V( ncv1->color, ncv1->specular );
+ SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 );
+ COPY_CHAN4( ncv0->color, c[0] );
+ COPY_CHAN4( ncv1->color, c[1] );
+}
+
#ifdef DEBUG
extern void
_swrast_choose_line( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean rgbmode = ctx->Visual.RGBAflag;
+ const GLboolean rgbmode = ctx->Visual.rgbMode;
if (ctx->RenderMode==GL_RENDER) {
if (ctx->Line.SmoothFlag) {
ASSERT(swrast->Triangle);
}
else if (ctx->Texture._ReallyEnabled) {
- if (swrast->_MultiTextureEnabled
- || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
- || ctx->Fog.ColorSumEnabled) {
+ if (swrast->_MultiTextureEnabled ||
+ (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR)) {
/* multi-texture and/or separate specular color */
if (ctx->Light.ShadeModel==GL_SMOOTH)
swrast->Line = smooth_multitextured_line;
}
}
else if (ctx->RenderMode==GL_FEEDBACK) {
- swrast->Line = gl_feedback_line;
+ swrast->Line = _mesa_feedback_line;
}
else {
/* GL_SELECT mode */
- swrast->Line = gl_select_line;
+ swrast->Line = _mesa_select_line;
}
/*_mesa_print_line_function(ctx);*/