aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fog.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-11-16 21:05:34 +0000
committerKeith Whitwell <[email protected]>2000-11-16 21:05:34 +0000
commit23caf20169ac38436ee9c13914f1d6aa7cf6bb5e (patch)
tree21307f7bbcaf9ee1e841d7e7bee130570a7b5b95 /src/mesa/main/fog.c
parent179516673211a2350e479d5321840291f339f5dd (diff)
Move the transform and lighting code to two new directories
math: Provides basic matrix and vector functionality that might be useful to multiple software t&l implementations, and is used by core mesa to manage the Model, Project, etc matrices. tnl: The real transform & lighting code from core mesa, including everything from glVertex3f through vertex buffer handling, transformation, clipping, lighting and handoff to a driver for rasterization. The interfaces of these can be further tightened up, but the basic splitting up of state and code move is done.
Diffstat (limited to 'src/mesa/main/fog.c')
-rw-r--r--src/mesa/main/fog.c104
1 files changed, 1 insertions, 103 deletions
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c
index 97bf52fc998..9593fa2a976 100644
--- a/src/mesa/main/fog.c
+++ b/src/mesa/main/fog.c
@@ -1,4 +1,4 @@
-/* $Id: fog.c,v 1.28 2000/11/05 18:40:58 keithw Exp $ */
+/* $Id: fog.c,v 1.29 2000/11/16 21:05:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -32,10 +32,7 @@
#include "colormac.h"
#include "context.h"
#include "fog.h"
-#include "macros.h"
-#include "mmath.h"
#include "types.h"
-#include "xform.h"
#endif
@@ -146,102 +143,3 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
}
-
-
-
-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;
-}
-
-
-/* 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 ) );
-}
-