core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

t_vb_fog.c File Reference

#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "t_context.h"
#include "t_pipeline.h"

Data Structures

struct  fog_stage_data

Defines

#define FOG_STAGE_DATA(stage)   ((struct fog_stage_data *)stage->privatePtr)
#define FOG_EXP_TABLE_SIZE   256
#define FOG_MAX   (10.0)
#define EXP_FOG_MAX   .0006595
#define FOG_INCR   (FOG_MAX/FOG_EXP_TABLE_SIZE)
#define NEG_EXP(result, narg)

Functions

static void init_static_data (void)
 Initialize the exp_table[] lookup table for approximating exp().
static void compute_fog_blend_factors (GLcontext *ctx, GLvector4f *out, const GLvector4f *in)
 Compute per-vertex fog blend factors from fog coordinates by evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function.
static GLboolean run_fog_stage (GLcontext *ctx, struct tnl_pipeline_stage *stage)
static GLboolean alloc_fog_data (GLcontext *ctx, struct tnl_pipeline_stage *stage)
static void free_fog_data (struct tnl_pipeline_stage *stage)

Variables

static GLfloat exp_table [FOG_EXP_TABLE_SIZE]
static GLfloat inited = 0
struct tnl_pipeline_stage _tnl_fog_coordinate_stage


Define Documentation

#define EXP_FOG_MAX   .0006595

#define FOG_EXP_TABLE_SIZE   256

#define FOG_INCR   (FOG_MAX/FOG_EXP_TABLE_SIZE)

#define FOG_MAX   (10.0)

#define FOG_STAGE_DATA ( stage   )     ((struct fog_stage_data *)stage->privatePtr)

#define NEG_EXP ( result,
narg   ) 

Value:

do {                                                                    \
   GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR));                       \
   GLint k = (GLint) f;                                                 \
   if (k > FOG_EXP_TABLE_SIZE-2)                                        \
      result = (GLfloat) EXP_FOG_MAX;                                   \
   else                                                                 \
      result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]);      \
} while (0)


Function Documentation

static GLboolean alloc_fog_data ( GLcontext ctx,
struct tnl_pipeline_stage stage 
) [static]

static void compute_fog_blend_factors ( GLcontext ctx,
GLvector4f out,
const GLvector4f in 
) [static]

Compute per-vertex fog blend factors from fog coordinates by evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function.

Fog coordinates are distances from the eye (typically between the near and far clip plane distances). Note that fogcoords may be negative, if eye z is source absolute value must be taken earlier. Fog blend factors are in the range [0,1].

static void free_fog_data ( struct tnl_pipeline_stage stage  )  [static]

static void init_static_data ( void   )  [static]

Initialize the exp_table[] lookup table for approximating exp().

static GLboolean run_fog_stage ( GLcontext ctx,
struct tnl_pipeline_stage stage 
) [static]


Variable Documentation

struct tnl_pipeline_stage _tnl_fog_coordinate_stage

Initial value:

{
   "build fog coordinates",     
   NULL,                        
   alloc_fog_data,              
   free_fog_data,               
   NULL,                
   run_fog_stage                
}

GLfloat exp_table[FOG_EXP_TABLE_SIZE] [static]

GLfloat inited = 0 [static]


Generated on Sun Sep 27 06:48:09 2009 for Mesa Transform and Lighting (tnl) by  doxygen 1.5.4