Bläddra i källkod

LibSoftGPU: Switch to using east const in Clipper.[h,cpp]

Lenny Maiorani 3 år sedan
förälder
incheckning
0da3a2ddde

+ 4 - 4
Userland/Libraries/LibSoftGPU/Clipper.cpp

@@ -11,7 +11,7 @@
 
 namespace SoftGPU {
 
-bool Clipper::point_within_clip_plane(const FloatVector4& vertex, ClipPlane plane)
+bool Clipper::point_within_clip_plane(FloatVector4 const& vertex, ClipPlane plane)
 {
     switch (plane) {
     case ClipPlane::LEFT:
@@ -31,7 +31,7 @@ bool Clipper::point_within_clip_plane(const FloatVector4& vertex, ClipPlane plan
     return false;
 }
 
-Vertex Clipper::clip_intersection_point(const Vertex& p1, const Vertex& p2, ClipPlane plane_index)
+Vertex Clipper::clip_intersection_point(Vertex const& p1, Vertex const& p2, ClipPlane plane_index)
 {
     // See https://www.microsoft.com/en-us/research/wp-content/uploads/1978/01/p245-blinn.pdf
     // "Clipping Using Homogeneous Coordinates" Blinn/Newell, 1978
@@ -65,8 +65,8 @@ void Clipper::clip_triangle_against_frustum(Vector<Vertex>& input_verts)
         write_to->clear_with_capacity();
         // Save me, C++23
         for (size_t i = 0; i < read_from->size(); i++) {
-            const auto& curr_vec = read_from->at((i + 1) % read_from->size());
-            const auto& prev_vec = read_from->at(i);
+            auto const& curr_vec = read_from->at((i + 1) % read_from->size());
+            auto const& prev_vec = read_from->at(i);
 
             if (point_within_clip_plane(curr_vec.clip_coordinates, static_cast<ClipPlane>(plane))) {
                 if (!point_within_clip_plane(prev_vec.clip_coordinates, static_cast<ClipPlane>(plane))) {

+ 2 - 2
Userland/Libraries/LibSoftGPU/Clipper.h

@@ -49,8 +49,8 @@ public:
     void clip_triangle_against_frustum(Vector<Vertex>& input_vecs);
 
 private:
-    bool point_within_clip_plane(const FloatVector4& vertex, ClipPlane plane);
-    Vertex clip_intersection_point(const Vertex& vec, const Vertex& prev_vec, ClipPlane plane_index);
+    bool point_within_clip_plane(FloatVector4 const& vertex, ClipPlane plane);
+    Vertex clip_intersection_point(Vertex const& vec, Vertex const& prev_vec, ClipPlane plane_index);
     Vector<Vertex> list_a;
     Vector<Vertex> list_b;
 };