Files
BlitzNext/Runtime/blitz3d/frustum.hpp
T

39 lines
679 B
C++
Raw Normal View History

2019-01-18 21:26:42 +01:00
#pragma once
2019-01-18 15:55:06 +01:00
#include "geom.hpp"
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
class Frustum {
public:
enum {
VERT_TLNEAR = 0,
VERT_TRNEAR,
VERT_BRNEAR,
VERT_BLNEAR,
VERT_TLFAR,
VERT_TRFAR,
VERT_BRFAR,
VERT_BLFAR,
VERT_EYE
2014-01-31 08:23:00 +13:00
};
2019-01-18 17:04:17 +01:00
enum { PLANE_TOP = 0, PLANE_LEFT, PLANE_BOTTOM, PLANE_RIGHT, PLANE_NEAR, PLANE_FAR };
2014-01-31 08:23:00 +13:00
Frustum();
2019-01-18 17:04:17 +01:00
Frustum(float nr, float fr, float w, float h);
Frustum(const Frustum& f, const Transform& t);
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
bool cull(const Box& box) const;
bool cull(const Vector vecs[], int cnt) const;
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
const Plane& getPlane(int n) const
{
return planes[n];
}
const Vector& getVertex(int n) const
{
return verts[n];
}
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
private:
Plane planes[6];
2014-01-31 08:23:00 +13:00
Vector verts[9];
2019-01-18 17:04:17 +01:00
void makePlanes();
2014-01-31 08:23:00 +13:00
};