// returns true iif all corners of bounding-box defined // by <mins, maxs> lie on the "positive" side of each of // the frustum's half-spaces (?) // // if using quad-tree visibility tests, we can not say // "if no corner in view, then entire quad invisible" // (area in between corners might be within frustum) // proper way would be: // all points left of left-plane ==> invisible // all points right of right-plane ==> invisible // all points above top-plane ==> invisible // all points below bottom-plane ==> invisible // all points before near-plane ==> invisible // all points behind far-plane ==> invisible bool Camera::InView(const vec3f& mins, const vec3f& maxs) const { return AABBInOriginPlane(frustumR, mins, maxs) && AABBInOriginPlane(frustumL, mins, maxs) && AABBInOriginPlane(frustumB, mins, maxs) && AABBInOriginPlane(frustumT, mins, maxs); }
bool CCamera::InView(const float3& mins, const float3& maxs) const { // Axis-aligned bounding box test (AABB) if (!AABBInOriginPlane(rgtFrustumSideDir, pos, mins, maxs)) return false; if (!AABBInOriginPlane(lftFrustumSideDir, pos, mins, maxs)) return false; if (!AABBInOriginPlane(botFrustumSideDir, pos, mins, maxs)) return false; if (!AABBInOriginPlane(topFrustumSideDir, pos, mins, maxs)) return false; return true; }
bool CCamera::InView(const float3& mins, const float3& maxs) { // Axis-aligned bounding box test (AABB) if (AABBInOriginPlane(rightside, pos, mins, maxs) && AABBInOriginPlane(leftside, pos, mins, maxs) && AABBInOriginPlane(bottom, pos, mins, maxs) && AABBInOriginPlane(top, pos, mins, maxs)) { return true; } return false; }