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

light.c File Reference

#include "glheader.h"
#include "imports.h"
#include "context.h"
#include "enums.h"
#include "light.h"
#include "macros.h"
#include "simple_list.h"
#include "mtypes.h"
#include "math/m_matrix.h"

Functions

void GLAPIENTRY _mesa_ShadeModel (GLenum mode)
void GLAPIENTRY _mesa_ProvokingVertexEXT (GLenum mode)
 Set the provoking vertex (the vertex which specifies the prim's color when flat shading) to either the first or last vertex of the triangle or line.
void _mesa_light (GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
 Helper function called by _mesa_Lightfv and _mesa_PopAttrib to set per-light state.
void GLAPIENTRY _mesa_Lightf (GLenum light, GLenum pname, GLfloat param)
void GLAPIENTRY _mesa_Lightfv (GLenum light, GLenum pname, const GLfloat *params)
void GLAPIENTRY _mesa_Lighti (GLenum light, GLenum pname, GLint param)
void GLAPIENTRY _mesa_Lightiv (GLenum light, GLenum pname, const GLint *params)
void GLAPIENTRY _mesa_GetLightfv (GLenum light, GLenum pname, GLfloat *params)
void GLAPIENTRY _mesa_GetLightiv (GLenum light, GLenum pname, GLint *params)
void GLAPIENTRY _mesa_LightModelfv (GLenum pname, const GLfloat *params)
void GLAPIENTRY _mesa_LightModeliv (GLenum pname, const GLint *params)
void GLAPIENTRY _mesa_LightModeli (GLenum pname, GLint param)
void GLAPIENTRY _mesa_LightModelf (GLenum pname, GLfloat param)
GLuint _mesa_material_bitmask (GLcontext *ctx, GLenum face, GLenum pname, GLuint legal, const char *where)
void _mesa_copy_materials (struct gl_material *dst, const struct gl_material *src, GLuint bitmask)
void _mesa_update_material (GLcontext *ctx, GLuint bitmask)
void _mesa_update_color_material (GLcontext *ctx, const GLfloat color[4])
void GLAPIENTRY _mesa_ColorMaterial (GLenum face, GLenum mode)
void GLAPIENTRY _mesa_GetMaterialfv (GLenum face, GLenum pname, GLfloat *params)
void GLAPIENTRY _mesa_GetMaterialiv (GLenum face, GLenum pname, GLint *params)
void _mesa_invalidate_spot_exp_table (struct gl_light *l)
static void validate_spot_exp_table (struct gl_light *l)
void _mesa_invalidate_shine_table (GLcontext *ctx, GLuint side)
static void validate_shine_table (GLcontext *ctx, GLuint side, GLfloat shininess)
void _mesa_validate_all_lighting_tables (GLcontext *ctx)
void _mesa_update_lighting (GLcontext *ctx)
 Examine current lighting parameters to determine if the optimized lighting function can be used.
static void compute_light_positions (GLcontext *ctx)
 Update state derived from light position, spot direction.
static void update_modelview_scale (GLcontext *ctx)
void _mesa_update_tnl_spaces (GLcontext *ctx, GLuint new_state)
 Bring up to date any state that relies on _NeedEyeCoords.
void _mesa_allow_light_in_model (GLcontext *ctx, GLboolean flag)
 Drivers may need this if the hardware tnl unit doesn't support the light-in-modelspace optimization.
static void init_light (struct gl_light *l, GLuint n)
 Initialize the n-th light data structure.
static void init_lightmodel (struct gl_lightmodel *lm)
 Initialize the light model data structure.
static void init_material (struct gl_material *m)
 Initialize the material data structure.
void _mesa_init_lighting (GLcontext *ctx)
 Initialize all lighting state for the given context.
void _mesa_free_lighting_data (GLcontext *ctx)
 Deallocate malloc'd lighting state attached to given context.


Function Documentation

void _mesa_allow_light_in_model ( GLcontext ctx,
GLboolean  flag 
)

Drivers may need this if the hardware tnl unit doesn't support the light-in-modelspace optimization.

It's also useful for debugging.

void GLAPIENTRY _mesa_ColorMaterial ( GLenum  face,
GLenum  mode 
)

void _mesa_copy_materials ( struct gl_material dst,
const struct gl_material src,
GLuint  bitmask 
)

void _mesa_free_lighting_data ( GLcontext ctx  ) 

Deallocate malloc'd lighting state attached to given context.

void GLAPIENTRY _mesa_GetLightfv ( GLenum  light,
GLenum  pname,
GLfloat *  params 
)

void GLAPIENTRY _mesa_GetLightiv ( GLenum  light,
GLenum  pname,
GLint *  params 
)

void GLAPIENTRY _mesa_GetMaterialfv ( GLenum  face,
GLenum  pname,
GLfloat *  params 
)

void GLAPIENTRY _mesa_GetMaterialiv ( GLenum  face,
GLenum  pname,
GLint *  params 
)

void _mesa_init_lighting ( GLcontext ctx  ) 

Initialize all lighting state for the given context.

void _mesa_invalidate_shine_table ( GLcontext ctx,
GLuint  side 
)

void _mesa_invalidate_spot_exp_table ( struct gl_light l  ) 

void _mesa_light ( GLcontext ctx,
GLuint  lnum,
GLenum  pname,
const GLfloat *  params 
)

Helper function called by _mesa_Lightfv and _mesa_PopAttrib to set per-light state.

For GL_POSITION and GL_SPOT_DIRECTION the params position/direction will have already been transformed by the modelview matrix! Also, all error checking should have already been done.

void GLAPIENTRY _mesa_Lightf ( GLenum  light,
GLenum  pname,
GLfloat  param 
)

void GLAPIENTRY _mesa_Lightfv ( GLenum  light,
GLenum  pname,
const GLfloat *  params 
)

void GLAPIENTRY _mesa_Lighti ( GLenum  light,
GLenum  pname,
GLint  param 
)

void GLAPIENTRY _mesa_Lightiv ( GLenum  light,
GLenum  pname,
const GLint *  params 
)

void GLAPIENTRY _mesa_LightModelf ( GLenum  pname,
GLfloat  param 
)

void GLAPIENTRY _mesa_LightModelfv ( GLenum  pname,
const GLfloat *  params 
)

void GLAPIENTRY _mesa_LightModeli ( GLenum  pname,
GLint  param 
)

void GLAPIENTRY _mesa_LightModeliv ( GLenum  pname,
const GLint *  params 
)

GLuint _mesa_material_bitmask ( GLcontext ctx,
GLenum  face,
GLenum  pname,
GLuint  legal,
const char *  where 
)

void GLAPIENTRY _mesa_ProvokingVertexEXT ( GLenum  mode  ) 

Set the provoking vertex (the vertex which specifies the prim's color when flat shading) to either the first or last vertex of the triangle or line.

void GLAPIENTRY _mesa_ShadeModel ( GLenum  mode  ) 

void _mesa_update_color_material ( GLcontext ctx,
const GLfloat  color[4] 
)

void _mesa_update_lighting ( GLcontext ctx  ) 

Examine current lighting parameters to determine if the optimized lighting function can be used.

Also, precompute some lighting values such as the products of light source and material ambient, diffuse and specular coefficients.

void _mesa_update_material ( GLcontext ctx,
GLuint  bitmask 
)

void _mesa_update_tnl_spaces ( GLcontext ctx,
GLuint  new_state 
)

Bring up to date any state that relies on _NeedEyeCoords.

void _mesa_validate_all_lighting_tables ( GLcontext ctx  ) 

static void compute_light_positions ( GLcontext ctx  )  [static]

Update state derived from light position, spot direction.

Called upon: _NEW_MODELVIEW _NEW_LIGHT _TNL_NEW_NEED_EYE_COORDS

Update on (_NEW_MODELVIEW | _NEW_LIGHT) when lighting is enabled. Also update on lighting space changes.

static void init_light ( struct gl_light l,
GLuint  n 
) [static]

Initialize the n-th light data structure.

Parameters:
l pointer to the gl_light structure to be initialized.
n number of the light.
Note:
The defaults for light 0 are different than the other lights.

static void init_lightmodel ( struct gl_lightmodel lm  )  [static]

Initialize the light model data structure.

Parameters:
lm pointer to the gl_lightmodel structure to be initialized.

static void init_material ( struct gl_material m  )  [static]

Initialize the material data structure.

Parameters:
m pointer to the gl_material structure to be initialized.

static void update_modelview_scale ( GLcontext ctx  )  [static]

static void validate_shine_table ( GLcontext ctx,
GLuint  side,
GLfloat  shininess 
) [static]

static void validate_spot_exp_table ( struct gl_light l  )  [static]


Generated on Sun Sep 27 06:47:46 2009 for Mesa Main by  doxygen 1.5.4