diff --git a/gl-light.c b/gl-light.c index b37ba98..30e565f 100644 --- a/gl-light.c +++ b/gl-light.c @@ -107,33 +107,16 @@ void glNormal3fv(const GLfloat *xyz) { GL_VERTEX_NORMAL[2] = xyz[2]; } -/* Global Ambient Light Parameters */ -void glKosLightAmbient4fv(const float *rgba) { - GL_GLOBAL_AMBIENT[0] = rgba[0]; - GL_GLOBAL_AMBIENT[1] = rgba[1]; - GL_GLOBAL_AMBIENT[2] = rgba[2]; - GL_GLOBAL_AMBIENT[3] = rgba[3]; -} +void glLightModelfv(GLenum pname, const GLfloat *params) { + if(pname != GL_LIGHT_MODEL_AMBIENT) { + _glKosThrowError(GL_INVALID_ENUM, "glLightModelfv"); + return; + } -void glKosLightAmbient4f(float r, float g, float b, float a) { - GL_GLOBAL_AMBIENT[0] = r; - GL_GLOBAL_AMBIENT[1] = g; - GL_GLOBAL_AMBIENT[2] = b; - GL_GLOBAL_AMBIENT[3] = a; -} - -void glKosLightAmbient3fv(const float *rgb) { - GL_GLOBAL_AMBIENT[0] = rgb[0]; - GL_GLOBAL_AMBIENT[1] = rgb[1]; - GL_GLOBAL_AMBIENT[2] = rgb[2]; - GL_GLOBAL_AMBIENT[3] = 1.0f; -} - -void glKosLightAmbient3f(float r, float g, float b) { - GL_GLOBAL_AMBIENT[0] = r; - GL_GLOBAL_AMBIENT[1] = g; - GL_GLOBAL_AMBIENT[2] = b; - GL_GLOBAL_AMBIENT[3] = 1.0f; + GL_GLOBAL_AMBIENT[0] = params[0]; + GL_GLOBAL_AMBIENT[1] = params[1]; + GL_GLOBAL_AMBIENT[2] = params[2]; + GL_GLOBAL_AMBIENT[3] = params[3]; } /* Misc Lighting Functions ************************************/ diff --git a/include/gl.h b/include/gl.h index aab3bdb..e3e45f3 100644 --- a/include/gl.h +++ b/include/gl.h @@ -629,15 +629,10 @@ GLAPI void APIENTRY glFogfv(GLenum pname, const GLfloat *params); /* Lighting Functions - client must enable GL_LIGHTING for this to take effect */ -/* Set Global Ambient Light Color */ -GLAPI void APIENTRY glKosLightAmbient3f(GLfloat r, GLfloat g, GLfloat b); -GLAPI void APIENTRY glKosLightAmbient4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); -GLAPI void APIENTRY glKosLightAmbient3fv(const GLfloat *rgb); -GLAPI void APIENTRY glKosLightAmbient4fv(const GLfloat *rgba); - /* Set Individual Light Parameters */ GLAPI void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params); GLAPI void APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params); /* Set Global Material Parameters */ GLAPI void APIENTRY glMateriali(GLenum face, GLenum pname, const GLint param);