From 222a596754b4b999fa372a5de4775c4591263798 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 7 Jun 2013 10:59:40 -0700 Subject: [PATCH 1/5] remove unnecessary OctalCode include in main --- interface/src/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 8894e5bd7c..3137ca644d 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -18,8 +18,6 @@ #include "Application.h" #include "Log.h" -#include - int main(int argc, const char * argv[]) { timeval startup_time; gettimeofday(&startup_time, NULL); From c3915ed0784ba0d5a1ff87aed84f6c51f6e39242 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 7 Jun 2013 11:34:01 -0700 Subject: [PATCH 2/5] use system flag for external library includes --- interface/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b2984b35bb..83a827b184 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -87,13 +87,19 @@ find_package(GLM REQUIRED) find_package(LodePNG REQUIRED) find_package(LibOVR) -# include headers for external libraries and InterfaceConfig. +# include headers for interface and InterfaceConfig. include_directories( ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/includes - ${GLM_INCLUDE_DIRS} - ${LODEPNG_INCLUDE_DIRS} - ${LIBOVR_INCLUDE_DIRS} +) + +# include external library headers +# use system flag so warnings are supressed +include_directories( + SYSTEM + ${GLM_INCLUDE_DIRS} + ${LODEPNG_INCLUDE_DIRS} + ${LIBOVR_INCLUDE_DIRS} ) target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES}) From b0d02ab7d8d6b66a31664091daaf65fcd1d04eda Mon Sep 17 00:00:00 2001 From: atlante45 Date: Fri, 7 Jun 2013 23:02:00 +0200 Subject: [PATCH 3/5] 19366 - Smaller log display --- interface/src/LogDisplay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/LogDisplay.h b/interface/src/LogDisplay.h index e2f9ad8dd4..f699cb5279 100644 --- a/interface/src/LogDisplay.h +++ b/interface/src/LogDisplay.h @@ -27,7 +27,7 @@ public: static unsigned const TEXT_COLOR = 0xb299ff; // text foreground color (bytes, RGB) static FILE* const DEFAULT_STREAM; // = stdout; // stream to also log to (defined in .cpp) - static unsigned const DEFAULT_CHAR_WIDTH = 7; // width of a single character + static unsigned const DEFAULT_CHAR_WIDTH = 5; // width of a single character static unsigned const DEFAULT_CHAR_HEIGHT = 16; // height of a single character static unsigned const DEFAULT_CONSOLE_WIDTH = 400; // width of the (right-aligned) log console From 46c66c39e573b7ad695cab2e924ee9da5569eea6 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 7 Jun 2013 17:23:23 -0700 Subject: [PATCH 4/5] implement keyhole frustum --- interface/src/Application.cpp | 16 ++- interface/src/Application.h | 2 +- libraries/voxels/src/AABox.h | 3 +- libraries/voxels/src/ViewFrustum.cpp | 207 +++++++++++++++++---------- libraries/voxels/src/ViewFrustum.h | 93 ++++++------ 5 files changed, 203 insertions(+), 118 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index acb82412ca..1e4fc5459f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1498,6 +1498,9 @@ void Application::updateFrustumRenderModeAction() { case FRUSTUM_DRAW_MODE_FAR_PLANE: _frustumRenderModeAction->setText("Render Mode - Far"); break; + case FRUSTUM_DRAW_MODE_KEYHOLE: + _frustumRenderModeAction->setText("Render Mode - Keyhole"); + break; } } @@ -2237,9 +2240,20 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { glVertex3f(viewFrustum.getNearTopLeft().x, viewFrustum.getNearTopLeft().y, viewFrustum.getNearTopLeft().z); glVertex3f(viewFrustum.getFarTopLeft().x, viewFrustum.getFarTopLeft().y, viewFrustum.getFarTopLeft().z); } - glEnd(); glEnable(GL_LIGHTING); + + if (_frustumDrawingMode == FRUSTUM_DRAW_MODE_ALL || _frustumDrawingMode == FRUSTUM_DRAW_MODE_KEYHOLE) { + // Draw the keyhole + float keyholeRadius = viewFrustum.getKeyholeRadius(); + if (keyholeRadius > 0.0f) { + glPushMatrix(); + glColor4f(1,1,0,1); + glTranslatef(position.x, position.y, position.z); // where we actually want it! + glutWireSphere(keyholeRadius, 20, 20); + glPopMatrix(); + } + } } void Application::setupPaintingVoxel() { diff --git a/interface/src/Application.h b/interface/src/Application.h index 3fe1e8e4b5..974a43e3fe 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -226,7 +226,7 @@ private: ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc. enum FrustumDrawMode { FRUSTUM_DRAW_MODE_ALL, FRUSTUM_DRAW_MODE_VECTORS, FRUSTUM_DRAW_MODE_PLANES, - FRUSTUM_DRAW_MODE_NEAR_PLANE, FRUSTUM_DRAW_MODE_FAR_PLANE, FRUSTUM_DRAW_MODE_COUNT }; + FRUSTUM_DRAW_MODE_NEAR_PLANE, FRUSTUM_DRAW_MODE_FAR_PLANE, FRUSTUM_DRAW_MODE_KEYHOLE, FRUSTUM_DRAW_MODE_COUNT }; FrustumDrawMode _frustumDrawingMode; float _viewFrustumOffsetYaw; // the following variables control yaw, pitch, roll and distance form regular diff --git a/libraries/voxels/src/AABox.h b/libraries/voxels/src/AABox.h index f0d8e005aa..6ac9fc2f2e 100644 --- a/libraries/voxels/src/AABox.h +++ b/libraries/voxels/src/AABox.h @@ -29,7 +29,8 @@ class AABox public: - AABox(const glm::vec3& corner, float x, float y, float z) : _corner(corner), _size(x,y,z) { }; + AABox(const glm::vec3& corner, float size) : _corner(corner), _size(size, size, size) { }; + AABox(const glm::vec3& corner, float x, float y, float z) : _corner(corner), _size(x, y, z) { }; AABox(const glm::vec3& corner, const glm::vec3& size) : _corner(corner), _size(size) { }; AABox() : _corner(0,0,0), _size(0,0,0) { } ~AABox() { } diff --git a/libraries/voxels/src/ViewFrustum.cpp b/libraries/voxels/src/ViewFrustum.cpp index b3c890ed07..b47199310c 100644 --- a/libraries/voxels/src/ViewFrustum.cpp +++ b/libraries/voxels/src/ViewFrustum.cpp @@ -29,6 +29,7 @@ ViewFrustum::ViewFrustum() : _aspectRatio(1.0), _nearClip(0.1), _farClip(500.0), + _keyholeRadius(DEFAULT_KEYHOLE_RADIUS), _farTopLeft(0,0,0), _farTopRight(0,0,0), _farBottomLeft(0,0,0), @@ -36,7 +37,9 @@ ViewFrustum::ViewFrustum() : _nearTopLeft(0,0,0), _nearTopRight(0,0,0), _nearBottomLeft(0,0,0), - _nearBottomRight(0,0,0) { } + _nearBottomRight(0,0,0) +{ +} void ViewFrustum::setOrientation(const glm::quat& orientationAsQuaternion) { _orientation = orientationAsQuaternion; @@ -114,42 +117,6 @@ void ViewFrustum::calculate() { } -void ViewFrustum::dump() const { - - printLog("position.x=%f, position.y=%f, position.z=%f\n", _position.x, _position.y, _position.z); - printLog("direction.x=%f, direction.y=%f, direction.z=%f\n", _direction.x, _direction.y, _direction.z); - printLog("up.x=%f, up.y=%f, up.z=%f\n", _up.x, _up.y, _up.z); - printLog("right.x=%f, right.y=%f, right.z=%f\n", _right.x, _right.y, _right.z); - - printLog("farDist=%f\n", _farClip); - - printLog("nearDist=%f\n", _nearClip); - - printLog("eyeOffsetPosition=%f,%f,%f\n", _eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z); - - printLog("eyeOffsetOrientation=%f,%f,%f,%f\n", _eyeOffsetOrientation.x, _eyeOffsetOrientation.y, - _eyeOffsetOrientation.z, _eyeOffsetOrientation.w); - - printLog("farTopLeft.x=%f, farTopLeft.y=%f, farTopLeft.z=%f\n", - _farTopLeft.x, _farTopLeft.y, _farTopLeft.z); - printLog("farTopRight.x=%f, farTopRight.y=%f, farTopRight.z=%f\n", - _farTopRight.x, _farTopRight.y, _farTopRight.z); - printLog("farBottomLeft.x=%f, farBottomLeft.y=%f, farBottomLeft.z=%f\n", - _farBottomLeft.x, _farBottomLeft.y, _farBottomLeft.z); - printLog("farBottomRight.x=%f, farBottomRight.y=%f, farBottomRight.z=%f\n", - _farBottomRight.x, _farBottomRight.y, _farBottomRight.z); - - printLog("nearTopLeft.x=%f, nearTopLeft.y=%f, nearTopLeft.z=%f\n", - _nearTopLeft.x, _nearTopLeft.y, _nearTopLeft.z); - printLog("nearTopRight.x=%f, nearTopRight.y=%f, nearTopRight.z=%f\n", - _nearTopRight.x, _nearTopRight.y, _nearTopRight.z); - printLog("nearBottomLeft.x=%f, nearBottomLeft.y=%f, nearBottomLeft.z=%f\n", - _nearBottomLeft.x, _nearBottomLeft.y, _nearBottomLeft.z); - printLog("nearBottomRight.x=%f, nearBottomRight.y=%f, nearBottomRight.z=%f\n", - _nearBottomRight.x, _nearBottomRight.y, _nearBottomRight.z); -} - - //enum { TOP_PLANE = 0, BOTTOM_PLANE, LEFT_PLANE, RIGHT_PLANE, NEAR_PLANE, FAR_PLANE }; const char* ViewFrustum::debugPlaneName (int plane) const { switch (plane) { @@ -163,52 +130,147 @@ const char* ViewFrustum::debugPlaneName (int plane) const { return "Unknown"; } +ViewFrustum::location ViewFrustum::pointInSphere(const glm::vec3& point, const glm::vec3& center, float radius ) const { -ViewFrustum::location ViewFrustum::pointInFrustum(const glm::vec3& point) const { - - //printf("ViewFrustum::pointInFrustum() point=%f,%f,%f\n",point.x,point.y,point.z); - //dump(); - - ViewFrustum::location result = INSIDE; - for(int i=0; i < 6; i++) { - float distance = _planes[i].distance(point); - - //printf("plane[%d] %s -- distance=%f \n",i,debugPlaneName(i),distance); + ViewFrustum::location result = INTERSECT; - if (distance < 0) { - return OUTSIDE; + float distance = glm::distance(point, center); + if (distance > radius) { + result = OUTSIDE; + } else if (distance < radius) { + result = INSIDE; + } + + return result; +} + +// To determine if two spheres intersect, simply calculate the distance between the centers of the two spheres. +// If the distance is greater than the sum of the two sphere radii, they don’t intersect. Otherwise they intersect. +// If the distance plus the radius of sphere A is less than the radius of sphere B then, sphere A is inside of sphere B +ViewFrustum::location ViewFrustum::sphereInSphere(const glm::vec3& centerA, float radiusA, + const glm::vec3& centerB, float radiusB ) const { + + ViewFrustum::location result = INTERSECT; + + float distanceFromAtoB = glm::distance(centerA, centerB); + if (distanceFromAtoB > (radiusA + radiusB)) { + result = OUTSIDE; + } else if ((distanceFromAtoB + radiusA) < radiusB) { + result = INSIDE; + } + + return result; +} + + +// A box is inside a sphere if all of its corners are inside the sphere +// A box intersects a sphere if any of its edges (as rays) interesect the sphere +// A box is outside a sphere if none of its edges (as rays) interesect the sphere +ViewFrustum::location ViewFrustum::boxInSphere(const AABox& box, const glm::vec3& center, float radius) const { + glm::vec3 penetration; + bool intersects = box.findSpherePenetration(center, radius, penetration); + + ViewFrustum::location result = OUTSIDE; + + // if the box intersects the sphere, then it may also be inside... calculate further + if (intersects) { + result = INTERSECT; + + // test all the corners, if they are all inside the sphere, the entire box is in the sphere + glm::vec3 testPoint = box.getCorner(); + glm::vec3 size = box.getSize(); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(size.x, 0.0f, 0.0f); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(0.0f, 0.0f, size.z); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(size.x, 0.0f, size.z); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(0.0f, size.y, 0.0f); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(size.x, size.y, 0.0f); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(0.0f, size.y, size.z); + if (pointInSphere(testPoint, center, radius)) { + testPoint = box.getCorner() + glm::vec3(size.x, size.y, size.z); + if (pointInSphere(testPoint, center, radius)) { + result = INSIDE; + } + } + } + } + } + } + } } } - return(result); + + return result; +} + +ViewFrustum::location ViewFrustum::pointInFrustum(const glm::vec3& point) const { + ViewFrustum::location regularResult = INSIDE; + ViewFrustum::location keyholeResult = OUTSIDE; + + // If we have a keyholeRadius, check that first, since it's cheaper + if (_keyholeRadius >= 0.0f) { + keyholeResult = pointInSphere(point, _position, _keyholeRadius); + } + if (keyholeResult == INSIDE) { + return keyholeResult; + } + + // If we're not known to be INSIDE the keyhole, then check the regular frustum + for(int i=0; i < 6; i++) { + float distance = _planes[i].distance(point); + if (distance < 0) { + return keyholeResult; // escape early will be the value from checking the keyhole + } + } + + return regularResult; } ViewFrustum::location ViewFrustum::sphereInFrustum(const glm::vec3& center, float radius) const { - ViewFrustum::location result = INSIDE; + ViewFrustum::location regularResult = INSIDE; + ViewFrustum::location keyholeResult = OUTSIDE; + + // If we have a keyholeRadius, check that first, since it's cheaper + if (_keyholeRadius >= 0.0f) { + keyholeResult = sphereInSphere(center, radius, _position, _keyholeRadius); + } + if (keyholeResult == INSIDE) { + return keyholeResult; + } + float distance; for(int i=0; i < 6; i++) { distance = _planes[i].distance(center); - if (distance < -radius) - return OUTSIDE; - else if (distance < radius) - result = INTERSECT; + if (distance < -radius) { + // This is outside the regular frustum, so just return the value from checking the keyhole + return keyholeResult; + } else if (distance < radius) { + regularResult = INTERSECT; + } } - return(result); + + return regularResult; } ViewFrustum::location ViewFrustum::boxInFrustum(const AABox& box) const { + ViewFrustum::location regularResult = INSIDE; + ViewFrustum::location keyholeResult = OUTSIDE; + + // If we have a keyholeRadius, check that first, since it's cheaper + if (_keyholeRadius >= 0.0f) { + keyholeResult = boxInSphere(box, _position, _keyholeRadius); + } + if (keyholeResult == INSIDE) { + return keyholeResult; + } - //printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n", - // box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x); - ViewFrustum::location result = INSIDE; for(int i=0; i < 6; i++) { - - //printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",i, - // _planes[i].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z, - // _planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z, - // _planes[i].getDCoefficient() - //); - glm::vec3 normal = _planes[i].getNormal(); glm::vec3 boxVertexP = box.getVertexP(normal); float planeToBoxVertexPDistance = _planes[i].distance(boxVertexP); @@ -216,19 +278,14 @@ ViewFrustum::location ViewFrustum::boxInFrustum(const AABox& box) const { glm::vec3 boxVertexN = box.getVertexN(normal); float planeToBoxVertexNDistance = _planes[i].distance(boxVertexN); - //printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i, - // normal.x,normal.y,normal.z, - // boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance, - // boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance - // ); - if (planeToBoxVertexPDistance < 0) { - return OUTSIDE; + // This is outside the regular frustum, so just return the value from checking the keyhole + return keyholeResult; } else if (planeToBoxVertexNDistance < 0) { - result = INTERSECT; + regularResult = INTERSECT; } } - return(result); + return regularResult; } bool testMatches(glm::quat lhs, glm::quat rhs) { diff --git a/libraries/voxels/src/ViewFrustum.h b/libraries/voxels/src/ViewFrustum.h index 1c61160566..d23f2db897 100644 --- a/libraries/voxels/src/ViewFrustum.h +++ b/libraries/voxels/src/ViewFrustum.h @@ -16,44 +16,9 @@ #include "Plane.h" #include "AABox.h" +const float DEFAULT_KEYHOLE_RADIUS = 2.0f; + class ViewFrustum { -private: - - // camera location/orientation attributes - glm::vec3 _position; - glm::quat _orientation; - - // calculated for orientation - glm::vec3 _direction; - glm::vec3 _up; - glm::vec3 _right; - - // Lens attributes - float _fieldOfView; - float _aspectRatio; - float _nearClip; - float _farClip; - glm::vec3 _eyeOffsetPosition; - glm::quat _eyeOffsetOrientation; - - // Calculated values - glm::vec3 _offsetPosition; - glm::vec3 _offsetDirection; - glm::vec3 _offsetUp; - glm::vec3 _offsetRight; - glm::vec3 _farTopLeft; - glm::vec3 _farTopRight; - glm::vec3 _farBottomLeft; - glm::vec3 _farBottomRight; - glm::vec3 _nearTopLeft; - glm::vec3 _nearTopRight; - glm::vec3 _nearBottomLeft; - glm::vec3 _nearBottomRight; - enum { TOP_PLANE = 0, BOTTOM_PLANE, LEFT_PLANE, RIGHT_PLANE, NEAR_PLANE, FAR_PLANE }; - Plane _planes[6]; // How will this be used? - - const char* debugPlaneName (int plane) const; - public: // setters for camera attributes void setPosition (const glm::vec3& p) { _position = p; }; @@ -74,7 +39,6 @@ public: void setEyeOffsetPosition (const glm::vec3& p) { _eyeOffsetPosition = p; }; void setEyeOffsetOrientation (const glm::quat& o) { _eyeOffsetOrientation = o; }; - // getters for lens attributes float getFieldOfView() const { return _fieldOfView; }; float getAspectRatio() const { return _aspectRatio; }; @@ -98,12 +62,14 @@ public: const glm::vec3& getNearBottomLeft() const { return _nearBottomLeft; }; const glm::vec3& getNearBottomRight() const { return _nearBottomRight;}; + // get/set for keyhole attribute + void setKeyholeRadius(float keyholdRadius) { _keyholeRadius = keyholdRadius; }; + float getKeyholeRadius() const { return _keyholeRadius; }; + void calculate(); ViewFrustum(); - void dump() const; - typedef enum {OUTSIDE, INTERSECT, INSIDE} location; ViewFrustum::location pointInFrustum(const glm::vec3& point) const; @@ -120,6 +86,53 @@ public: glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const; void printDebugDetails() const; + +private: + + // Used for keyhole calculations + ViewFrustum::location pointInSphere(const glm::vec3& point, const glm::vec3& center, float radius) const; + ViewFrustum::location sphereInSphere(const glm::vec3& centerA, float radiusA, const glm::vec3& centerB, float radiusB) const; + ViewFrustum::location boxInSphere(const AABox& box, const glm::vec3& center, float radius) const; + + // camera location/orientation attributes + glm::vec3 _position; + glm::quat _orientation; + + // calculated for orientation + glm::vec3 _direction; + glm::vec3 _up; + glm::vec3 _right; + + // Lens attributes + float _fieldOfView; + float _aspectRatio; + float _nearClip; + float _farClip; + glm::vec3 _eyeOffsetPosition; + glm::quat _eyeOffsetOrientation; + + // keyhole attributes + float _keyholeRadius; + + + // Calculated values + glm::vec3 _offsetPosition; + glm::vec3 _offsetDirection; + glm::vec3 _offsetUp; + glm::vec3 _offsetRight; + glm::vec3 _farTopLeft; + glm::vec3 _farTopRight; + glm::vec3 _farBottomLeft; + glm::vec3 _farBottomRight; + glm::vec3 _nearTopLeft; + glm::vec3 _nearTopRight; + glm::vec3 _nearBottomLeft; + glm::vec3 _nearBottomRight; + enum { TOP_PLANE = 0, BOTTOM_PLANE, LEFT_PLANE, RIGHT_PLANE, NEAR_PLANE, FAR_PLANE }; + Plane _planes[6]; // How will this be used? + + const char* debugPlaneName (int plane) const; + }; From a175ad8fdade0d135bba979e75d9d7fbca28b8a5 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 7 Jun 2013 17:25:05 -0700 Subject: [PATCH 5/5] fix spacing --- libraries/voxels/src/AABox.h | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libraries/voxels/src/AABox.h b/libraries/voxels/src/AABox.h index 6ac9fc2f2e..7acf2d54f1 100644 --- a/libraries/voxels/src/AABox.h +++ b/libraries/voxels/src/AABox.h @@ -24,29 +24,29 @@ enum BoxFace { const int FACE_COUNT = 6; -class AABox + class AABox { public: AABox(const glm::vec3& corner, float size) : _corner(corner), _size(size, size, size) { }; - AABox(const glm::vec3& corner, float x, float y, float z) : _corner(corner), _size(x, y, z) { }; - AABox(const glm::vec3& corner, const glm::vec3& size) : _corner(corner), _size(size) { }; + AABox(const glm::vec3& corner, float x, float y, float z) : _corner(corner), _size(x, y, z) { }; + AABox(const glm::vec3& corner, const glm::vec3& size) : _corner(corner), _size(size) { }; AABox() : _corner(0,0,0), _size(0,0,0) { } ~AABox() { } - void setBox(const glm::vec3& corner, float x, float y, float z) { setBox(corner,glm::vec3(x,y,z)); }; - void setBox(const glm::vec3& corner, const glm::vec3& size); + void setBox(const glm::vec3& corner, float x, float y, float z) { setBox(corner,glm::vec3(x,y,z)); }; + void setBox(const glm::vec3& corner, const glm::vec3& size); - // for use in frustum computations - glm::vec3 getVertexP(const glm::vec3& normal) const; - glm::vec3 getVertexN(const glm::vec3& normal) const; - - void scale(float scale); - - const glm::vec3& getCorner() const { return _corner; }; - const glm::vec3& getSize() const { return _size; }; - const glm::vec3& getCenter() const { return _center; }; + // for use in frustum computations + glm::vec3 getVertexP(const glm::vec3& normal) const; + glm::vec3 getVertexN(const glm::vec3& normal) const; + + void scale(float scale); + + const glm::vec3& getCorner() const { return _corner; }; + const glm::vec3& getSize() const { return _size; }; + const glm::vec3& getCenter() const { return _center; }; bool contains(const glm::vec3& point) const; bool expandedContains(const glm::vec3& point, float expansion) const; @@ -56,16 +56,16 @@ public: bool findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius, glm::vec3& penetration) const; private: - + glm::vec3 getClosestPointOnFace(const glm::vec3& point, BoxFace face) const; glm::vec3 getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& direction, BoxFace face) const; glm::vec4 getPlane(BoxFace face) const; - + static BoxFace getOppositeFace(BoxFace face); - - glm::vec3 _corner; - glm::vec3 _center; - glm::vec3 _size; + + glm::vec3 _corner; + glm::vec3 _center; + glm::vec3 _size; };