EXT_secondary_color is disabled until we get some dispatch offsets from SGI.
gl_extensions_disable(ctx, "GL_EXT_blend_minmax");
gl_extensions_disable(ctx, "GL_EXT_blend_subtract");
gl_extensions_disable(ctx, "GL_EXT_blend_color");
+ gl_extensions_disable(ctx, "GL_EXT_fog_coord");
gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0);
-/* $Id: clip.c,v 1.9 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: clip.c,v 1.10 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
mask |= CLIP_INDEX1;
}
- if (ctx->FogMode == FOG_FRAGMENT && (ctx->TriangleCaps & DD_CLIP_FOG_COORD))
+ if (ctx->Fog.Enabled)
mask |= CLIP_FOG_COORD;
ctx->ClipInterpFunc = clip_interp_tab[mask];
-/* $Id: context.c,v 1.95 2000/10/23 00:16:28 gareth Exp $ */
+/* $Id: context.c,v 1.96 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
cl->Ptr = (void *) ctx->Current.ByteColor;
cl->Enabled = 1;
+ cl = &ctx->Fallback.SecondaryColor;
+ cl->Size = 3;
+ cl->Type = GL_UNSIGNED_BYTE;
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Ptr = (void *) ctx->Current.SecondaryColor;
+ cl->Enabled = 1;
+
+ cl = &ctx->Fallback.FogCoord;
+ cl->Size = 1;
+ cl->Type = GL_FLOAT;
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Ptr = (void *) &ctx->Current.FogCoord;
+ cl->Enabled = 1;
+
cl = &ctx->Fallback.Index;
cl->Size = 1;
cl->Type = GL_UNSIGNED_INT;
ctx->Current.Flag = (VERT_NORM |
VERT_INDEX |
VERT_RGBA |
+ VERT_SPEC_RGB |
+ VERT_FOG_COORD |
VERT_EDGE |
VERT_TEX0_1 |
VERT_TEX1_1 |
ctx->Fog.Density = 1.0;
ctx->Fog.Start = 0.0;
ctx->Fog.End = 1.0;
+ ctx->Fog.ColorSumEnabled = GL_FALSE;
+ ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
/* Hint group */
ctx->Hint.PerspectiveCorrection = GL_DONT_CARE;
-/* $Id: dlist.c,v 1.46 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: dlist.c,v 1.47 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
table->FeedbackBuffer = _mesa_FeedbackBuffer;
table->Finish = _mesa_Finish;
table->Flush = _mesa_Flush;
+ table->FogCoordfEXT = _mesa_FogCoordfEXT;
+ table->FogCoordfvEXT = _mesa_FogCoordfvEXT;
+ table->FogCoorddEXT = _mesa_FogCoorddEXT;
+ table->FogCoorddvEXT = _mesa_FogCoorddvEXT;
table->Fogf = save_Fogf;
table->Fogfv = save_Fogfv;
table->Fogi = save_Fogi;
table->Scaled = save_Scaled;
table->Scalef = save_Scalef;
table->Scissor = save_Scissor;
+
+#if 0
+ table->SecondaryColor3fEXT = _mesa_SecondaryColor3bEXT;
+ table->SecondaryColor3fvEXT = _mesa_SecondaryColor3bvEXT;
+ table->SecondaryColor3dEXT = _mesa_SecondaryColor3sEXT;
+ table->SecondaryColordvEXT = _mesa_SecondaryColor3svEXT;
+ table->SecondaryColor3fEXT = _mesa_SecondaryColor3iEXT;
+ table->SecondaryColor3fvEXT = _mesa_SecondaryColor3ivEXT;
+ table->SecondaryColor3dEXT = _mesa_SecondaryColor3fEXT;
+ table->SecondaryColordvEXT = _mesa_SecondaryColor3fvEXT;
+ table->SecondaryColor3fEXT = _mesa_SecondaryColor3dEXT;
+ table->SecondaryColor3fvEXT = _mesa_SecondaryColor3dvEXT;
+ table->SecondaryColor3dEXT = _mesa_SecondaryColor3ubEXT;
+ table->SecondaryColordvEXT = _mesa_SecondaryColor3ubvEXT;
+ table->SecondaryColor3fEXT = _mesa_SecondaryColor3usEXT;
+ table->SecondaryColor3fvEXT = _mesa_SecondaryColor3usvEXT;
+ table->SecondaryColor3dEXT = _mesa_SecondaryColor3uiEXT;
+ table->SecondaryColordvEXT = _mesa_SecondaryColor3uivEXT;
+#endif
+
table->SelectBuffer = _mesa_SelectBuffer;
table->ShadeModel = save_ShadeModel;
table->StencilFunc = save_StencilFunc;
-/* $Id: drawpix.c,v 1.38 2000/10/17 00:42:02 brianp Exp $ */
+/* $Id: drawpix.c,v 1.39 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLint row;
for (row=0; row<drawHeight; row++) {
gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY,
- zSpan, (void *) src, zoomY0);
+ zSpan, 0, (void *) src, zoomY0);
src += rowLength * 4;
destY++;
}
GLint row;
for (row=0; row<drawHeight; row++) {
gl_write_zoomed_rgb_span(ctx, drawWidth, destX, destY,
- zSpan, (void *) src, zoomY0);
+ zSpan, 0, (void *) src, zoomY0);
src += rowLength * 3;
destY++;
}
rgb[i][2] = src[i];
}
gl_write_zoomed_rgb_span(ctx, drawWidth, destX, destY,
- zSpan, (void *) rgb, zoomY0);
+ zSpan, 0, (void *) rgb, zoomY0);
src += rowLength;
destY++;
}
rgba[i][3] = *ptr++;
}
gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY,
- zSpan, (void *) rgba, zoomY0);
+ zSpan, 0, (void *) rgba, zoomY0);
src += rowLength*2;
destY++;
}
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY,
- zSpan, (void *) rgba, zoomY0);
+ zSpan, 0, (void *) rgba, zoomY0);
src += rowLength;
destY++;
}
type, source, &ctx->Unpack,
ctx->ImageTransferState);
if (zoom) {
- gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, indexes, desty);
+ gl_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, desty);
}
else {
- gl_write_index_span(ctx, drawWidth, x, y, zspan, indexes, GL_BITMAP);
+ gl_write_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, GL_BITMAP);
}
}
}
GLint i;
for (i = 0; i < width; i++)
zspan[i] = zptr[i];
- gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP );
+ gl_write_rgba_span( ctx, width, x, y, zspan, 0, rgba, GL_BITMAP );
}
}
else if (type==GL_UNSIGNED_INT && ctx->Visual.DepthBits == 32
for (row = 0; row < height; row++, y++) {
const GLuint *zptr = _mesa_image_address(&ctx->Unpack,
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
- gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP );
+ gl_write_rgba_span( ctx, width, x, y, zptr, 0, rgba, GL_BITMAP );
}
}
else {
&ctx->Unpack, ctx->ImageTransferState );
if (ctx->Visual.RGBAflag) {
if (zoom) {
- gl_write_zoomed_rgba_span(ctx, width, x, y, zspan,
+ gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
(const GLubyte (*)[4])rgba, desty);
}
else {
- gl_write_rgba_span(ctx, width, x, y, zspan, rgba, GL_BITMAP);
+ gl_write_rgba_span(ctx, width, x, y, zspan, 0, rgba, GL_BITMAP);
}
}
else {
if (zoom) {
- gl_write_zoomed_index_span(ctx, width, x, y, zspan,
+ gl_write_zoomed_index_span(ctx, width, x, y, zspan, 0,
ispan, GL_BITMAP);
}
else {
- gl_write_index_span(ctx, width, x, y, zspan, ispan, GL_BITMAP);
+ gl_write_index_span(ctx, width, x, y, zspan, 0,
+ ispan, GL_BITMAP);
}
}
(CONST GLubyte (*)[]) rgba, NULL);
}
else if (zoom) {
- gl_write_zoomed_rgba_span( ctx, width, x, y, zspan,
+ gl_write_zoomed_rgba_span( ctx, width, x, y, zspan, 0,
(CONST GLubyte (*)[]) rgba, desty );
}
else {
- gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, rgba, GL_BITMAP);
+ gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, 0,
+ rgba, GL_BITMAP);
}
}
}
-/* $Id: enable.c,v 1.26 2000/10/21 01:29:12 brianp Exp $ */
+/* $Id: enable.c,v 1.27 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
}
break;
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ ctx->Fog.ColorSumEnabled = state;
+ if (state)
+ SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
+ else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
+ CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
+ ctx->NewState |= NEW_RASTER_OPS;
+ break;
+
default:
gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
case GL_EDGE_FLAG_ARRAY:
ctx->Array.EdgeFlag.Enabled = state;
break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ ctx->Array.FogCoord.Enabled = state;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ ctx->Array.SecondaryColor.Enabled = state;
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
}
-/* $Id: extensions.c,v 1.36 2000/09/25 16:03:59 brianp Exp $ */
+/* $Id: extensions.c,v 1.37 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
{ DEFAULT_ON, "GL_SGIS_pixel_texture" },
{ DEFAULT_ON, "GL_SGIS_texture_edge_clamp" },
{ DEFAULT_ON, "GL_SGIX_pixel_texture" },
- { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" }
+ { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" },
+
+ { DEFAULT_OFF, "GL_EXT_secondary_color" },
+ { DEFAULT_ON, "GL_EXT_fog_coord" },
+ { DEFAULT_OFF, "GL_EXT_bgra" },
+ { DEFAULT_OFF, "GL_EXT_cull_vertex" },
};
-/* $Id: fog.c,v 1.20 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: fog.c,v 1.21 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
case GL_FOG_START:
case GL_FOG_END:
case GL_FOG_INDEX:
+ case GL_FOG_COORDINATE_SOURCE_EXT:
p[0] = (GLfloat) *params;
break;
case GL_FOG_COLOR:
ctx->Fog.Color[2] = params[2];
ctx->Fog.Color[3] = params[3];
break;
+ case GL_FOG_COORDINATE_SOURCE_EXT: {
+ GLenum p = (GLenum)(GLint) *params;
+ if (p == GL_FOG_COORDINATE_EXT || p == GL_FRAGMENT_DEPTH_EXT)
+ ctx->Fog.FogCoordinateSource = p;
+ else
+ gl_error( ctx, GL_INVALID_ENUM, "glFog" );
+ break;
+ }
default:
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
}
-typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side,
- GLubyte flag );
-
-typedef void (*fog_coord_func)( struct vertex_buffer *VB,
- const GLvector4f *from,
- GLubyte flag );
-
-static fog_func fog_ci_tab[2];
-static fog_func fog_rgba_tab[2];
-static fog_coord_func make_fog_coord_tab[2];
-
-/*
- * Compute the fogged color for an array of vertices.
- * Input: n - number of vertices
- * v - array of vertices
- * color - the original vertex colors
- * Output: color - the fogged colors
- *
- */
-#define TAG(x) x##_raw
-#define CULLCHECK
-#define IDX 0
-#include "fog_tmp.h"
-
-#define TAG(x) x##_masked
-#define CULLCHECK if (cullmask[i]&flag)
-#define IDX 1
-#include "fog_tmp.h"
void
_mesa_init_fog( void )
{
- init_fog_tab_masked();
- init_fog_tab_raw();
+}
+
+static GLvector1f *get_fogcoord_ptr( GLcontext *ctx, GLvector1f *tmp )
+{
+ struct vertex_buffer *VB = ctx->VB;
+
+ if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
+ if (!ctx->NeedEyeCoords) {
+ GLfloat *m = ctx->ModelView.m;
+ GLfloat plane[4];
+
+ plane[0] = m[2];
+ plane[1] = m[6];
+ plane[2] = m[10];
+ plane[3] = m[14];
+
+ /* Full eye coords weren't required, just calculate the
+ * eye Z values.
+ */
+ gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye, 2,
+ VB->ObjPtr, plane, 0 );
+
+ tmp->data = &(VB->Eye.data[0][2]);
+ tmp->start = VB->Eye.start+2;
+ tmp->stride = VB->Eye.stride;
+ return tmp;
+ }
+ else
+ {
+ if (VB->EyePtr->size < 2)
+ gl_vector4f_clean_elem( &VB->Eye, VB->Count, 2 );
+
+ tmp->data = &(VB->EyePtr->data[0][2]);
+ tmp->start = VB->EyePtr->start+2;
+ tmp->stride = VB->EyePtr->stride;
+ return tmp;
+ }
+ } else
+ return VB->FogCoordPtr;
}
-/*
- * Compute fog for the vertices in the vertex buffer.
+/* Use lookup table & interpolation?
*/
-void
-_mesa_fog_vertices( struct vertex_buffer *VB )
+static void
+make_win_fog_coords( struct vertex_buffer *VB,
+ GLvector1f *fogcoord)
{
- GLcontext *ctx = VB->ctx;
- GLuint i = VB->CullMode & 1;
-
- if (ctx->Visual.RGBAflag) {
- /* Fog RGB colors */
- if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT );
- fog_rgba_tab[i]( VB, 1, VERT_FACE_REAR );
- } else {
- fog_rgba_tab[i]( VB, 0, VERT_FACE_FRONT|VERT_FACE_REAR );
+ const GLcontext *ctx = VB->ctx;
+ GLfloat end = ctx->Fog.End;
+ GLfloat *v = fogcoord->start;
+ GLuint stride = fogcoord->stride;
+ GLuint n = VB->Count - VB->Start;
+ GLfloat *out;
+ GLfloat d;
+ GLuint i;
+
+ VB->FogCoordPtr = VB->store.FogCoord;
+ out = VB->FogCoordPtr->data + VB->Start;
+
+ switch (ctx->Fog.Mode) {
+ case GL_LINEAR:
+ d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
+ out[i] = (end - ABSF(*v)) * d;
+ if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]);
}
- }
- else {
- /* Fog color indexes */
- if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- fog_ci_tab[i]( VB, 0, VERT_FACE_FRONT );
- fog_ci_tab[i]( VB, 1, VERT_FACE_REAR );
- } else {
- fog_ci_tab[i]( VB, 0, VERT_FACE_FRONT|VERT_FACE_REAR );
+ break;
+ case GL_EXP:
+ d = -ctx->Fog.Density;
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) {
+ out[i] = exp( d*ABSF(*v) );
+ if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]);
+ }
+ break;
+ case GL_EXP2:
+ d = -(ctx->Fog.Density*ctx->Fog.Density);
+ for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) {
+ GLfloat z = *v;
+ out[i] = exp( d*z*z );
+ if (0) fprintf(stderr, "z %f out %f\n", *v, out[i]);
}
+ break;
+ default:
+ gl_problem(ctx, "Bad fog mode in make_fog_coord");
+ return;
}
}
-static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d )
+void
+_mesa_make_win_fog_coords( struct vertex_buffer *VB )
{
- d->type = 0;
+ GLvector1f tmp;
- if (ctx->FogMode==FOG_FRAGMENT)
- {
- d->type = PIPE_IMMEDIATE|PIPE_PRECALC;
- d->inputs = VERT_OBJ_ANY;
- d->outputs = VERT_FOG_COORD;
- }
+ make_win_fog_coords( VB, get_fogcoord_ptr( VB->ctx, &tmp ) );
}
-static void gl_make_fog_coords( struct vertex_buffer *VB )
+
+/*
+ * Apply fog to an array of RGBA pixels.
+ * Input: n - number of pixels
+ * fog - array of interpolated screen-space fog coordinates in [0..1]
+ * red, green, blue, alpha - pixel colors
+ * Output: red, green, blue, alpha - fogged pixel colors
+ */
+void
+_mesa_fog_rgba_pixels( const GLcontext *ctx,
+ GLuint n,
+ const GLfixed fog[],
+ GLubyte rgba[][4] )
{
- GLcontext *ctx = VB->ctx;
-
- /* If full eye coords weren't required, just calculate the eye Z
- * values.
- */
- if (!ctx->NeedEyeCoords) {
- GLfloat *m = ctx->ModelView.m;
- GLfloat plane[4];
-
- plane[0] = m[2];
- plane[1] = m[6];
- plane[2] = m[10];
- plane[3] = m[14];
-
- gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye,
- 2, /* fill z coordinates */
- VB->ObjPtr,
- plane,
- 0 );
-
- make_fog_coord_tab[0]( VB, &VB->Eye, 0 );
- }
- else
- {
- make_fog_coord_tab[0]( VB, VB->EyePtr, 0 );
+ GLfixed rFog = ctx->Fog.Color[0] * 255.0;
+ GLfixed gFog = ctx->Fog.Color[1] * 255.0;
+ GLfixed bFog = ctx->Fog.Color[2] * 255.0;
+ GLuint i;
+
+ for (i=0;i<n;i++) {
+ GLfixed f = CLAMP(fog[i], 0, FIXED_ONE);
+ GLfixed g = FIXED_ONE - f;
+/* fprintf(stderr, "f %d/%f g %d ONE %d\n", f, f/(float)FIXED_ONE, g, FIXED_ONE); */
+ 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;
}
}
-/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this
- * stage for the default PIPE_OP_FOG pipeline stage.
- */
-struct gl_pipeline_stage gl_fog_coord_stage = {
- "build fog coordinates",
- PIPE_OP_FOG,
- PIPE_PRECALC|PIPE_IMMEDIATE,
- 0,
- NEW_FOG,
- NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW,
- 0, 0,
- 0, 0, 0,
- check_fog_coords,
- gl_make_fog_coords
-};
+/*
+ * Apply fog to an array of color index pixels.
+ * Input: n - number of pixels
+ * z - array of integer depth values
+ * index - pixel color indexes
+ * Output: index - fogged pixel color indexes
+ */
+void
+_mesa_fog_ci_pixels( const GLcontext *ctx,
+ GLuint n, const GLfixed fog[], GLuint index[] )
+{
+ GLuint idx = ctx->Fog.Index;
+ GLuint i;
+
+ for (i=0;i<n;i++) {
+ GLfixed f = FixedToFloat(CLAMP(fog[i], 0, FIXED_ONE));
+ index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * idx);
+ }
+}
/*
- * Apply fog to an array of RGBA pixels.
+ * Calculate fog coords from window z values
* Input: n - number of pixels
* z - array of integer depth values
* red, green, blue, alpha - pixel colors
* Output: red, green, blue, alpha - fogged pixel colors
+ *
+ * Use lookup table & interpolation?
*/
void
-_mesa_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLubyte rgba[][4] )
+_mesa_win_fog_coords_from_z( const GLcontext *ctx,
+ GLuint n,
+ const GLdepth z[],
+ GLfixed fogcoord[] )
{
GLfloat c = ctx->ProjectionMatrix.m[10];
GLfloat d = ctx->ProjectionMatrix.m[14];
GLuint i;
- GLfloat rFog = ctx->Fog.Color[0] * 255.0F;
- GLfloat gFog = ctx->Fog.Color[1] * 255.0F;
- GLfloat bFog = ctx->Fog.Color[2] * 255.0F;
-
GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ];
GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ];
for (i=0;i<n;i++) {
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
GLfloat eyez = -d / (c+ndcz);
- GLfloat f, g;
- if (eyez < 0.0) eyez = -eyez;
- f = (fogEnd - eyez) * fogScale;
- f = CLAMP( f, 0.0F, 1.0F );
- g = 1.0F - f;
- rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog);
- rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog);
- rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog);
+ if (eyez < 0.0) eyez = -eyez;
+ fogcoord[i] = (fogEnd - eyez) * fogScale;
}
}
break;
for (i=0;i<n;i++) {
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
GLfloat eyez = d / (c+ndcz);
- GLfloat f, g;
- if (eyez < 0.0)
- eyez = -eyez;
- f = exp( -ctx->Fog.Density * eyez );
- g = 1.0F - f;
- rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog);
- rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog);
- rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog);
+ if (eyez < 0.0) eyez = -eyez;
+ fogcoord[i] = exp( -ctx->Fog.Density * eyez );
}
break;
case GL_EXP2:
for (i=0;i<n;i++) {
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
GLfloat eyez = d / (c+ndcz);
- GLfloat f, g;
GLfloat tmp = negDensitySquared * eyez * eyez;
#ifdef __alpha__
- /* XXX this underflow check may be needed for other systems */
if (tmp < FLT_MIN_10_EXP)
- f = exp( FLT_MIN_10_EXP );
- else
+ tmp = FLT_MIN_10_EXP;
#endif
- f = exp( tmp );
- g = 1.0F - f;
- rgba[i][RCOMP] = (GLint) (f * rgba[i][RCOMP] + g * rFog);
- rgba[i][GCOMP] = (GLint) (f * rgba[i][GCOMP] + g * gFog);
- rgba[i][BCOMP] = (GLint) (f * rgba[i][BCOMP] + g * bFog);
+ fogcoord[i] = exp( tmp );
}
}
break;
default:
- gl_problem(ctx, "Bad fog mode in _mesa_fog_rgba_pixels");
+ gl_problem(ctx, "Bad fog mode in _mesa_win_fog_coords_from_z");
return;
}
}
+/*
+ * Apply fog to an array of RGBA pixels.
+ * Input: n - number of pixels
+ * z - array of integer depth values
+ * red, green, blue, alpha - pixel colors
+ * Output: red, green, blue, alpha - fogged pixel colors
+ */
+void
+_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
+ GLuint n, const GLdepth z[], GLubyte rgba[][4] )
+{
+ GLfixed fog[MAX_WIDTH];
+ _mesa_win_fog_coords_from_z( ctx, n, z, fog );
+ _mesa_fog_rgba_pixels( ctx, n, fog, rgba );
+}
/*
* Output: index - fogged pixel color indexes
*/
void
-_mesa_fog_ci_pixels( const GLcontext *ctx,
+_mesa_depth_fog_ci_pixels( const GLcontext *ctx,
GLuint n, const GLdepth z[], GLuint index[] )
{
- GLfloat c = ctx->ProjectionMatrix.m[10];
- GLfloat d = ctx->ProjectionMatrix.m[14];
- GLuint i;
-
- GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ];
- GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ];
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- {
- GLfloat fogEnd = ctx->Fog.End;
- GLfloat fogScale = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- for (i=0;i<n;i++) {
- GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
- GLfloat eyez = -d / (c+ndcz);
- GLfloat f;
- if (eyez < 0.0) eyez = -eyez;
- f = (fogEnd - eyez) * fogScale;
- f = CLAMP( f, 0.0F, 1.0F );
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index);
- }
- }
- break;
- case GL_EXP:
- for (i=0;i<n;i++) {
- GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
- GLfloat eyez = -d / (c+ndcz);
- GLfloat f;
- if (eyez < 0.0)
- eyez = -eyez;
- f = exp( -ctx->Fog.Density * eyez );
- f = CLAMP( f, 0.0F, 1.0F );
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index);
- }
- break;
- case GL_EXP2:
- {
- GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density;
- for (i=0;i<n;i++) {
- GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
- GLfloat eyez = -d / (c+ndcz);
- GLfloat tmp, f;
- if (eyez < 0.0)
- eyez = -eyez;
- tmp = negDensitySquared * eyez * eyez;
-#ifdef __alpha__
- /* XXX this underflow check may be needed for other systems */
- if (tmp < FLT_MIN_10_EXP)
- f = exp( FLT_MIN_10_EXP );
- else
-#endif
- f = exp( tmp );
- f = CLAMP( f, 0.0F, 1.0F );
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * ctx->Fog.Index);
- }
- }
- break;
- default:
- gl_problem(ctx, "Bad fog mode in _mesa_fog_ci_pixels");
- return;
- }
+ GLfixed fog[MAX_WIDTH];
+ _mesa_win_fog_coords_from_z( ctx, n, z, fog );
+ _mesa_fog_ci_pixels( ctx, n, fog, index );
}
+
-/* $Id: fog.h,v 1.4 2000/04/05 22:08:54 brianp Exp $ */
+/* $Id: fog.h,v 1.5 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "types.h"
-extern struct gl_pipeline_stage gl_fog_coord_stage;
-
extern void
_mesa_Fogf(GLenum pname, GLfloat param);
extern void
_mesa_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[],
+ GLuint n, const GLfixed fog[],
GLubyte rgba[][4] );
extern void
_mesa_fog_ci_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLuint indx[] );
+ GLuint n, const GLfixed fog[], GLuint indx[] );
+
+
+extern void
+_mesa_make_win_fog_coords( struct vertex_buffer *VB );
+
+
+extern void
+_mesa_win_fog_coords_from_z( const GLcontext *ctx,
+ GLuint n,
+ const GLdepth z[],
+ GLfixed fogcoord[] );
+
+extern void
+_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
+ GLuint n, const GLdepth z[], GLubyte rgba[][4] );
+
+extern void
+_mesa_depth_fog_ci_pixels( const GLcontext *ctx,
+ GLuint n, const GLdepth z[], GLuint index[] );
+
extern void
-/* $Id: get.c,v 1.34 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: get.c,v 1.35 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
#endif
+
static GLenum
pixel_texgen_mode(const GLcontext *ctx)
{
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
*params = ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ *params = ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]);
+ params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]);
+ params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ *params = ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ *params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride);
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Current.FogCoord);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ *params = ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ *params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
*params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ *params = (GLdouble) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
+ params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
+ params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ *params = (GLdouble) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ *params = (GLdouble) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ *params = (GLdouble) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ *params = (GLdouble) ctx->Array.SecondaryColor.Stride;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ *params = (GLdouble) ctx->Current.FogCoord;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ *params = (GLdouble) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ *params = (GLdouble) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ *params = (GLdouble) ctx->Array.FogCoord.Stride;
+ break;
+
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
}
*params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ *params = (GLfloat) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
+ params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
+ params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ *params = (GLfloat) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ *params = (GLfloat) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ *params = (GLfloat) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ *params = (GLfloat) ctx->Array.SecondaryColor.Stride;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ *params = (GLfloat) ctx->Current.FogCoord;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ *params = (GLfloat) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ *params = (GLfloat) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ *params = (GLfloat) ctx->Array.FogCoord.Stride;
+ break;
+
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
}
*params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+
+ /* GL_EXT_secondary_color */
+ case GL_COLOR_SUM_EXT:
+ *params = (GLint) ctx->Fog.ColorSumEnabled;
+ break;
+ case GL_CURRENT_SECONDARY_COLOR_EXT:
+ params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) );
+ params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) );
+ params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) );
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_EXT:
+ *params = (GLint) ctx->Array.SecondaryColor.Enabled;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT:
+ *params = (GLint) ctx->Array.SecondaryColor.Type;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT:
+ *params = (GLint) ctx->Array.SecondaryColor.Stride;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
+ *params = (GLint) ctx->Array.SecondaryColor.Stride;
+ break;
+
+ /* GL_EXT_fog_coord */
+ case GL_CURRENT_FOG_COORDINATE_EXT:
+ *params = (GLint) ctx->Current.FogCoord;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_EXT:
+ *params = (GLint) ctx->Array.FogCoord.Enabled;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
+ *params = (GLint) ctx->Array.FogCoord.Type;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
+ *params = (GLint) ctx->Array.FogCoord.Stride;
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
case GL_COLOR_ARRAY_POINTER:
*params = ctx->Array.Color.Ptr;
break;
+ case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
+ *params = ctx->Array.SecondaryColor.Ptr;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
+ *params = ctx->Array.FogCoord.Ptr;
+ break;
case GL_INDEX_ARRAY_POINTER:
*params = ctx->Array.Index.Ptr;
break;
-/* $Id: light.c,v 1.17 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: light.c,v 1.18 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
case GL_LIGHT_MODEL_COLOR_CONTROL:
if (params[0] == (GLfloat) GL_SINGLE_COLOR) {
ctx->Light.Model.ColorControl = GL_SINGLE_COLOR;
- CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
+ if (!ctx->Fog.ColorSumEnabled)
+ CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
}
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) {
ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR;
-/* $Id: lines.c,v 1.16 2000/10/20 19:54:49 brianp Exp $ */
+/* $Id: lines.c,v 1.17 2000/10/27 16:44:40 keithw Exp $ */
/*
* Mesa 3-D graphics library
PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
#include "linetemp.h"
#define INTERP_XY 1
#define INTERP_Z 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
#include "linetemp.h"
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
#define INTERP_XY 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
#include "linetemp.h"
#define INTERP_XY 1
#define INTERP_Z 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
#include "linetemp.h"
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLuint *pbi = ctx->PB->index;
(void) pvert;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbi[count] = I; \
count++; \
CHECK_FULL(count);
pbx[count] = X; pbx[count+1] = X; \
pby[count] = Y; pby[count+1] = Y+1; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
pbi[count] = I; pbi[count+1] = I; \
count += 2; \
CHECK_FULL(count);
pbx[count] = X; pbx[count+1] = X+1; \
pby[count] = Y; pby[count+1] = Y; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
pbi[count] = I; pbi[count+1] = I; \
count += 2; \
CHECK_FULL(count);
pby[count] = Y; \
pbz[count] = Z; \
pbi[count] = I; \
+ pbfog[count] = fog0; \
count++; \
CHECK_FULL(count);
#include "linetemp.h"
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
count = ctx->PB->count;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
count++; \
CHECK_FULL(count);
#include "linetemp.h"
pbx[count] = X; pbx[count+1] = X; \
pby[count] = Y; pby[count+1] = Y+1; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
count += 2; \
CHECK_FULL(count);
#define YMAJOR_PLOT(X,Y) \
pbx[count] = X; pbx[count+1] = X+1; \
pby[count] = Y; pby[count+1] = Y; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
count += 2; \
CHECK_FULL(count);
#include "linetemp.h"
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
count++; \
CHECK_FULL(count);
#include "linetemp.h"
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
pbx[count] = X; pbx[count+1] = X; \
pby[count] = Y; pby[count+1] = Y+1; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
pbx[count] = X; pbx[count+1] = X+1; \
pby[count] = Y; pby[count+1] = Y; \
pbz[count] = Z; pbz[count+1] = Z; \
+ pbfog[count] = fog0; pbfog[count+1] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
#define INTERP_Z 1
#define WIDE 1
#define STIPPLE 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
#include "linetemp.h"
}
else {
/* special case: unstippled and width=2 */
#define INTERP_XY 1
#define INTERP_Z 1
-#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \
- PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z);
-#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); \
- PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z);
+#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
+ PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z, fog0);
+#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
+ PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z, fog0);
#include "linetemp.h"
}
else {
#define INTERP_XY 1
#define INTERP_Z 1
#define WIDE 1
-#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
+#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
#include "linetemp.h"
}
}
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLfloat *pbs = ctx->PB->s[0];
GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0];
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbs[count] = fragTexcoord[0];\
pbt[count] = fragTexcoord[1];\
pbu[count] = fragTexcoord[2];\
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbs[count] = fragTexcoord[0];\
pbt[count] = fragTexcoord[1];\
pbu[count] = fragTexcoord[2];\
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLfloat *pbs = ctx->PB->s[0];
GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0];
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbs[count] = fragTexcoord[0]; \
pbt[count] = fragTexcoord[1]; \
pbu[count] = fragTexcoord[2]; \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbs[count] = fragTexcoord[0]; \
pbt[count] = fragTexcoord[1]; \
pbu[count] = fragTexcoord[2]; \
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
GLubyte (*pbspec)[3] = ctx->PB->spec;
(void) pvert;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = FixedToInt(r0); \
pbrgba[count][GCOMP] = FixedToInt(g0); \
pbrgba[count][BCOMP] = FixedToInt(b0); \
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
+ GLfixed *pbfog = ctx->PB->fog;
GLubyte (*pbrgba)[4] = ctx->PB->rgba;
GLubyte (*pbspec)[3] = ctx->PB->spec;
GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- GLubyte sRed = ctx->VB->Specular ? ctx->VB->Specular[pvert][0] : 0;
- GLubyte sGreen = ctx->VB->Specular ? ctx->VB->Specular[pvert][1] : 0;
- GLubyte sBlue = ctx->VB->Specular ? ctx->VB->Specular[pvert][2] : 0;
+ GLubyte sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
+ GLubyte sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
+ GLubyte sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
(void) pvert;
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = color[0]; \
pbrgba[count][GCOMP] = color[1]; \
pbrgba[count][BCOMP] = color[2]; \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
+ pbfog[count] = fog0; \
pbrgba[count][RCOMP] = color[0]; \
pbrgba[count][GCOMP] = color[1]; \
pbrgba[count][BCOMP] = color[2]; \
#define INTERP_RGBA 1
#define PLOT(x, y) \
{ \
- PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, \
+ PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, fog0, \
red, green, blue, coverage ); \
}
#include "lnaatemp.h"
#define INTERP_TEX 1
#define PLOT(x, y) \
{ \
- PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \
+ PB_WRITE_TEX_PIXEL( pb, (x), (y), z, fog0, \
+ red, green, blue, coverage, \
fragTexcoord[0], fragTexcoord[1], fragTexcoord[2] ); \
}
#include "lnaatemp.h"
#define INTERP_MULTITEX 1
#define PLOT(x, y) \
{ \
- PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \
+ PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, fog0, \
red, green, blue, coverage, specRed, specGreen, specBlue, \
fragTexcoord ); \
}
#define INTERP_INDEX 1
#define PLOT(x, y) \
{ \
- PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \
+ PB_WRITE_CI_PIXEL( pb, (x), (y), z, fog0, index + coverage ); \
}
#include "lnaatemp.h"
}
else if (ctx->Driver.LineFunc == null_line)
printf("null_line\n");
else
- printf("Driver func %p\n", ctx->Driver.PointsFunc);
+ printf("Driver func %p\n", ctx->Driver.LineFunc);
}
#endif
if (rgbmode) {
if (ctx->Texture.ReallyEnabled) {
if (ctx->Texture.MultiTextureEnabled
- || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
+ || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
+ || ctx->Fog.ColorSumEnabled)
/* Multitextured! */
ctx->Driver.LineFunc = aa_multitex_rgba_line;
else
else {
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* Width==1, non-stippled, smooth-shaded */
- if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
if (rgbmode)
ctx->Driver.LineFunc = smooth_rgba_z_line;
else
}
else {
/* Width==1, non-stippled, flat-shaded */
- if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
+ if (ctx->Depth.Test || ctx->Fog.Enabled) {
if (rgbmode)
ctx->Driver.LineFunc = flat_rgba_z_line;
else
-/* $Id: points.c,v 1.15 2000/10/20 19:54:49 brianp Exp $ */
+/* $Id: points.c,v 1.16 2000/10/27 16:44:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLfloat *win;
+ GLfloat *win, *fog;
GLint *pbx = PB->x, *pby = PB->y;
GLdepth *pbz = PB->z;
+ GLfixed *pbfog = PB->fog;
GLuint *pbi = PB->index;
GLuint pbcount = PB->count;
GLuint i;
win = &VB->Win.data[first][0];
+ fog = &VB->FogCoordPtr->data[first];
+
for (i = first; i <= last; i++) {
if (VB->ClipMask[i] == 0) {
pbx[pbcount] = (GLint) win[0];
pby[pbcount] = (GLint) win[1];
pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset);
+ pbfog[pbcount] = FloatToFixed(fog[i]);
pbi[pbcount] = VB->IndexPtr->data[i];
pbcount++;
}
for (i = first; i <= last; i++) {
if (VB->ClipMask[i] == 0) {
GLint x, y, z;
+ GLint fog;
GLint red, green, blue, alpha;
x = (GLint) VB->Win.data[i][0];
y = (GLint) VB->Win.data[i][1];
z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
red = VB->ColorPtr->data[i][0];
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
alpha = VB->ColorPtr->data[i][3];
- PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha );
+ PB_WRITE_RGBA_PIXEL( PB, x, y, z, fog, red, green, blue, alpha );
}
}
PB_CHECK_FLUSH(ctx, PB);
GLint y = (GLint) VB->Win.data[i][1];
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (isize & 1) {
/* odd size */
x0 = x - radius;
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_PIXEL( PB, ix, iy, z );
+ PB_WRITE_PIXEL( PB, ix, iy, z, fog );
}
}
PB_CHECK_FLUSH(ctx,PB);
GLint y = (GLint) VB->Win.data[i][1];
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (isize & 1) {
/* odd size */
x0 = x - radius;
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_PIXEL( PB, ix, iy, z );
+ PB_WRITE_PIXEL( PB, ix, iy, z, fog );
}
}
PB_CHECK_FLUSH(ctx,PB);
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
GLint isize = (GLint) (ctx->Point.Size + 0.5F);
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (isize < 1) {
isize = 1;
}
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha,
+ PB_WRITE_TEX_PIXEL( PB, ix, iy, z, fog, red, green, blue, alpha,
s, t, u );
}
}
const GLint green = VB->ColorPtr->data[i][1];
const GLint blue = VB->ColorPtr->data[i][2];
const GLint alpha = VB->ColorPtr->data[i][3];
- const GLint sRed = VB->Specular ? VB->Specular[i][0] : 0;
- const GLint sGreen = VB->Specular ? VB->Specular[i][1] : 0;
- const GLint sBlue = VB->Specular ? VB->Specular[i][2] : 0;
+ const GLint sRed = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][0] : 0;
+ const GLint sGreen = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][1] : 0;
+ const GLint sBlue = VB->SecondaryColorPtr->data ? VB->SecondaryColorPtr->data[i][2] : 0;
const GLint x = (GLint) VB->Win.data[i][0];
const GLint y = (GLint) VB->Win.data[i][1];
const GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
GLint radius, u;
GLint isize = (GLint) (ctx->Point.Size + 0.5F);
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (isize < 1) {
isize = 1;
}
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_MULTITEX_SPEC_PIXEL( PB, ix, iy, z,
+ PB_WRITE_MULTITEX_SPEC_PIXEL( PB, ix, iy, z, fog,
red, green, blue, alpha,
sRed, sGreen, sBlue,
texcoord );
GLfloat texcoord[MAX_TEXTURE_UNITS][4];
GLint u, alpha;
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u].ReallyEnabled) {
switch (VB->TexCoordPtr[0]->size) {
alpha = (alpha * coverage) >> 8;
}
if (ctx->Texture.MultiTextureEnabled) {
- PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue,
+ PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, fog,
+ red, green, blue,
alpha, texcoord );
}
else {
- PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha,
+ PB_WRITE_TEX_PIXEL( PB, x,y,z, fog,
+ red, green, blue, alpha,
texcoord[0][0],
texcoord[0][1],
texcoord[0][2] );
const GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
GLint x, y;
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
/*
printf("point %g, %g\n", VB->Win.data[i][0], VB->Win.data[i][1]);
printf("%d..%d X %d..%d\n", xmin, xmax, ymin, ymax);
/* coverage is in [0,256] */
alpha = (alpha * coverage) >> 8;
}
- PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha);
+ PB_WRITE_RGBA_PIXEL(PB, x, y, z, fog,
+ red, green, blue, alpha);
}
}
}
};
-static void
-clip_dist(GLfloat *out, GLuint first, GLuint last,
- const GLcontext *ctx, GLvector4f *clip)
-{
- /* this is never called */
- gl_problem(NULL, "clip_dist() called - dead code!\n");
-
- (void) out;
- (void) first;
- (void) last;
- (void) ctx;
- (void) clip;
-
-#if 0
- GLuint i;
- const GLfloat *from = (GLfloat *)clip_vec->start;
- const GLuint stride = clip_vec->stride;
-
- for (i = first ; i <= last ; i++ )
- {
- GLfloat dist = win[i][2];
- out[i] = 1/(ctx->Point.Params[0]+
- dist * (ctx->Point.Params[1] +
- dist * ctx->Point.Params[2]));
- }
-#endif
-}
-
-
/*
* Distance Attenuated General CI points.
const GLfloat psize = ctx->Point.Size;
GLuint i;
- if (ctx->NeedEyeCoords)
- (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
- else
- clip_dist( dist, first, last, ctx, VB->ClipPtr );
+ ASSERT(ctx->NeedEyeCoords);
+ (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
+
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
GLfloat dsize = psize * dist[i];
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (dsize >= ctx->Point.Threshold) {
isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F);
}
for (iy=y0;iy<=y1;iy++) {
for (ix=x0;ix<=x1;ix++) {
- PB_WRITE_PIXEL( PB, ix, iy, z );
+ PB_WRITE_PIXEL( PB, ix, iy, z, fog );
}
}
PB_CHECK_FLUSH(ctx,PB);
const GLfloat psize = ctx->Point.Size;
GLuint i;
- if (ctx->NeedEyeCoords)
- (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
- else
- clip_dist( dist, first, last, ctx, VB->ClipPtr );
+ ASSERT (ctx->NeedEyeCoords);
+ (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
GLfloat dsize=psize*dist[i];
GLubyte alpha;
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (dsize >= ctx->Point.Threshold) {
isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
alpha = VB->ColorPtr->data[i][3];
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
- PB_WRITE_PIXEL( PB, ix, iy, z );
+ PB_WRITE_PIXEL( PB, ix, iy, z, fog );
}
}
PB_CHECK_FLUSH(ctx,PB);
const GLfloat psize = ctx->Point.Size;
GLuint i;
- if (ctx->NeedEyeCoords)
- (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
- else
- clip_dist( dist, first, last, ctx, VB->ClipPtr );
+ ASSERT(ctx->NeedEyeCoords);
+ (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
GLint isize, radius;
GLfloat dsize = psize*dist[i];
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
/* compute point size and alpha */
if (dsize >= ctx->Point.Threshold) {
isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F);
for (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) {
if (ctx->Texture.MultiTextureEnabled) {
- PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z,
+ PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, fog,
red, green, blue, alpha,
texcoord );
}
else {
- PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha,
+ PB_WRITE_TEX_PIXEL( PB, ix, iy, z, fog,
+ red, green, blue, alpha,
texcoord[0][0],
texcoord[0][1],
texcoord[0][2] );
const GLfloat psize = ctx->Point.Size;
GLuint i;
- if (ctx->NeedEyeCoords)
- (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
- else
- clip_dist( dist, first, last, ctx, VB->ClipPtr );
+ ASSERT(ctx->NeedEyeCoords);
+ (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
if (ctx->Texture.ReallyEnabled) {
for (i=first;i<=last;i++) {
GLfloat dsize = psize * dist[i];
GLint u;
+ GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
if (dsize >= ctx->Point.Threshold) {
radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F;
alphaf = 1.0F;
}
alpha = (GLint) (alpha * alphaf);
if (ctx->Texture.MultiTextureEnabled) {
- PB_WRITE_MULTITEX_PIXEL( PB, x, y, z,
+ PB_WRITE_MULTITEX_PIXEL( PB, x, y, z, fog,
red, green, blue, alpha,
texcoord );
}
else {
- PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha,
+ PB_WRITE_TEX_PIXEL( PB, x,y,z, fog,
+ red, green, blue, alpha,
texcoord[0][0],
texcoord[0][1],
texcoord[0][2] );
GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf;
GLint xmin, ymin, xmax, ymax;
GLint x, y, z;
+ GLfixed fog;
GLint red, green, blue, alpha;
GLfloat dsize = psize * dist[i];
ymax = (GLint) (VB->Win.data[i][1] + radius);
z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ fog = FloatToFixed( VB->FogCoordPtr->data[i] );
+
red = VB->ColorPtr->data[i][0];
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
alpha = (alpha * coverage) >> 8;
}
alpha = (GLint) (alpha * alphaf);
- PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha);
+ PB_WRITE_RGBA_PIXEL(PB, x, y, z, fog,
+ red, green, blue, alpha);
}
}
}
}
else if (ctx->Texture.ReallyEnabled) {
if (ctx->Texture.MultiTextureEnabled ||
- ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
+ ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR ||
+ ctx->Fog.ColorSumEnabled) {
ctx->Driver.PointsFunc = multitextured_rgba_points;
}
else {
-/* $Id: state.c,v 1.33 2000/10/21 01:29:12 brianp Exp $ */
+/* $Id: state.c,v 1.34 2000/10/27 16:44:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
exec->FeedbackBuffer = _mesa_FeedbackBuffer;
exec->Finish = _mesa_Finish;
exec->Flush = _mesa_Flush;
+
+ exec->FogCoordfEXT = _mesa_FogCoordfEXT;
+ exec->FogCoordfvEXT = _mesa_FogCoordfvEXT;
+ exec->FogCoorddEXT = _mesa_FogCoorddEXT;
+ exec->FogCoorddvEXT = _mesa_FogCoorddvEXT;
+ exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
+
exec->Fogf = _mesa_Fogf;
exec->Fogfv = _mesa_Fogfv;
exec->Fogi = _mesa_Fogi;
exec->Scaled = _mesa_Scaled;
exec->Scalef = _mesa_Scalef;
exec->Scissor = _mesa_Scissor;
+
+#if 0
+ exec->SecondaryColor3fEXT = _mesa_SecondaryColor3bEXT;
+ exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3bvEXT;
+ exec->SecondaryColor3dEXT = _mesa_SecondaryColor3sEXT;
+ exec->SecondaryColordvEXT = _mesa_SecondaryColor3svEXT;
+ exec->SecondaryColor3fEXT = _mesa_SecondaryColor3iEXT;
+ exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3ivEXT;
+ exec->SecondaryColor3dEXT = _mesa_SecondaryColor3fEXT;
+ exec->SecondaryColordvEXT = _mesa_SecondaryColor3fvEXT;
+ exec->SecondaryColor3fEXT = _mesa_SecondaryColor3dEXT;
+ exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3dvEXT;
+ exec->SecondaryColor3dEXT = _mesa_SecondaryColor3ubEXT;
+ exec->SecondaryColordvEXT = _mesa_SecondaryColor3ubvEXT;
+ exec->SecondaryColor3fEXT = _mesa_SecondaryColor3usEXT;
+ exec->SecondaryColor3fvEXT = _mesa_SecondaryColor3usvEXT;
+ exec->SecondaryColor3dEXT = _mesa_SecondaryColor3uiEXT;
+ exec->SecondaryColordvEXT = _mesa_SecondaryColor3uivEXT;
+ exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
+#endif
+
exec->SelectBuffer = _mesa_SelectBuffer;
exec->ShadeModel = _mesa_ShadeModel;
exec->StencilFunc = _mesa_StencilFunc;
/**********************************************************************/
-static void update_fog_mode( GLcontext *ctx )
-{
- int old_mode = ctx->FogMode;
-
- if (ctx->Fog.Enabled) {
- if (ctx->Texture.ReallyEnabled)
- ctx->FogMode = FOG_FRAGMENT;
- else if (ctx->Hint.Fog == GL_NICEST)
- ctx->FogMode = FOG_FRAGMENT;
- else
- ctx->FogMode = FOG_VERTEX;
-
- if (ctx->Driver.GetParameteri)
- if ((ctx->Driver.GetParameteri)( ctx, DD_HAVE_HARDWARE_FOG ))
- ctx->FogMode = FOG_FRAGMENT;
- }
- else {
- ctx->FogMode = FOG_NONE;
- }
-
- if (old_mode != ctx->FogMode)
- ctx->NewState |= NEW_FOG;
-}
-
/*
* Recompute the value of ctx->RasterMask, etc. according to
if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
- if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT;
+ if (ctx->Fog.Enabled) ctx->RasterMask |= FOG_BIT;
if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
if (ctx->Visual.RGBAflag) {
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
}
- if (ctx->NewState & NEW_FOG) {
- update_fog_mode(ctx);
- }
if (ctx->NewState & NEW_RASTER_OPS) {
update_rasterflags(ctx);
-/* $Id: varray.c,v 1.25 2000/10/20 19:54:49 brianp Exp $ */
+/* $Id: varray.c,v 1.26 2000/10/27 16:44:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
+void
+_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (stride<0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" );
+ return;
+ }
+
+ ctx->Array.FogCoord.StrideB = stride;
+ if (!stride) {
+ switch (type) {
+ case GL_FLOAT:
+ ctx->Array.FogCoord.StrideB = sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ ctx->Array.FogCoord.StrideB = sizeof(GLdouble);
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" );
+ return;
+ }
+ }
+ ctx->Array.FogCoord.Type = type;
+ ctx->Array.FogCoord.Stride = stride;
+ ctx->Array.FogCoord.Ptr = (void *) ptr;
+ ctx->Array.FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)];
+ ctx->Array.FogCoordEltFunc = gl_trans_elt_1f_tab[TYPE_IDX(type)];
+ ctx->Array.NewArrayState |= VERT_FOG_COORD;
+ ctx->NewState |= NEW_CLIENT_STATE;
+}
+
+
void
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
{
}
+void
+_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ fprintf(stderr, "%s\n", __FUNCTION__);
+
+ if (size != 3 && size != 4) {
+ gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
+ return;
+ }
+ if (stride<0) {
+ gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API))
+ fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size,
+ gl_lookup_enum_by_nr( type ),
+ stride);
+
+ ctx->Array.SecondaryColor.StrideB = stride;
+ if (!stride) {
+ switch (type) {
+ case GL_BYTE:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLbyte);
+ break;
+ case GL_UNSIGNED_BYTE:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLubyte);
+ break;
+ case GL_SHORT:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLshort);
+ break;
+ case GL_UNSIGNED_SHORT:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLushort);
+ break;
+ case GL_INT:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLint);
+ break;
+ case GL_UNSIGNED_INT:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLuint);
+ break;
+ case GL_FLOAT:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLfloat);
+ break;
+ case GL_DOUBLE:
+ ctx->Array.SecondaryColor.StrideB = size*sizeof(GLdouble);
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" );
+ return;
+ }
+ }
+ ctx->Array.SecondaryColor.Size = 3; /* hardwire */
+ ctx->Array.SecondaryColor.Type = type;
+ ctx->Array.SecondaryColor.Stride = stride;
+ ctx->Array.SecondaryColor.Ptr = (void *) ptr;
+ ctx->Array.SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)];
+ ctx->Array.SecondaryColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)];
+ ctx->Array.NewArrayState |= VERT_SPEC_RGB;
+ ctx->NewState |= NEW_CLIENT_STATE;
+}
+
+
void
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
}
-#if 0
-/* Called only from gl_DrawElements
- */
-static void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
-{
- switch (type) {
- case GL_UNSIGNED_BYTE:
- ctx->CVA.Elt.StrideB = sizeof(GLubyte);
- break;
- case GL_UNSIGNED_SHORT:
- ctx->CVA.Elt.StrideB = sizeof(GLushort);
- break;
- case GL_UNSIGNED_INT:
- ctx->CVA.Elt.StrideB = sizeof(GLuint);
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glEltPointer(type)" );
- return;
- }
- ctx->CVA.Elt.Type = type;
- ctx->CVA.Elt.Stride = 0;
- ctx->CVA.Elt.Ptr = (void *) ptr;
- ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)];
- ctx->Array.NewArrayState |= VERT_ELT; /* ??? */
-}
-#endif
flags, elts, (VERT_ELT|VERT_RGBA),
start, count);
+
+ if (translate & VERT_SPEC_RGB)
+ (ctx->Array.SecondaryColorEltFunc)( IM->SecondaryColor,
+ &ctx->Array.SecondaryColor,
+ flags, elts, (VERT_ELT|VERT_SPEC_RGB),
+ start, count);
+
+ if (translate & VERT_FOG_COORD)
+ (ctx->Array.FogCoordEltFunc)( IM->FogCoord,
+ &ctx->Array.FogCoord,
+ flags, elts, (VERT_ELT|VERT_FOG_COORD),
+ start, count);
+
if (translate & VERT_INDEX)
(ctx->Array.IndexEltFunc)( IM->Index,
&ctx->Array.Index,
GLint i;
struct gl_client_array *Normal;
struct gl_client_array *Color;
+ struct gl_client_array *SecondaryColor;
+ struct gl_client_array *FogCoord;
struct gl_client_array *Index;
struct gl_client_array *TexCoord[MAX_TEXTURE_UNITS];
struct gl_client_array *EdgeFlag;
gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)];
}
}
+
+ if (required & VERT_SPEC_RGB)
+ {
+ SecondaryColor = &ctx->Array.SecondaryColor;
+ if (fallback & VERT_SPEC_RGB) {
+ SecondaryColor = &ctx->Fallback.SecondaryColor;
+ ctx->Array.SecondaryColorFunc =
+ gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)];
+ }
+ }
+
+ if (required & VERT_FOG_COORD)
+ {
+ FogCoord = &ctx->Array.FogCoord;
+ if (fallback & VERT_FOG_COORD) {
+ FogCoord = &ctx->Fallback.FogCoord;
+ ctx->Array.FogCoordFunc =
+ gl_trans_1f_tab[TYPE_IDX(GL_FLOAT)];
+ }
+ }
if (required & VERT_INDEX) {
Index = &ctx->Array.Index;
ctx->Array.ColorFunc( IM->Color + VB_START,
Color, start, n );
}
+
+ if (required & VERT_SPEC_RGB) {
+ ctx->Array.SecondaryColorFunc( IM->SecondaryColor + VB_START,
+ SecondaryColor, start, n );
+ }
+
+ if (required & VERT_FOG_COORD) {
+ ctx->Array.FogCoordFunc( IM->FogCoord + VB_START,
+ FogCoord, start, n );
+ }
if (required & VERT_INDEX) {
ctx->Array.IndexFunc( IM->Index + VB_START,
VB->Color[0] = VB->Color[1] = VB->ColorPtr;
VB->IndexPtr = &IM->v.Index;
VB->EdgeFlagPtr = &IM->v.EdgeFlag;
+ VB->SecondaryColorPtr = &IM->v.SecondaryColor;
+ VB->FogCoordPtr = &IM->v.FogCoord;
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
VB->TexCoordPtr[i] = &IM->v.TexCoord[i];
}
if (ctx->CompileCVAFlag)
{
-#if defined(MESA_CVA_PROF)
- force_init_prof();
-#endif
-
/* Treat VERT_ELT like a special client array.
*/
ctx->Array.NewArrayState |= VERT_ELT;
ctx->Array.Summary = 0;
ctx->input->ArrayIncr = 0;
- if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM;
- if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA;
- if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX;
- if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE;
+ if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM;
+ if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA;
+ if (ctx->Array.SecondaryColor.Enabled) ctx->Array.Flags |= VERT_SPEC_RGB;
+ if (ctx->Array.FogCoord.Enabled) ctx->Array.Flags |= VERT_FOG_COORD;
+ if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX;
+ if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE;
if (ctx->Array.Vertex.Enabled) {
ctx->Array.Flags |= sz_flags[ctx->Array.Vertex.Size];
ctx->input->ArrayIncr = 1;
-/* $Id: varray.h,v 1.7 2000/06/12 15:30:52 brianp Exp $ */
+/* $Id: varray.h,v 1.8 2000/10/27 16:44:41 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
+extern void
+_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
+extern void
+_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr);
extern void