-/* $Id: light.c,v 1.39 2001/03/03 20:33:27 brianp Exp $ */
+/* $Id: light.c,v 1.42 2001/03/29 16:50:32 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
return;
}
- if (ctx->Light.ShadeModel == mode)
+ if (ctx->Light.ShadeModel == mode)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
GLint i = (GLint) (light - GL_LIGHT0);
struct gl_light *l = &ctx->Light.Light[i];
- if (i < 0 || i >= ctx->Const.MaxLights) {
+ if (i < 0 || i >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glLight" );
return;
}
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
return;
}
- if (l->SpotExponent == params[0])
+ if (l->SpotExponent == params[0])
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
l->SpotExponent = params[0];
GLint l = (GLint) (light - GL_LIGHT0);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (l < 0 || l >= ctx->Const.MaxLights) {
+ if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
return;
}
GLint l = (GLint) (light - GL_LIGHT0);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (l < 0 || l >= ctx->Const.MaxLights) {
+ if (l < 0 || l >= (GLint) ctx->Const.MaxLights) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
return;
}
ctx->Light.Model.TwoSide = newbool;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
- if (params[0] == (GLfloat) GL_SINGLE_COLOR)
+ if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
- else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
+ else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
newenum = GL_SEPARATE_SPECULAR_COLOR;
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" );
if ((ctx->Light.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|| ctx->Fog.ColorSumEnabled)
- ctx->_TriangleCaps |= DD_SEPERATE_SPECULAR;
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
else
- ctx->_TriangleCaps &= ~DD_SEPERATE_SPECULAR;
+ ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
break;
default:
*
* src[0] is front material, src[1] is back material
*
- * Additionally keeps the precomputed lighting state uptodate.
+ * Additionally keeps the precomputed lighting state uptodate.
*/
void _mesa_update_material( GLcontext *ctx,
const struct gl_material src[2],
if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) {
struct gl_material *mat = &ctx->Light.Material[0];
COPY_3V( ctx->Light._BaseColor[0], mat->Emission );
- ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient,
+ ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient,
ctx->Light.Model.Ambient );
}
if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) {
struct gl_material *mat = &ctx->Light.Material[1];
COPY_3V( ctx->Light._BaseColor[1], mat->Emission );
- ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient,
+ ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient,
ctx->Light.Model.Ambient );
}
l->_SpotExpTable[i][0] = tmp;
}
for (i = 0; i < EXP_TABLE_SIZE - 1; i++) {
- l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] -
+ l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] -
l->_SpotExpTable[i][0]);
}
l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
void
_mesa_invalidate_shine_table( GLcontext *ctx, GLuint i )
{
- if (ctx->_ShineTable[i])
+ if (ctx->_ShineTable[i])
ctx->_ShineTable[i]->refcount--;
ctx->_ShineTable[i] = 0;
}
s->shininess = shininess;
}
- if (ctx->_ShineTable[i])
+ if (ctx->_ShineTable[i])
ctx->_ShineTable[i]->refcount--;
ctx->_ShineTable[i] = s;
s->refcount++;
}
-void
+void
_mesa_validate_all_lighting_tables( GLcontext *ctx )
{
GLint i;
if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess)
validate_shine_table( ctx, 1, shininess );
- for (i = 0 ; i < MAX_LIGHTS ; i++)
+ for (i = 0 ; i < MAX_LIGHTS ; i++)
if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1)
validate_spot_exp_table( &ctx->Light.Light[i] );
}
/* Precompute some shading values. Although we reference
* Light.Material here, we can get away without flushing
* FLUSH_UPDATE_CURRENT, as when any outstanding material changes
- * are flushed, they will update the derived state at that time.
+ * are flushed, they will update the derived state at that time.
*/
if (ctx->Visual.rgbMode) {
GLuint sides = ctx->Light.Model.TwoSide ? 2 : 1;
ctx->Light.Material[side].Diffuse[3] );
}
- foreach (light, &ctx->Light.EnabledList) {
+ foreach (light, &ctx->Light.EnabledList) {
for (side=0; side< sides; side++) {
const struct gl_material *mat = &ctx->Light.Material[side];
SCALE_3V( light->_MatDiffuse[side], light->Diffuse, mat->Diffuse );
}
}
}
-
-