summaryrefslogtreecommitdiffstats
path: root/src/Frustum.hpp
blob: 4817cd4fb7d9957f65a8690a76cfdf6f40c8b3ac (plain) (blame)
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
#pragma once

#include <glm/glm.hpp>
#include "Vector.hpp"

class Frustum {
    enum FrustumSide {
        RIGHT = 0,
        LEFT,
        BOTTOM,
        TOP,
        BACK,
        FRONT,
    };
    enum PlaneData {
        A = 0,
        B,
        C,
        D,
    };

    glm::mat4 vp;
    float frustum[6][4];
    void NormalizePlane(FrustumSide side);

public:
    Frustum() = default;

    ~Frustum() = default;

    void UpdateFrustum(const glm::mat4& vpmat);

    //Return true, if tested point is visible
    bool TestPoint(VectorF point);
};