#include "enums.h"
#include "light.h"
#include "macros.h"
-#include "util/simple_list.h"
#include "mtypes.h"
#include "math/m_matrix.h"
#include "util/bitscan.h"
void
_mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] )
{
- const GLbitfield bitmask = ctx->Light._ColorMaterialBitmask;
+ GLbitfield bitmask = ctx->Light._ColorMaterialBitmask;
struct gl_material *mat = &ctx->Light.Material;
- int i;
- for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
- if (bitmask & (1<<i))
- COPY_4FV( mat->Attrib[i], color );
+ while (bitmask) {
+ const int i = u_bit_scan(&bitmask);
+
+ COPY_4FV( mat->Attrib[i], color );
+ }
_mesa_update_material( ctx, bitmask );
}
static void
init_light( struct gl_light *l, GLuint n )
{
- make_empty_list( l );
-
ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 );
if (n==0) {
ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 );
for (i = 0; i < MAX_LIGHTS; i++) {
init_light( &ctx->Light.Light[i], i );
}
- make_empty_list( &ctx->Light.EnabledList );
init_lightmodel( &ctx->Light.Model );
init_material( &ctx->Light.Material );