summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSoftGPU/Clipper.cpp
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-03-27 15:43:51 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-06 11:32:24 +0200
commit5d2740217fbc0f62f46480f85c142a340580f679 (patch)
tree564b274a5fd7ce246e51d4cb0e0efe8c648f3665 /Userland/Libraries/LibSoftGPU/Clipper.cpp
parent5bf224708ff7ef0166153ef0f94ec15f4e95f232 (diff)
downloadserenity-5d2740217fbc0f62f46480f85c142a340580f679.zip
LibGL+LibGPU+LibSoftGPU: Move Vertex.h to LibGPU
Diffstat (limited to 'Userland/Libraries/LibSoftGPU/Clipper.cpp')
-rw-r--r--Userland/Libraries/LibSoftGPU/Clipper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Clipper.cpp b/Userland/Libraries/LibSoftGPU/Clipper.cpp
index 51e021f37e..b4739d834b 100644
--- a/Userland/Libraries/LibSoftGPU/Clipper.cpp
+++ b/Userland/Libraries/LibSoftGPU/Clipper.cpp
@@ -7,9 +7,9 @@
*/
#include <AK/Vector.h>
+#include <LibGPU/Vertex.h>
#include <LibGfx/Vector4.h>
#include <LibSoftGPU/Clipper.h>
-#include <LibSoftGPU/Vertex.h>
namespace SoftGPU {
@@ -33,7 +33,7 @@ static constexpr bool point_within_clip_plane(FloatVector4 const& vertex)
}
template<Clipper::ClipPlane plane>
-static constexpr Vertex clip_intersection_point(Vertex const& p1, Vertex const& p2)
+static constexpr GPU::Vertex clip_intersection_point(GPU::Vertex const& p1, GPU::Vertex const& p2)
{
constexpr FloatVector4 clip_plane_normals[] = {
{ 1, 0, 0, 0 }, // Left Plane
@@ -54,19 +54,19 @@ static constexpr Vertex clip_intersection_point(Vertex const& p1, Vertex const&
float const x2 = clip_plane_normal.dot(p2.clip_coordinates);
float const a = (w1 + x1) / ((w1 + x1) - (w2 + x2));
- Vertex out;
+ GPU::Vertex out;
out.position = mix(p1.position, p2.position, a);
out.eye_coordinates = mix(p1.eye_coordinates, p2.eye_coordinates, a);
out.clip_coordinates = mix(p1.clip_coordinates, p2.clip_coordinates, a);
out.color = mix(p1.color, p2.color, a);
- for (size_t i = 0; i < NUM_SAMPLERS; ++i)
+ for (size_t i = 0; i < GPU::NUM_SAMPLERS; ++i)
out.tex_coords[i] = mix(p1.tex_coords[i], p2.tex_coords[i], a);
out.normal = mix(p1.normal, p2.normal, a);
return out;
}
template<Clipper::ClipPlane plane>
-FLATTEN static constexpr void clip_plane(Vector<Vertex>& read_list, Vector<Vertex>& write_list)
+FLATTEN static constexpr void clip_plane(Vector<GPU::Vertex>& read_list, Vector<GPU::Vertex>& write_list)
{
auto read_from = &read_list;
auto write_to = &write_list;
@@ -89,7 +89,7 @@ FLATTEN static constexpr void clip_plane(Vector<Vertex>& read_list, Vector<Verte
swap(write_list, read_list);
}
-void Clipper::clip_triangle_against_frustum(Vector<Vertex>& input_verts)
+void Clipper::clip_triangle_against_frustum(Vector<GPU::Vertex>& input_verts)
{
list_a = input_verts;
list_b.clear_with_capacity();