-/* $Id: s_aaline.c,v 1.2 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_aaline.c,v 1.11 2001/05/21 18:13:43 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#include "swrast/s_pb.h"
#include "swrast/s_context.h"
#include "swrast/swrast.h"
-#include "types.h"
-
+#include "mtypes.h"
+#include "mmath.h"
#define SUB_PIXEL 4
const GLfloat b = pz * py;
const GLfloat c = px * px + py * py;
const GLfloat d = -(a * x0 + b * y0 + c * z0);
- plane[0] = a;
- plane[1] = b;
- plane[2] = c;
- plane[3] = d;
+ if (a == 0.0 && b == 0.0 && c == 0.0 && d == 0.0) {
+ plane[0] = 0.0;
+ plane[1] = 0.0;
+ plane[2] = 1.0;
+ plane[3] = 0.0;
+ }
+ else {
+ plane[0] = a;
+ plane[1] = b;
+ plane[2] = c;
+ plane[3] = d;
+ }
#endif
}
static INLINE GLfloat
solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4])
{
- GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
+ const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
return z;
}
static INLINE GLfloat
solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4])
{
- GLfloat z = -plane[2] / (plane[3] + plane[0] * x + plane[1] * y);
- return z;
+ const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y;
+ if (denom == 0.0)
+ return 0.0;
+ else
+ return -plane[2] / denom;
}
if (z < 0.0F)
return 0;
else if (z > CHAN_MAXF)
- return CHAN_MAXF;
+ return (GLchan) CHAN_MAXF;
return (GLchan) (GLint) z;
}
GLfloat r2 = dvdx * dvdx + dvdy * dvdy;
GLfloat rho2 = r1 + r2;
/* return log base 2 of rho */
- return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
+ if (rho2 == 0.0F)
+ return 0.0;
+ else
+ return log(rho2) * 1.442695 * 0.5; /* 1.442695 = 1/log(2) */
}
else {
j = i++;
}
- samples[j][0] = x * dx;
- samples[j][1] = y * dy;
+ samples[j][0] = x * dx + 0.5 * dx;
+ samples[j][1] = y * dy + 0.5 * dy;
}
}
}
#define DO_Z
#define DO_RGBA
#define DO_MULTITEX
+#include "s_aalinetemp.h"
+
+
+#define NAME(x) aa_multitex_spec_##x
+#define DO_Z
+#define DO_RGBA
+#define DO_MULTITEX
#define DO_SPEC
#include "s_aalinetemp.h"
ASSERT(ctx->Line.SmoothFlag);
- if (ctx->Visual.RGBAflag) {
+ if (ctx->Visual.rgbMode) {
/* RGBA */
if (ctx->Texture._ReallyEnabled) {
- if (swrast->_MultiTextureEnabled
- || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
- || ctx->Fog.ColorSumEnabled)
+ if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) {
/* Multitextured! */
- swrast->Line = aa_multitex_rgba_line;
- else
+ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR ||
+ ctx->Fog.ColorSumEnabled)
+ swrast->Line = aa_multitex_spec_line;
+ else
+ swrast->Line = aa_multitex_rgba_line;
+ }
+ else {
swrast->Line = aa_tex_rgba_line;
+ }
}
else {
swrast->Line = aa_rgba_line;
swrast->Line = aa_ci_line;
}
}
-