74 for (
const auto& p:
planes) {
75 if (Vector3::computeDotProduct(p.getNormal(), vertex) + p.getDistance() < 0.0f) {
90 for (
const auto& p:
planes) {
91 if (Vector3::computeDotProduct(p.getNormal(), center) + p.getDistance() < -radius) {
104 auto minX = b->
getMin()[0];
105 auto minY = b->
getMin()[1];
106 auto minZ = b->
getMin()[2];
107 auto maxX = b->
getMax()[0];
108 auto maxY = b->
getMax()[1];
109 auto maxZ = b->
getMax()[2];
111 for (
const auto& p :
planes) {
112 const auto& normal = p.getNormal();
113 auto distance = p.getDistance();
114 if (Vector3::computeDotProduct(normal, point.
set(minX, minY, minZ)) + distance > 0.0f)
continue;
115 if (Vector3::computeDotProduct(normal, point.
set(maxX, minY, minZ)) + distance > 0.0f)
continue;
116 if (Vector3::computeDotProduct(normal, point.
set(minX, maxY, minZ)) + distance > 0.0f)
continue;
117 if (Vector3::computeDotProduct(normal, point.
set(maxX, maxY, minZ)) + distance > 0.0f)
continue;
118 if (Vector3::computeDotProduct(normal, point.
set(minX, minY, maxZ)) + distance > 0.0f)
continue;
119 if (Vector3::computeDotProduct(normal, point.
set(maxX, minY, maxZ)) + distance > 0.0f)
continue;
120 if (Vector3::computeDotProduct(normal, point.
set(minX, maxY, maxZ)) + distance > 0.0f)
continue;
121 if (Vector3::computeDotProduct(normal, point.
set(maxX, maxY, maxZ)) + distance > 0.0f)
continue;
static constexpr int PLANE_RIGHT
static constexpr int PLANE_NEAR
static constexpr int PLANE_LEFT
static constexpr int PLANE_FAR
static constexpr int PLANE_BOTTOM
bool isVisible(BoundingBox *b)
Checks if bounding box is in frustum.
Matrix4x4 modelViewMatrixTransposed
bool isVisible(const Vector3 &vertex)
Checks if given vertex is in frustum.
static constexpr int PLANE_TOP
const array< Plane, 6 > & getPlanes()
bool isVisible(Sphere *s)
Checks if sphere is in frustum.
void update()
Setups frustum, should be called if frustum did change.
Matrix4x4 projectionMatrixTransposed
Frustum(Renderer *renderer)
Public constructor.
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
const Vector3 & getCenter() const
Plane entity, this is not directly connectable with physics engine.
Sphere physics primitive.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
#define FORBID_CLASS_COPY(CLASS)