Bladeren bron

LibSoftGPU: Remove OpenGL type for front face selection

Replaces the GLenum used for selecting the frontface in the rasterizer
config with out own enum.
Stephan Unverwerth 3 jaren geleden
bovenliggende
commit
24c76741e8

+ 1 - 1
Userland/Libraries/LibGL/SoftwareGLContext.cpp

@@ -904,7 +904,7 @@ void SoftwareGLContext::gl_front_face(GLenum face)
     m_front_face = face;
 
     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);
 }
 

+ 1 - 1
Userland/Libraries/LibSoftGPU/Device.cpp

@@ -634,7 +634,7 @@ void Device::draw_primitives(GLenum primitive_type, FloatMatrix4x4 const& transf
             continue;
 
         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))
                 continue;

+ 6 - 1
Userland/Libraries/LibSoftGPU/Device.h

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