-/* $Id: s_aalinetemp.h,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_aalinetemp.h,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLfloat fy = (GLfloat) iy;
const GLfloat coverage = compute_coveragef(line, ix, iy);
GLdepth z;
- GLfixed fog;
+ GLfloat fog;
GLchan red, green, blue, alpha;
GLint frac, indx, index;
GLchan specRed, specGreen, specBlue;
z = 0.0;
#endif
#ifdef DO_FOG
- fog = FloatToFixed( solve_plane(fx, fy, line->fPlane) );
+ fog = solve_plane(fx, fy, line->fPlane);
#else
- fog = 0;
+ fog = 0.0;
#endif
#ifdef DO_RGBA
red = solve_plane_chan(fx, fy, line->rPlane);
-/* $Id: s_aatritemp.h,v 1.9 2001/03/28 21:36:31 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.10 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLfloat zPlane[4]; /* Z (depth) */
GLdepth z[MAX_WIDTH];
GLfloat fogPlane[4];
- GLfixed fog[MAX_WIDTH];
+ GLfloat fog[MAX_WIDTH];
#endif
#ifdef DO_RGBA
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* color */
while (coverage > 0.0F) {
#ifdef DO_Z
z[count] = (GLdepth) solve_plane(ix, iy, zPlane);
- fog[count] = FloatToFixed(solve_plane(ix, iy, fogPlane));
+ fog[count] = solve_plane(ix, iy, fogPlane);
#endif
#ifdef DO_RGBA
rgba[count][RCOMP] = solve_plane_chan(ix, iy, rPlane);
while (coverage > 0.0F) {
#ifdef DO_Z
z[ix] = (GLdepth) solve_plane(ix, iy, zPlane);
- fog[ix] = FloatToFixed(solve_plane(ix, iy, fogPlane));
+ fog[ix] = solve_plane(ix, iy, fogPlane);
#endif
#ifdef DO_RGBA
rgba[ix][RCOMP] = solve_plane_chan(ix, iy, rPlane);
-/* $Id: s_bitmap.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_bitmap.c,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct pixel_buffer *PB = swrast->PB;
GLint row, col;
GLdepth fragZ;
- GLfixed fogCoord;
+ GLfloat fogCoord;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
-/* $Id: s_fog.c,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_fog.c,v 1.12 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
void
_mesa_fog_rgba_pixels( const GLcontext *ctx,
GLuint n,
- const GLfixed fog[],
+ const GLfloat fog[],
GLchan rgba[][4] )
{
GLuint i;
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
-#if CHAN_TYPE == GL_FLOAT
for (i = 0; i < n; i++) {
- const GLfixed cf = CLAMP(fog[i], 0, FIXED_ONE);
- const GLfloat f = FixedToFloat(cf);
- const GLfloat g = 1.0F - f;
+ const GLfloat f = fog[i];
+ const GLfloat g = 1.0 - f;
rgba[i][RCOMP] = f * rgba[i][RCOMP] + g * rFog;
rgba[i][GCOMP] = f * rgba[i][GCOMP] + g * gFog;
rgba[i][BCOMP] = f * rgba[i][BCOMP] + g * bFog;
}
-#else
- for (i = 0; i < n; i++) {
- const GLfixed f = CLAMP(fog[i], 0, FIXED_ONE);
- const GLfixed g = FIXED_ONE - f;
- rgba[i][0] = (f * rgba[i][0] + g * rFog) >> FIXED_SHIFT;
- rgba[i][1] = (f * rgba[i][1] + g * gFog) >> FIXED_SHIFT;
- rgba[i][2] = (f * rgba[i][2] + g * bFog) >> FIXED_SHIFT;
- }
-#endif
}
*/
void
_mesa_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLfixed fog[], GLuint index[] )
+ GLuint n, const GLfloat fog[], GLuint index[] )
{
GLuint idx = (GLuint) ctx->Fog.Index;
GLuint i;
- for (i=0;i<n;i++) {
- GLfloat f = FixedToFloat(CLAMP(fog[i], 0, FIXED_ONE));
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * idx);
+ for (i = 0; i < n; i++) {
+ const GLfloat f = CLAMP(fog[i], 0.0, 1.0);
+ index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx);
}
}
_mesa_win_fog_coords_from_z( const GLcontext *ctx,
GLuint n,
const GLdepth z[],
- GLfixed fogcoord[] )
+ GLfloat fogcoord[] )
{
const GLboolean ortho = (ctx->ProjectionMatrix.m[15] != 0.0F);
const GLfloat p10 = ctx->ProjectionMatrix.m[10];
GLfloat eyez = (ndcz - p14) / p10;
if (eyez < 0.0)
eyez = -eyez;
- fogcoord[i] = FloatToFixed((fogEnd - eyez) * fogScale);
+ fogcoord[i] = (fogEnd - eyez) * fogScale;
}
}
else {
GLfloat eyez = p14 / (ndcz + p10);
if (eyez < 0.0)
eyez = -eyez;
- fogcoord[i] = FloatToFixed((fogEnd - eyez) * fogScale);
+ fogcoord[i] = (fogEnd - eyez) * fogScale;
}
}
}
GLfloat eyez = (ndcz - p14) / p10;
if (eyez < 0.0)
eyez = -eyez;
- fogcoord[i] = FloatToFixed(exp( -ctx->Fog.Density * eyez ));
+ fogcoord[i] = exp( -ctx->Fog.Density * eyez );
}
}
else {
GLfloat eyez = p14 / (ndcz + p10);
if (eyez < 0.0)
eyez = -eyez;
- fogcoord[i] = FloatToFixed(exp( -ctx->Fog.Density * eyez ));
+ fogcoord[i] = exp( -ctx->Fog.Density * eyez );
}
}
break;
if (tmp < FLT_MIN_10_EXP)
tmp = FLT_MIN_10_EXP;
#endif
- fogcoord[i] = FloatToFixed(exp( tmp ));
+ fogcoord[i] = exp( tmp );
}
}
else {
if (tmp < FLT_MIN_10_EXP)
tmp = FLT_MIN_10_EXP;
#endif
- fogcoord[i] = FloatToFixed(exp( tmp ));
+ fogcoord[i] = exp( tmp );
}
}
}
_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLdepth z[], GLchan rgba[][4] )
{
- GLfixed fog[PB_SIZE];
+ GLfloat fog[PB_SIZE];
ASSERT(n <= PB_SIZE);
_mesa_win_fog_coords_from_z( ctx, n, z, fog );
_mesa_fog_rgba_pixels( ctx, n, fog, rgba );
_mesa_depth_fog_ci_pixels( const GLcontext *ctx,
GLuint n, const GLdepth z[], GLuint index[] )
{
- GLfixed fog[PB_SIZE];
+ GLfloat fog[PB_SIZE];
ASSERT(n <= PB_SIZE);
_mesa_win_fog_coords_from_z( ctx, n, z, fog );
_mesa_fog_ci_pixels( ctx, n, fog, index );
-/* $Id: s_fog.h,v 1.3 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_fog.h,v 1.4 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "swrast.h"
-
-
extern void
_mesa_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLfixed fog[],
+ GLuint n, const GLfloat fog[],
GLchan rgba[][4] );
extern void
_mesa_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLfixed fog[], GLuint indx[] );
+ GLuint n, const GLfloat fog[], GLuint indx[] );
extern void
_mesa_win_fog_coords_from_z( const GLcontext *ctx,
GLuint n,
const GLdepth z[],
- GLfixed fogcoord[] );
+ GLfloat fogcoord[] );
extern void
_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLdepth z[], GLuint index[] );
-
#endif
-/* $Id: s_lines.c,v 1.15 2001/03/29 16:50:32 brianp Exp $ */
+/* $Id: s_lines.c,v 1.16 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLchan (*pbrgba)[4] = PB->rgba;
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLuint *pbi = PB->index;
PB->mono = GL_FALSE;
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
PB_SET_INDEX( PB, vert0->index );
count = PB->count;
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLchan (*pbrgba)[4] = PB->rgba;
PB->mono = GL_FALSE;
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLfloat *pbs = PB->s[0];
GLfloat *pbt = PB->t[0];
GLfloat *pbu = PB->u[0];
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLfloat *pbs = PB->s[0];
GLfloat *pbt = PB->t[0];
GLfloat *pbu = PB->u[0];
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLchan (*pbrgba)[4] = PB->rgba;
GLchan (*pbspec)[3] = PB->spec;
GLint *pbx = PB->x;
GLint *pby = PB->y;
GLdepth *pbz = PB->z;
- GLfixed *pbfog = PB->fog;
+ GLfloat *pbfog = PB->fog;
GLchan (*pbrgba)[4] = PB->rgba;
GLchan (*pbspec)[3] = PB->spec;
GLchan *color = (GLchan*) vert1->color;
-/* $Id: s_linetemp.h,v 1.7 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_linetemp.h,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
# endif
#endif
#ifdef INTERP_FOG
- GLfixed fog0 = FloatToFixed(vert0->fog);
- GLfixed dfog = FloatToFixed(vert1->fog) - fog0;
+ GLfloat fog0 = vert0->fog;
+ GLfloat dfog = vert1->fog - fog0;
#endif
#ifdef INTERP_RGB
GLfixed r0 = IntToFixed(vert0->color[0]);
-/* $Id: s_span.c,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_span.c,v 1.13 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
void _mesa_write_index_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
GLuint indexIn[], GLenum primitive )
{
const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | LOGIC_OP_BIT;
void _mesa_write_monoindex_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
GLuint index, GLenum primitive )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
void _mesa_write_rgba_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
GLchan rgbaIn[][4],
GLenum primitive )
{
*/
void _mesa_write_monocolor_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
const GLchan color[4],
GLenum primitive )
{
*/
void _mesa_write_texture_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
const GLfloat s[], const GLfloat t[],
const GLfloat u[], GLfloat lambda[],
GLchan rgbaIn[][4], CONST GLchan spec[][4],
_mesa_write_multitexture_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
-/* $Id: s_span.h,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_span.h,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern void _mesa_write_index_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
GLuint index[], GLenum primitive );
extern void _mesa_write_monoindex_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
GLuint index, GLenum primitive );
extern void _mesa_write_rgba_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
GLchan rgba[][4], GLenum primitive );
extern void _mesa_write_monocolor_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
const GLchan color[4],
GLenum primitive );
extern void _mesa_write_texture_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
const GLfloat s[], const GLfloat t[],
const GLfloat u[], GLfloat lambda[],
GLchan rgba[][4], CONST GLchan spec[][4],
_mesa_write_multitexture_span( GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLdepth z[],
- const GLfixed fog[],
+ const GLfloat fog[],
CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
-/* $Id: s_texstore.c,v 1.3 2001/04/13 00:13:51 brianp Exp $ */
+/* $Id: s_texstore.c,v 1.4 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
return;
}
+#if 0
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
image[i + 3] = CHAN_MAX;
}
}
-
+#endif
/* now call glTexSubImage1D to do the real work */
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
GL_RGBA, CHAN_TYPE, image,
return;
}
+#if 0
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
image[i + 3] = CHAN_MAX;
}
}
-
+#endif
/* now call glTexSubImage2D to do the real work */
(*ctx->Driver.TexSubImage2D)(ctx, target, level,
xoffset, yoffset, width, height,
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
return;
}
-
+#if 0
/*
* XXX this is a bit of a hack. We need to be sure that the alpha
* channel is 1.0 if the internal texture format is not supposed to
image[i + 3] = CHAN_MAX;
}
}
-
+#endif
/* now call glTexSubImage3D to do the real work */
(*ctx->Driver.TexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset, width, height, 1,
-/* $Id: s_triangle.c,v 1.24 2001/03/29 16:50:32 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.25 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLint n = RIGHT-LEFT; \
GLint i; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
zspan[i] = FixedToDepth(ffz); \
ffz += fdzdx; \
- fogspan[i] = fffog / 256; \
- fffog += fdfogdx; \
+ fogspan[i] = ffog; \
+ ffog += dfogdx; \
} \
_mesa_write_monoindex_span( ctx, n, LEFT, Y, zspan, \
fogspan, v0->index, GL_POLYGON ); \
const GLint n = RIGHT-LEFT; \
GLint i; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLuint index[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
ffz += fdzdx; \
index[i] = FixedToInt(ffi); \
ffi += fdidx; \
- fogspan[i] = fffog / 256; \
- fffog += fdfogdx; \
+ fogspan[i] = ffog; \
+ ffog += dfogdx; \
} \
_mesa_write_index_span( ctx, n, LEFT, Y, zspan, fogspan, \
index, GL_POLYGON ); \
const GLint n = RIGHT-LEFT; \
GLint i; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
zspan[i] = FixedToDepth(ffz); \
ffz += fdzdx; \
- fogspan[i] = fffog / 256; \
- fffog += fdfogdx; \
+ fogspan[i] = ffog; \
+ ffog += dfogdx; \
} \
_mesa_write_monocolor_span( ctx, n, LEFT, Y, zspan, \
fogspan, v2->color, \
GLint i; \
GLdepth zspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
zspan[i] = FixedToDepth(ffz); \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
rgba[i][ACOMP] = FixedToInt(ffa); \
- fogspan[i] = fffog / 256; \
- fffog += fdfogdx; \
+ fogspan[i] = ffog;; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
ffb += fdbdx; \
ffa += fdadx; \
+ ffog += dfogdx; \
} \
_mesa_write_rgba_span( ctx, n, LEFT, Y, \
(CONST GLdepth *) zspan, \
const SWvertex *v2 )
{
#define INTERP_Z 1
-#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_INT_TEX 1
#define S_SCALE twidth
GLint i; \
GLchan rgb[MAX_WIDTH][3]; \
GLubyte mask[MAX_WIDTH]; \
- (void) fffog; \
if (n>0) { \
ffs -= FIXED_HALF; /* off-by-one error? */ \
fft -= FIXED_HALF; \
GLint pos = (t << twidth_log2) + s; \
const GLchan *tex00 = texture + COMP * pos; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog;; \
DO_TEX; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
tex11 -= tbytesline; \
} \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
DO_TEX; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
CONST GLint n = RIGHT-LEFT; \
GLint i; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
if (n>0) { \
GLchan *dest = rgba[0]; \
GLint pos = COMP * ((t << twidth_log2) + s); \
const GLchan *tex00 = texture + pos; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
DO_TEX; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
j = n; \
while (i<j) { \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
DO_TEX; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
GLint i = 0; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
(void)uu; /* please GCC */ \
if (n > 0) { \
tex11 -= tbytesline; \
} \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
DO_TEX; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
GLint i; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
(void) uu; /* please GCC */ \
if (n > 0) { \
GLint i; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
GLfloat s[MAX_WIDTH], t[MAX_WIDTH], u[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = r; \
rgba[i][GCOMP] = g; \
rgba[i][BCOMP] = b; \
s[i] = ss*invQ; \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ss += dsdx; \
tt += dtdx; \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
rgba[i][ACOMP] = FixedToInt(ffa); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
s[i] = ss*invQ; \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
vv += dvdx; \
} \
} \
- _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, fogspan, \
- s, t, u, NULL, \
- rgba, \
- NULL, GL_POLYGON ); \
+ _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, \
+ fogspan, s, t, u, NULL, \
+ rgba, NULL, GL_POLYGON ); \
} \
}
const SWvertex *v1,
const SWvertex *v2,
GLdepth zspan[MAX_WIDTH],
- GLfixed fogspan[MAX_WIDTH],
+ GLfloat fogspan[MAX_WIDTH],
GLchan rgba[MAX_WIDTH][4],
GLchan spec[MAX_WIDTH][4] )
{
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = r; \
rgba[i][GCOMP] = g; \
rgba[i][BCOMP] = b; \
s[i] = ss*invQ; \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ss += dsdx; \
tt += dtdx; \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = FixedToInt(ffr); \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
s[i] = ss*invQ; \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
GLint i; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan rgba[MAX_WIDTH][4]; \
GLfloat lambda[MAX_WIDTH]; \
if (n>0) { \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = r; \
rgba[i][GCOMP] = g; \
rgba[i][BCOMP] = b; \
u[i] = uu*invQ; \
COMPUTE_LAMBDA(lambda[i], invQ); \
ffz += fdzdx; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ss += dsdx; \
tt += dtdx; \
uu += dudx; \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = FixedToInt(ffr); \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
u[i] = uu*invQ; \
COMPUTE_LAMBDA(lambda[i], invQ); \
ffz += fdzdx; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffr += fdrdx; \
ffg += fdgdx; \
ffb += fdbdx; \
GLint i; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLchan spec[MAX_WIDTH][4]; \
GLchan rgba[MAX_WIDTH][4]; \
GLfloat lambda[MAX_WIDTH]; \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = r; \
rgba[i][GCOMP] = g; \
rgba[i][BCOMP] = b; \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
COMPUTE_LAMBDA(lambda[i], invQ); \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ss += dsdx; \
tt += dtdx; \
for (i=0;i<n;i++) { \
GLdouble invQ = vv ? (1.0 / vv) : 1.0; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
rgba[i][RCOMP] = FixedToInt(ffr); \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
t[i] = tt*invQ; \
u[i] = uu*invQ; \
COMPUTE_LAMBDA(lambda[i], invQ); \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
ffz += fdzdx; \
ffr += fdrdx; \
ffg += fdgdx; \
vv += dvdx; \
} \
} \
- _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, fogspan, \
- s, t, u, lambda, \
+ _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, \
+ fogspan, s, t, u, lambda, \
rgba, (CONST GLchan (*)[4]) spec, \
GL_POLYGON ); \
} \
GLint i; \
const GLint n = RIGHT-LEFT; \
GLdepth zspan[MAX_WIDTH]; \
- GLfixed fogspan[MAX_WIDTH]; \
+ GLfloat fogspan[MAX_WIDTH]; \
GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; \
if (n > 0) { \
if (flat_shade) { \
for (i=0;i<n;i++) { \
GLuint unit; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
- fffog += fdfogdx; \
+ fogspan[i] = ffog; \
+ ffog += dfogdx; \
ffz += fdzdx; \
rgba[i][RCOMP] = r; \
rgba[i][GCOMP] = g; \
for (i=0;i<n;i++) { \
GLuint unit; \
zspan[i] = FixedToDepth(ffz); \
- fogspan[i] = fffog / 256; \
+ fogspan[i] = ffog; \
ffz += fdzdx; \
- fffog += fdfogdx; \
+ ffog += dfogdx; \
rgba[i][RCOMP] = FixedToInt(ffr); \
rgba[i][GCOMP] = FixedToInt(ffg); \
rgba[i][BCOMP] = FixedToInt(ffb); \
const SWvertex *v2 )
{
GLdepth zspan[MAX_WIDTH];
- GLfixed fogspan[MAX_WIDTH];
+ GLfloat fogspan[MAX_WIDTH];
GLchan rgba[MAX_WIDTH][4], spec[MAX_WIDTH][4];
general_textured_spec_triangle1(ctx,v0,v1,v2,zspan,fogspan,rgba,spec);
}
#define DO_OCCLUSION_TEST
#define INTERP_Z 1
-#define INTERP_FOG 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
const GLint len = RIGHT-LEFT; \
for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \
- (void) fffog; \
if (z < zRow[i]) { \
ctx->OcclusionResult = GL_TRUE; \
return; \
-/* $Id: s_tritemp.h,v 1.14 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_tritemp.h,v 1.15 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLfloat dzdx, dzdy; GLfixed fdzdx;
#endif
#ifdef INTERP_FOG
- GLfloat dfogdx, dfogdy; GLfixed fdfogdx;
+ GLfloat dfogdx, dfogdy;
#endif
#ifdef INTERP_RGB
GLfloat drdx, drdy; GLfixed fdrdx;
#endif
#ifdef INTERP_FOG
{
- GLfloat eMaj_dfog, eBot_dfog;
- eMaj_dfog = (vMax->fog - vMin->fog) * 256;
- eBot_dfog = (vMid->fog - vMin->fog) * 256;
+ const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
+ const GLfloat eBot_dfog = vMid->fog - vMin->fog;
dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
- fdfogdx = SignedFloatToFixed(dfogdx);
dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
}
#endif
{
int subTriangle;
- GLfixed fx, fxLeftEdge, fxRightEdge, fdxLeftEdge, fdxRightEdge;
+ GLfixed fx;
+ GLfixed fxLeftEdge=0, fxRightEdge=0, fdxLeftEdge=0, fdxRightEdge=0;
GLfixed fdxOuter;
int idxOuter;
float dxOuter;
- GLfixed fError, fdError;
+ GLfixed fError=0, fdError=0;
float adjx, adjy;
GLfixed fy;
- int iy;
+ int iy=0;
#ifdef PIXEL_ADDRESS
- PIXEL_TYPE *pRow;
- int dPRowOuter, dPRowInner; /* offset in bytes */
+ PIXEL_TYPE *pRow=NULL;
+ int dPRowOuter=0, dPRowInner=0; /* offset in bytes */
#endif
#ifdef INTERP_Z
# ifdef DEPTH_TYPE
- DEPTH_TYPE *zRow;
- int dZRowOuter, dZRowInner; /* offset in bytes */
+ DEPTH_TYPE *zRow=NULL;
+ int dZRowOuter=0, dZRowInner=0; /* offset in bytes */
# endif
- GLfixed fz, fdzOuter, fdzInner;
+ GLfixed fz=0, fdzOuter=0, fdzInner;
#endif
#ifdef INTERP_FOG
- GLfixed ffog, fdfogOuter, fdfogInner;
+ GLfloat fogLeft, dfogOuter, dfogInner;
#endif
#ifdef INTERP_RGB
- GLfixed fr, fdrOuter, fdrInner;
- GLfixed fg, fdgOuter, fdgInner;
- GLfixed fb, fdbOuter, fdbInner;
+ GLfixed fr=0, fdrOuter=0, fdrInner;
+ GLfixed fg=0, fdgOuter=0, fdgInner;
+ GLfixed fb=0, fdbOuter=0, fdbInner;
#endif
#ifdef INTERP_SPEC
- GLfixed fsr, fdsrOuter, fdsrInner;
- GLfixed fsg, fdsgOuter, fdsgInner;
- GLfixed fsb, fdsbOuter, fdsbInner;
+ GLfixed fsr=0, fdsrOuter=0, fdsrInner;
+ GLfixed fsg=0, fdsgOuter=0, fdsgInner;
+ GLfixed fsb=0, fdsbOuter=0, fdsbInner;
#endif
#ifdef INTERP_ALPHA
- GLfixed fa, fdaOuter, fdaInner;
+ GLfixed fa=0, fdaOuter=0, fdaInner;
#endif
#ifdef INTERP_INDEX
- GLfixed fi, fdiOuter, fdiInner;
+ GLfixed fi=0, fdiOuter=0, fdiInner;
#endif
#ifdef INTERP_INT_TEX
- GLfixed fs, fdsOuter, fdsInner;
- GLfixed ft, fdtOuter, fdtInner;
+ GLfixed fs=0, fdsOuter=0, fdsInner;
+ GLfixed ft=0, fdtOuter=0, fdtInner;
#endif
#ifdef INTERP_TEX
- GLfloat sLeft, dsOuter, dsInner;
- GLfloat tLeft, dtOuter, dtInner;
- GLfloat uLeft, duOuter, duInner;
- GLfloat vLeft, dvOuter, dvInner;
+ GLfloat sLeft=0, dsOuter=0, dsInner;
+ GLfloat tLeft=0, dtOuter=0, dtInner;
+ GLfloat uLeft=0, duOuter=0, duInner;
+ GLfloat vLeft=0, dvOuter=0, dvInner;
#endif
#ifdef INTERP_MULTITEX
GLfloat sLeft[MAX_TEXTURE_UNITS];
}
#endif
#ifdef INTERP_FOG
- ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx
- + dfogdy * adjy) + FIXED_HALF;
- fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx);
+ fogLeft = vLower->fog + (dfogdx * adjx + dfogdy * adjy)
+ * (1.0F/FIXED_SCALE);
+ dfogOuter = dfogdy + dxOuter * dfogdx;
#endif
#ifdef INTERP_RGB
fr = (GLfixed)(IntToFixed(vLower->color[0])
fdzInner = fdzOuter + fdzdx;
#endif
#ifdef INTERP_FOG
- fdfogInner = fdfogOuter + fdfogdx;
+ dfogInner = dfogOuter + dfogdx;
#endif
#ifdef INTERP_RGB
fdrInner = fdrOuter + fdrdx;
GLfixed ffz = fz;
#endif
#ifdef INTERP_FOG
- GLfixed fffog = ffog;
+ GLfloat ffog = fogLeft;
#endif
#ifdef INTERP_RGB
GLfixed ffr = fr, ffg = fg, ffb = fb;
fz += fdzOuter;
#endif
#ifdef INTERP_FOG
- ffog += fdfogOuter;
+ fogLeft += dfogOuter;
#endif
#ifdef INTERP_RGB
fr += fdrOuter; fg += fdgOuter; fb += fdbOuter;
fz += fdzInner;
#endif
#ifdef INTERP_FOG
- ffog += fdfogInner;
+ fogLeft += dfogInner;
#endif
#ifdef INTERP_RGB
fr += fdrInner; fg += fdgInner; fb += fdbInner;
-/* $Id: s_zoom.c,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_zoom.c,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
void
_mesa_write_zoomed_rgba_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
CONST GLchan rgba[][4], GLint y0 )
{
GLint m;
GLint i, j, skipcol;
GLchan zrgba[MAX_WIDTH][4]; /* zoomed pixel colors */
GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
- GLfixed zfog[MAX_WIDTH]; /* zoomed fog values */
+ GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
const GLuint *srcRGBA32 = (const GLuint *) rgba;
GLuint *dstRGBA32 = (GLuint *) zrgba;
void
_mesa_write_zoomed_rgb_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
CONST GLchan rgb[][3], GLint y0 )
{
GLint m;
GLint i, j, skipcol;
GLchan zrgba[MAX_WIDTH][4]; /* zoomed pixel colors */
GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
- GLfixed zfog[MAX_WIDTH]; /* zoomed fog values */
+ GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
/* compute width of output row */
void
_mesa_write_zoomed_index_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
const GLuint indexes[], GLint y0 )
{
GLint m;
GLint i, j, skipcol;
GLuint zindexes[MAX_WIDTH]; /* zoomed color indexes */
GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
- GLfixed zfog[MAX_WIDTH]; /* zoomed fog values */
+ GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
/* compute width of output row */
-/* $Id: s_zoom.h,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_zoom.h,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern void
_mesa_write_zoomed_rgba_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
CONST GLchan rgba[][4], GLint y0 );
extern void
_mesa_write_zoomed_rgb_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
CONST GLchan rgb[][3], GLint y0 );
extern void
_mesa_write_zoomed_index_span( GLcontext *ctx,
GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfixed *fog,
+ const GLfloat *fog,
const GLuint indexes[], GLint y0 );