diff options
author | Jesse Buhagiar <jooster669@gmail.com> | 2022-01-09 00:40:39 +1100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-12 13:36:56 +0100 |
commit | 775ef000e0c059db8f11191ec912a4423033031f (patch) | |
tree | 73fc2430a6a3d967ad4ad7e81b7eea85efdbb7a1 /Userland/Libraries/LibGL | |
parent | 92373ab0b638c693ee9484b9bef3bacf65693988 (diff) | |
download | serenity-775ef000e0c059db8f11191ec912a4423033031f.zip |
LibGL+LibSoftGPU: Move lighting model parameters to SoftGPU
Most of the T&L stuff is, like on an actual GPU, now done inside of
LibSoftGPU. As such, it no longer makes sense to have specific values
like the scene ambient color inside of LibGL as part of the GL context.
These have now been moved into LibSoftGPU and use the same pattern as
the render options to set/get.
Diffstat (limited to 'Userland/Libraries/LibGL')
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGL/SoftwareGLContext.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp index 322196c95c..773e7bf8a9 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp +++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp @@ -2684,17 +2684,25 @@ void SoftwareGLContext::gl_light_model(GLenum pname, GLfloat x, GLfloat y, GLflo || pname == GL_LIGHT_MODEL_TWO_SIDE), GL_INVALID_ENUM); + auto lighting_params = m_rasterizer.light_model(); + bool update_lighting_model = false; + switch (pname) { case GL_LIGHT_MODEL_AMBIENT: - m_light_model_ambient = { x, y, z, w }; + lighting_params.scene_ambient_color = { x, y, z, w }; + update_lighting_model = true; break; case GL_LIGHT_MODEL_TWO_SIDE: VERIFY(y == 0.0f && z == 0.0f && w == 0.0f); - m_light_model_two_side = x; + lighting_params.two_sided_lighting = x; + update_lighting_model = true; break; default: VERIFY_NOT_REACHED(); } + + if (update_lighting_model) + m_rasterizer.set_light_model_params(lighting_params); } void SoftwareGLContext::gl_bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap) diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.h b/Userland/Libraries/LibGL/SoftwareGLContext.h index 81b77fefd0..b8d9900a4e 100644 --- a/Userland/Libraries/LibGL/SoftwareGLContext.h +++ b/Userland/Libraries/LibGL/SoftwareGLContext.h @@ -430,8 +430,6 @@ private: // Lighting configuration bool m_lighting_enabled { false }; - FloatVector4 m_light_model_ambient { 0.2f, 0.2f, 0.2f, 1.0f }; - GLfloat m_light_model_two_side { 0.0f }; Vector<SoftGPU::Light> m_light_states; Array<SoftGPU::Material, 2u> m_material_states; |