-/* $Id: s_aaline.c,v 1.16 2002/08/07 00:45:07 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.0.3
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 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 "imports.h"
+#include "macros.h"
#include "swrast/s_aaline.h"
#include "swrast/s_context.h"
#include "swrast/s_span.h"
#include "swrast/swrast.h"
#include "mtypes.h"
-#include "mmath.h"
#define SUB_PIXEL 4
/* DO_SPEC */
GLfloat srPlane[4], sgPlane[4], sbPlane[4];
/* DO_TEX or DO_MULTITEX */
- GLfloat sPlane[MAX_TEXTURE_UNITS][4];
- GLfloat tPlane[MAX_TEXTURE_UNITS][4];
- GLfloat uPlane[MAX_TEXTURE_UNITS][4];
- GLfloat vPlane[MAX_TEXTURE_UNITS][4];
- GLfloat lambda[MAX_TEXTURE_UNITS];
- GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS];
+ GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4];
+ GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4];
+ GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4];
+ GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4];
+ GLfloat lambda[MAX_TEXTURE_COORD_UNITS];
+ GLfloat texWidth[MAX_TEXTURE_COORD_UNITS];
+ GLfloat texHeight[MAX_TEXTURE_COORD_UNITS];
struct sw_span span;
};
static INLINE GLchan
solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4])
{
- GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F;
- if (z < 0.0F)
+ const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
+#if CHAN_TYPE == GL_FLOAT
+ return CLAMP(z, 0.0F, CHAN_MAXF);
+#else
+ if (z < 0)
return 0;
- else if (z > CHAN_MAXF)
- return (GLchan) CHAN_MAXF;
- return (GLchan) (GLint) z;
+ else if (z > CHAN_MAX)
+ return CHAN_MAX;
+ return (GLchan) IROUND_POS(z);
+#endif
}
if (ctx->Visual.rgbMode) {
/* RGBA */
- if (ctx->Texture._EnabledUnits != 0) {
- if (ctx->Texture._EnabledUnits > 1) {
+ if (ctx->Texture._EnabledCoordUnits != 0) {
+ if (ctx->Texture._EnabledCoordUnits > 1) {
/* Multitextured! */
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR ||
ctx->Fog.ColorSumEnabled)