Commit 882caa18 authored by Ian Romanick's avatar Ian Romanick
Browse files

Added support for NV_light_max_exponent.

parent b2a4aecd
/* $Id: api_noop.c,v 1.12 2003/03/01 01:50:20 brianp Exp $ */
/* $Id: api_noop.c,v 1.13 2003/05/30 21:37:14 idr Exp $ */
/*
* Mesa 3-D graphics library
......@@ -130,11 +130,11 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
COPY_4FV( mat[1].Emission, params );
}
if (bitmask & FRONT_SHININESS_BIT) {
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
mat[0].Shininess = shininess;
}
if (bitmask & BACK_SHININESS_BIT) {
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
mat[1].Shininess = shininess;
}
if (bitmask & FRONT_INDEXES_BIT) {
......
......@@ -988,6 +988,8 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES;
ctx->Const.MaxLights = MAX_LIGHTS;
ctx->Const.MaxSpotExponent = 128.0;
ctx->Const.MaxShininess = 128.0;
#if FEATURE_ARB_vertex_program
ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS;
ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
......
......@@ -116,6 +116,7 @@ static struct {
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
{ ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) },
{ OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
{ OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
......@@ -197,6 +198,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_MESA_resize_buffers",
"GL_MESA_ycbcr_texture",
"GL_NV_blend_square",
"GL_NV_light_max_exponent",
"GL_NV_point_sprite",
"GL_NV_texture_rectangle",
"GL_NV_texgen_reflection",
......
......@@ -1518,6 +1518,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
/* GL_NV_light_max_exponent */
case GL_MAX_SHININESS_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = FLOAT_TO_BOOL(ctx->Const.MaxShininess);
break;
case GL_MAX_SPOT_EXPONENT_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = FLOAT_TO_BOOL(ctx->Const.MaxSpotExponent);
break;
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
......@@ -3016,6 +3026,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
/* GL_NV_light_max_exponent */
case GL_MAX_SHININESS_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = (GLdouble) ctx->Const.MaxShininess;
break;
case GL_MAX_SPOT_EXPONENT_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = (GLdouble) ctx->Const.MaxSpotExponent;
break;
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
......@@ -4490,6 +4510,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
/* GL_NV_light_max_exponent */
case GL_MAX_SHININESS_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = ctx->Const.MaxShininess;
break;
case GL_MAX_SPOT_EXPONENT_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = ctx->Const.MaxSpotExponent;
break;
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
......@@ -6002,6 +6032,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
/* GL_NV_light_max_exponent */
case GL_MAX_SHININESS_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = (GLint) ctx->Const.MaxShininess;
break;
case GL_MAX_SPOT_EXPONENT_NV:
CHECK_EXTENSION_B(NV_light_max_exponent, pname);
*params = (GLint) ctx->Const.MaxSpotExponent;
break;
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
......
/* $Id: light.c,v 1.55 2003/03/01 01:50:21 brianp Exp $ */
/* $Id: light.c,v 1.56 2003/05/30 21:37:19 idr Exp $ */
/*
* Mesa 3-D graphics library
......@@ -136,7 +136,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
break;
}
case GL_SPOT_EXPONENT:
if (params[0]<0.0 || params[0]>128.0) {
if (params[0]<0.0 || params[0]>ctx->Const.MaxSpotExponent) {
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" );
return;
}
......
......@@ -1409,6 +1409,8 @@ struct gl_constants {
GLuint MaxConvolutionHeight;
GLuint MaxClipPlanes;
GLuint MaxLights;
GLfloat MaxShininess; /* GL_NV_light_max_exponent */
GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */
/* GL_ARB_vertex_program */
GLuint MaxVertexProgramInstructions;
GLuint MaxVertexProgramAttribs;
......@@ -1500,6 +1502,7 @@ struct gl_extensions {
GLboolean MESA_ycbcr_texture;
GLboolean NV_blend_square;
GLboolean NV_fragment_program;
GLboolean NV_light_max_exponent;
GLboolean NV_point_sprite;
GLboolean NV_texture_rectangle;
GLboolean NV_texgen_reflection;
......
......@@ -1319,11 +1319,11 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
COPY_4FV( mat[1].Emission, params );
}
if (bitmask & FRONT_SHININESS_BIT) {
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
mat[0].Shininess = shininess;
}
if (bitmask & BACK_SHININESS_BIT) {
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
GLfloat shininess = CLAMP( params[0], 0.0F, ctx->Const.MaxShininess );
mat[1].Shininess = shininess;
}
if (bitmask & FRONT_INDEXES_BIT) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment