-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1083 from CesiumGS/culling-volume-crash
Fix crash while creating culling volume when the camera is very far from the globe
- Loading branch information
Showing
5 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <CesiumGeometry/CullingVolume.h> | ||
#include <CesiumUtility/Math.h> | ||
|
||
#include <doctest/doctest.h> | ||
#include <glm/ext/matrix_transform.hpp> | ||
#include <glm/ext/vector_double3.hpp> | ||
#include <glm/fwd.hpp> | ||
#include <glm/gtx/euler_angles.hpp> | ||
|
||
#include <cmath> | ||
|
||
using namespace doctest; | ||
using namespace CesiumGeometry; | ||
using namespace CesiumUtility; | ||
|
||
TEST_CASE("CullingVolume::createCullingVolume") { | ||
SUBCASE("Shouldn't crash when too far from the globe") { | ||
CHECK_NOTHROW(createCullingVolume( | ||
glm::dvec3(1e20, 1e20, 1e20), | ||
glm::dvec3(0, 0, 1), | ||
glm::dvec3(0, 1, 0), | ||
Math::PiOverTwo, | ||
Math::PiOverTwo)); | ||
} | ||
|
||
SUBCASE("Shouldn't crash at the center of the globe") { | ||
CHECK_NOTHROW(createCullingVolume( | ||
glm::dvec3(0, 0, 0), | ||
glm::dvec3(0, 0, 1), | ||
glm::dvec3(0, 1, 0), | ||
Math::PiOverTwo, | ||
Math::PiOverTwo)); | ||
} | ||
} |