1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibGL: Implement glFogfv

This currently just sets the fog colour in the rasterizer.
This commit is contained in:
Jesse Buhagiar 2021-08-25 01:10:19 +10:00 committed by Ali Mohammad Pur
parent ffa7da0ca5
commit 7f1cd54b80
7 changed files with 45 additions and 0 deletions

View file

@ -1745,6 +1745,26 @@ void SoftwareGLContext::gl_polygon_mode(GLenum face, GLenum mode)
m_rasterizer.set_options(options);
}
void SoftwareGLContext::gl_fogfv(GLenum pname, GLfloat* params)
{
RETURN_WITH_ERROR_IF(m_in_draw_state, GL_INVALID_OPERATION);
auto options = m_rasterizer.options();
switch (pname) {
case GL_FOG_COLOR:
// Set rasterizer options fog color
// NOTE: We purposefully don't check for `nullptr` here (as with other calls). The spec states nothing
// about us checking for such things. If the programmer does so and hits SIGSEGV, that's on them.
options.fog_color = FloatVector4 { params[0], params[1], params[2], params[3] };
break;
default:
RETURN_WITH_ERROR_IF(true, GL_INVALID_ENUM);
}
m_rasterizer.set_options(options);
}
void SoftwareGLContext::present()
{
m_rasterizer.blit_to(*m_frontbuffer);