summaryrefslogtreecommitdiffstats
path: root/src/Frustum.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Frustum.hpp')
-rw-r--r--src/Frustum.hpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/Frustum.hpp b/src/Frustum.hpp
index 4817cd4..15ea7e0 100644
--- a/src/Frustum.hpp
+++ b/src/Frustum.hpp
@@ -1,35 +1,30 @@
#pragma once
#include <glm/glm.hpp>
-#include "Vector.hpp"
class Frustum {
enum FrustumSide {
- RIGHT = 0,
+ RIGHT,
LEFT,
BOTTOM,
TOP,
- BACK,
- FRONT,
- };
- enum PlaneData {
- A = 0,
- B,
- C,
- D,
+ FAR,
+ NEAR,
+ SIDE_COUNT,
};
- glm::mat4 vp;
- float frustum[6][4];
- void NormalizePlane(FrustumSide side);
+ glm::vec4 planes[SIDE_COUNT];
+
+public:
+ Frustum(const glm::mat4 &vpMat);
-public:
- Frustum() = default;
+ ~Frustum() = default;
- ~Frustum() = default;
+ inline static float GetDistanceToPoint(const glm::vec4 &plane, const glm::vec3 &pos) {
+ return plane.x * pos.x + plane.y * pos.y + plane.z * pos.z + plane.w;
+ }
- void UpdateFrustum(const glm::mat4& vpmat);
+ bool TestPoint(const glm::vec3 &pos);
- //Return true, if tested point is visible
- bool TestPoint(VectorF point);
+ bool TestSphere(const glm::vec3 &pos, float radius);
}; \ No newline at end of file