1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

LibSoftGPU: Remove OpenGL type for front face selection

Replaces the GLenum used for selecting the frontface in the rasterizer
config with out own enum.
This commit is contained in:
Stephan Unverwerth 2021-12-22 23:16:58 +01:00 committed by Brian Gianforcaro
parent c720cd00db
commit 24c76741e8
3 changed files with 8 additions and 3 deletions

View file

@ -904,7 +904,7 @@ void SoftwareGLContext::gl_front_face(GLenum face)
m_front_face = face; m_front_face = face;
auto rasterizer_options = m_rasterizer.options(); auto rasterizer_options = m_rasterizer.options();
rasterizer_options.front_face = face; rasterizer_options.front_face = (face == GL_CW) ? SoftGPU::WindingOrder::Clockwise : SoftGPU::WindingOrder::CounterClockwise;
m_rasterizer.set_options(rasterizer_options); m_rasterizer.set_options(rasterizer_options);
} }

View file

@ -634,7 +634,7 @@ void Device::draw_primitives(GLenum primitive_type, FloatMatrix4x4 const& transf
continue; continue;
if (m_options.enable_culling) { if (m_options.enable_culling) {
bool is_front = (m_options.front_face == GL_CCW ? area < 0 : area > 0); bool is_front = (m_options.front_face == WindingOrder::CounterClockwise ? area < 0 : area > 0);
if (is_front && (m_options.culled_sides == GL_FRONT || m_options.culled_sides == GL_FRONT_AND_BACK)) if (is_front && (m_options.culled_sides == GL_FRONT || m_options.culled_sides == GL_FRONT_AND_BACK))
continue; continue;

View file

@ -51,6 +51,11 @@ enum class BlendFactor {
SrcAlphaSaturate, SrcAlphaSaturate,
}; };
enum class WindingOrder {
Clockwise,
CounterClockwise,
};
struct RasterizerOptions { struct RasterizerOptions {
bool shade_smooth { true }; bool shade_smooth { true };
bool enable_depth_test { false }; bool enable_depth_test { false };
@ -78,7 +83,7 @@ struct RasterizerOptions {
float depth_offset_factor { 0 }; float depth_offset_factor { 0 };
float depth_offset_constant { 0 }; float depth_offset_constant { 0 };
bool enable_culling { false }; bool enable_culling { false };
GLenum front_face { GL_CCW }; WindingOrder front_face { WindingOrder::CounterClockwise };
GLenum culled_sides { GL_BACK }; GLenum culled_sides { GL_BACK };
}; };