summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-03-27 15:32:40 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-06 11:32:24 +0200
commit5bf224708ff7ef0166153ef0f94ec15f4e95f232 (patch)
tree33d0c9d0a4b32cc0ef89ab7069a3bdef81acfa0f /Userland
parent5a5596b381c8ecf257aa0b41bab21d26c6d86986 (diff)
downloadserenity-5bf224708ff7ef0166153ef0f94ec15f4e95f232.zip
LibGPU+LibSoftGPU: Move LightModelParameters into LibGPU
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGPU/LightModelParameters.h21
-rw-r--r--Userland/Libraries/LibSoftGPU/Device.cpp2
-rw-r--r--Userland/Libraries/LibSoftGPU/Device.h14
3 files changed, 26 insertions, 11 deletions
diff --git a/Userland/Libraries/LibGPU/LightModelParameters.h b/Userland/Libraries/LibGPU/LightModelParameters.h
new file mode 100644
index 0000000000..344b9a2af1
--- /dev/null
+++ b/Userland/Libraries/LibGPU/LightModelParameters.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibGPU/Enums.h>
+#include <LibGfx/Vector4.h>
+
+namespace GPU {
+
+struct LightModelParameters {
+ FloatVector4 scene_ambient_color { 0.2f, 0.2f, 0.2f, 1.0f };
+ bool viewer_at_infinity { false };
+ GPU::ColorControl color_control { GPU::ColorControl::SingleColor };
+ bool two_sided_lighting { false };
+};
+
+}
diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp
index e6a9b23d63..ebfdaa3210 100644
--- a/Userland/Libraries/LibSoftGPU/Device.cpp
+++ b/Userland/Libraries/LibSoftGPU/Device.cpp
@@ -1198,7 +1198,7 @@ void Device::set_options(RasterizerOptions const& options)
setup_blend_factors();
}
-void Device::set_light_model_params(LightModelParameters const& lighting_model)
+void Device::set_light_model_params(GPU::LightModelParameters const& lighting_model)
{
m_lighting_model = lighting_model;
}
diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h
index 310c89abd2..356d3bb4b2 100644
--- a/Userland/Libraries/LibSoftGPU/Device.h
+++ b/Userland/Libraries/LibSoftGPU/Device.h
@@ -15,6 +15,7 @@
#include <LibGPU/Enums.h>
#include <LibGPU/ImageFormat.h>
#include <LibGPU/Light.h>
+#include <LibGPU/LightModelParameters.h>
#include <LibGPU/Material.h>
#include <LibGPU/RasterPosition.h>
#include <LibGPU/SamplerConfig.h>
@@ -79,13 +80,6 @@ struct RasterizerOptions {
GPU::ColorMaterialMode color_material_mode { GPU::ColorMaterialMode::AmbientAndDiffuse };
};
-struct LightModelParameters {
- FloatVector4 scene_ambient_color { 0.2f, 0.2f, 0.2f, 1.0f };
- bool viewer_at_infinity { false };
- GPU::ColorControl color_control { GPU::ColorControl::SingleColor };
- bool two_sided_lighting { false };
-};
-
struct PixelQuad;
class Device final {
@@ -103,9 +97,9 @@ public:
void blit_to_color_buffer_at_raster_position(Gfx::Bitmap const&);
void blit_to_depth_buffer_at_raster_position(Vector<GPU::DepthType> const&, int, int);
void set_options(RasterizerOptions const&);
- void set_light_model_params(LightModelParameters const&);
+ void set_light_model_params(GPU::LightModelParameters const&);
RasterizerOptions options() const { return m_options; }
- LightModelParameters light_model() const { return m_lighting_model; }
+ GPU::LightModelParameters light_model() const { return m_lighting_model; }
GPU::ColorType get_color_buffer_pixel(int x, int y);
GPU::DepthType get_depthbuffer_value(int x, int y);
@@ -131,7 +125,7 @@ private:
RefPtr<FrameBuffer<GPU::ColorType, GPU::DepthType, GPU::StencilType>> m_frame_buffer {};
RasterizerOptions m_options;
- LightModelParameters m_lighting_model;
+ GPU::LightModelParameters m_lighting_model;
Clipper m_clipper;
Vector<Triangle> m_triangle_list;
Vector<Triangle> m_processed_triangles;