mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibGL+LibGPU+LibSoftGPU: Implement matrix stack per texture unit
Each texture unit now has its own texture transformation matrix stack. Introduce a new texture unit configuration that is synced when changed. Because we're no longer passing a silly `Vector` when drawing each primitive, this results in a slightly improved frames per second :^)
This commit is contained in:
parent
1540c56e6c
commit
00d46e5d77
22 changed files with 208 additions and 152 deletions
|
@ -249,7 +249,7 @@ void GLContext::gl_lightfv(GLenum light, GLenum pname, GLfloat const* params)
|
|||
break;
|
||||
case GL_POSITION:
|
||||
light_state.position = { params[0], params[1], params[2], params[3] };
|
||||
light_state.position = m_model_view_matrix * light_state.position;
|
||||
light_state.position = model_view_matrix() * light_state.position;
|
||||
break;
|
||||
case GL_CONSTANT_ATTENUATION:
|
||||
RETURN_WITH_ERROR_IF(params[0] < 0.f, GL_INVALID_VALUE);
|
||||
|
@ -277,7 +277,7 @@ void GLContext::gl_lightfv(GLenum light, GLenum pname, GLfloat const* params)
|
|||
}
|
||||
case GL_SPOT_DIRECTION: {
|
||||
FloatVector4 direction_vector = { params[0], params[1], params[2], 0.f };
|
||||
direction_vector = m_model_view_matrix * direction_vector;
|
||||
direction_vector = model_view_matrix() * direction_vector;
|
||||
light_state.spotlight_direction = direction_vector.xyz();
|
||||
break;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void GLContext::gl_lightiv(GLenum light, GLenum pname, GLint const* params)
|
|||
break;
|
||||
case GL_POSITION:
|
||||
light_state.position = to_float_vector(params[0], params[1], params[2], params[3]);
|
||||
light_state.position = m_model_view_matrix * light_state.position;
|
||||
light_state.position = model_view_matrix() * light_state.position;
|
||||
break;
|
||||
case GL_CONSTANT_ATTENUATION:
|
||||
RETURN_WITH_ERROR_IF(params[0] < 0, GL_INVALID_VALUE);
|
||||
|
@ -341,7 +341,7 @@ void GLContext::gl_lightiv(GLenum light, GLenum pname, GLint const* params)
|
|||
}
|
||||
case GL_SPOT_DIRECTION: {
|
||||
auto direction_vector = to_float_vector(params[0], params[1], params[2], 0.0f);
|
||||
direction_vector = m_model_view_matrix * direction_vector;
|
||||
direction_vector = model_view_matrix() * direction_vector;
|
||||
light_state.spotlight_direction = direction_vector.xyz();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue