- 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;
-}
-
-
-/* Use lookup table & interpolation?
- */
-static void
-make_win_fog_coords( struct vertex_buffer *VB,
- GLvector1f *fogcoord)
-{
- 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]);
- }
- 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;
- }
-}
-
-
-void
-_mesa_make_win_fog_coords( struct vertex_buffer *VB )
-{
- GLvector1f tmp;
-
- make_win_fog_coords( VB, get_fogcoord_ptr( VB->ctx, &tmp ) );
+ /* Fog group */
+ ctx->Fog.Enabled = GL_FALSE;
+ ctx->Fog.Mode = GL_EXP;
+ ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 );
+ ctx->Fog.Index = 0.0;
+ 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;
+ ctx->Fog._Scale = 1.0f;