|
@@ -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))) {
|