namechange ViewFrustum::location to ::intersection

This commit is contained in:
Andrew Meadows 2016-02-23 15:42:38 -08:00
parent acef6642c9
commit c3dfc13f88
6 changed files with 18 additions and 19 deletions

View file

@ -937,7 +937,7 @@ int Octree::encodeTreeBitstream(OctreeElementPointer element,
params.stats->traversed(element);
}
ViewFrustum::location parentLocationThisView = ViewFrustum::INTERSECT; // assume parent is in view, but not fully
ViewFrustum::intersection parentLocationThisView = ViewFrustum::INTERSECT; // assume parent is in view, but not fully
int childBytesWritten = encodeTreeBitstreamRecursion(element, packetData, bag, params,
currentEncodeLevel, parentLocationThisView);
@ -974,7 +974,7 @@ int Octree::encodeTreeBitstream(OctreeElementPointer element,
int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
OctreePacketData* packetData, OctreeElementBag& bag,
EncodeBitstreamParams& params, int& currentEncodeLevel,
const ViewFrustum::location& parentLocationThisView) const {
const ViewFrustum::intersection& parentLocationThisView) const {
const bool wantDebug = false;
@ -1013,7 +1013,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
}
}
ViewFrustum::location nodeLocationThisView = ViewFrustum::INSIDE; // assume we're inside
ViewFrustum::intersection nodeLocationThisView = ViewFrustum::INSIDE; // assume we're inside
// caller can pass NULL as viewFrustum if they want everything
if (params.viewFrustum) {
@ -1034,7 +1034,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
// if we are INSIDE, INTERSECT, or OUTSIDE
if (parentLocationThisView != ViewFrustum::INSIDE) {
assert(parentLocationThisView != ViewFrustum::OUTSIDE); // we shouldn't be here if our parent was OUTSIDE!
nodeLocationThisView = element->computeViewLocation(*params.viewFrustum);
nodeLocationThisView = element->computeViewIntersection(*params.viewFrustum);
}
// If we're at a element that is out of view, then we can return, because no nodes below us will be in view!
@ -1053,7 +1053,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
bool wasInView = false;
if (params.deltaViewFrustum && params.lastViewFrustum) {
ViewFrustum::location location = element->computeViewLocation(*params.lastViewFrustum);
ViewFrustum::intersection location = element->computeViewIntersection(*params.lastViewFrustum);
// If we're a leaf, then either intersect or inside is considered "formerly in view"
if (element->isLeaf()) {
@ -1237,7 +1237,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
bool childWasInView = false;
if (childElement && params.deltaViewFrustum && params.lastViewFrustum) {
ViewFrustum::location location = childElement->computeViewLocation(*params.lastViewFrustum);
ViewFrustum::intersection location = childElement->computeViewIntersection(*params.lastViewFrustum);
// If we're a leaf, then either intersect or inside is considered "formerly in view"
if (childElement->isLeaf()) {

View file

@ -367,7 +367,7 @@ protected:
int encodeTreeBitstreamRecursion(OctreeElementPointer element,
OctreePacketData* packetData, OctreeElementBag& bag,
EncodeBitstreamParams& params, int& currentEncodeLevel,
const ViewFrustum::location& parentLocationThisView) const;
const ViewFrustum::intersection& parentLocationThisView) const;
static bool countOctreeElementsOperation(OctreeElementPointer element, void* extraData);

View file

@ -458,7 +458,7 @@ float OctreeElement::getEnclosingRadius() const {
return getScale() * sqrtf(3.0f) / 2.0f;
}
ViewFrustum::location OctreeElement::computeViewLocation(const ViewFrustum& viewFrustum) const {
ViewFrustum::intersection OctreeElement::computeViewIntersection(const ViewFrustum& viewFrustum) const {
return viewFrustum.calculateCubeKeyholeIntersection(_cube);
}

View file

@ -134,8 +134,8 @@ public:
int getLevel() const { return numberOfThreeBitSectionsInCode(getOctalCode()) + 1; }
float getEnclosingRadius() const;
bool isInView(const ViewFrustum& viewFrustum) const { return computeViewLocation(viewFrustum) != ViewFrustum::OUTSIDE; }
ViewFrustum::location computeViewLocation(const ViewFrustum& viewFrustum) const;
bool isInView(const ViewFrustum& viewFrustum) const { return computeViewIntersection(viewFrustum) != ViewFrustum::OUTSIDE; }
ViewFrustum::intersection computeViewIntersection(const ViewFrustum& viewFrustum) const;
float distanceToCamera(const ViewFrustum& viewFrustum) const;
float furthestDistanceToCamera(const ViewFrustum& viewFrustum) const;

View file

@ -130,9 +130,9 @@ const char* ViewFrustum::debugPlaneName (int plane) const {
return "Unknown";
}
ViewFrustum::location ViewFrustum::calculateCubeFrustumIntersection(const AACube& cube) const {
ViewFrustum::intersection ViewFrustum::calculateCubeFrustumIntersection(const AACube& cube) const {
// only check against frustum
ViewFrustum::location result = INSIDE;
ViewFrustum::intersection result = INSIDE;
for(int i=0; i < 6; i++) {
const glm::vec3& normal = _planes[i].getNormal();
// check distance to farthest cube point
@ -151,9 +151,9 @@ ViewFrustum::location ViewFrustum::calculateCubeFrustumIntersection(const AACube
const float HALF_SQRT_THREE = 0.8660254f;
ViewFrustum::location ViewFrustum::calculateCubeKeyholeIntersection(const AACube& cube) const {
ViewFrustum::intersection ViewFrustum::calculateCubeKeyholeIntersection(const AACube& cube) const {
// check against centeral sphere
ViewFrustum::location sphereResult = INTERSECT;
ViewFrustum::intersection sphereResult = INTERSECT;
glm::vec3 cubeOffset = cube.calcCenter() - _position;
float distance = glm::length(cubeOffset);
if (distance > EPSILON) {
@ -171,7 +171,7 @@ ViewFrustum::location ViewFrustum::calculateCubeKeyholeIntersection(const AACube
}
// check against frustum
ViewFrustum::location frustumResult = calculateCubeFrustumIntersection(cube);
ViewFrustum::intersection frustumResult = calculateCubeFrustumIntersection(cube);
return (frustumResult == OUTSIDE) ? sphereResult : frustumResult;
}
@ -201,7 +201,6 @@ bool ViewFrustum::sphereIntersectsFrustum(const glm::vec3& center, float radius)
bool ViewFrustum::boxIntersectsFrustum(const AABox& box) const {
// only check against frustum
ViewFrustum::location result = INSIDE;
for(int i=0; i < 6; i++) {
const glm::vec3& normal = _planes[i].getNormal();
// check distance to farthest box point

View file

@ -92,11 +92,11 @@ public:
void calculate();
typedef enum { OUTSIDE = 0, INTERSECT, INSIDE } location;
typedef enum { OUTSIDE = 0, INTERSECT, INSIDE } intersection;
/// @return INSIDE, INTERSECT, or OUTSIDE depending on how cube intersects the keyhole shape
ViewFrustum::location calculateCubeFrustumIntersection(const AACube& cube) const;
ViewFrustum::location calculateCubeKeyholeIntersection(const AACube& cube) const;
ViewFrustum::intersection calculateCubeFrustumIntersection(const AACube& cube) const;
ViewFrustum::intersection calculateCubeKeyholeIntersection(const AACube& cube) const;
bool pointIntersectsFrustum(const glm::vec3& point) const;
bool sphereIntersectsFrustum(const glm::vec3& center, float radius) const;