summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSoftGPU/Clipper.h
blob: 108626462ce19bdd397d15a7d27693d240a849da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Vector.h>
#include <LibGPU/Vertex.h>
#include <LibGfx/Vector4.h>

namespace SoftGPU {

class Clipper final {
public:
    enum class ClipPlane : u8 {
        LEFT = 0,
        RIGHT,
        TOP,
        BOTTOM,
        NEAR,
        FAR
    };

    Clipper() = default;

    void clip_triangle_against_frustum(Vector<GPU::Vertex>& input_vecs);

private:
    Vector<GPU::Vertex> list_a;
    Vector<GPU::Vertex> list_b;
};

}