Fixes a lot of warnings and move math enums to enum classes
This commit is contained in:
@@ -92,11 +92,11 @@ SCENARIO("Serialization", "[CORE][SERIALIZATION]")
|
||||
Nz::Frustumf copy(frustum);
|
||||
REQUIRE(Serialize(context, frustum));
|
||||
frustum.Build(50, 40, 20, 100, Nz::Vector3f::UnitX(), Nz::Vector3f::UnitZ());
|
||||
for (unsigned int i = 0; i <= Nz::BoxCorner_Max; ++i)
|
||||
for (unsigned int i = 0; i < Nz::BoxCornerCount; ++i)
|
||||
REQUIRE(frustum.GetCorner(static_cast<Nz::BoxCorner>(i)) != copy.GetCorner(static_cast<Nz::BoxCorner>(i)));
|
||||
context.stream->SetCursorPos(0);
|
||||
REQUIRE(Unserialize(context, &frustum));
|
||||
for (unsigned int i = 0; i <= Nz::BoxCorner_Max; ++i)
|
||||
for (unsigned int i = 0; i < Nz::BoxCornerCount; ++i)
|
||||
REQUIRE(frustum.GetCorner(static_cast<Nz::BoxCorner>(i)) == copy.GetCorner(static_cast<Nz::BoxCorner>(i)));
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ SCENARIO("BoundingVolume", "[MATH][BOUNDINGVOLUME]")
|
||||
|
||||
Nz::BoundingVolumef centerAndUnit(centerAndUnitOBB);
|
||||
|
||||
Nz::BoundingVolumef nullBoundingVolume(Nz::Extend_Null);
|
||||
Nz::BoundingVolumef infiniteBoundingVolume(Nz::Extend_Infinite);
|
||||
Nz::BoundingVolumef nullBoundingVolume(Nz::Extend::Null);
|
||||
Nz::BoundingVolumef infiniteBoundingVolume(Nz::Extend::Infinite);
|
||||
|
||||
THEN("Normal to null should give a smaller volume")
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ SCENARIO("Box", "[MATH][BOX]")
|
||||
{
|
||||
REQUIRE(firstCenterAndUnit.GetBoundingSphere() == Nz::Spheref(Nz::Vector3f::Unit() * 0.5f, std::sqrt(3.f * 0.5f * 0.5f)));
|
||||
REQUIRE(firstCenterAndUnit.GetCenter() == (Nz::Vector3f::Unit() * 0.5f));
|
||||
REQUIRE(firstCenterAndUnit.GetCorner(Nz::BoxCorner_FarLeftTop) == Nz::Vector3f::UnitY());
|
||||
REQUIRE(firstCenterAndUnit.GetCorner(Nz::BoxCorner::FarLeftTop) == Nz::Vector3f::UnitY());
|
||||
REQUIRE(firstCenterAndUnit.GetLengths() == Nz::Vector3f::Unit());
|
||||
REQUIRE(firstCenterAndUnit.GetMaximum() == Nz::Vector3f::Unit());
|
||||
REQUIRE(firstCenterAndUnit.GetMinimum() == Nz::Vector3f::Zero());
|
||||
|
||||
@@ -14,16 +14,16 @@ SCENARIO("Frustum", "[MATH][FRUSTUM]")
|
||||
{
|
||||
Nz::BoundingVolumef bv(Nz::Vector3f::Zero(), Nz::Vector3f::Unit());
|
||||
bv.Update(Nz::Matrix4f::Identity());
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(bv));
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(Nz::Boxf(Nz::Vector3f::Zero(), Nz::Vector3f::Unit() * 0.9f)));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(bv));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(Nz::Boxf(Nz::Vector3f::Zero(), Nz::Vector3f::Unit() * 0.9f)));
|
||||
Nz::OrientedBoxf obb(Nz::Vector3f::Zero(), Nz::Vector3f::Unit() * 0.9f);
|
||||
obb.Update(Nz::Matrix4f::Identity());
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(obb));
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(Nz::Spheref(Nz::Vector3f::Zero(), 0.5f)));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(obb));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(Nz::Spheref(Nz::Vector3f::Zero(), 0.5f)));
|
||||
Nz::Vector3f tmp = Nz::Vector3f::Zero();
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(&tmp, 1));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(&tmp, 1));
|
||||
tmp = Nz::Vector3f::UnitX() * -10.f;
|
||||
REQUIRE(Nz::IntersectionSide_Outside == frustum.Intersect(&tmp, 1));
|
||||
REQUIRE(Nz::IntersectionSide::Outside == frustum.Intersect(&tmp, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ SCENARIO("Frustum", "[MATH][FRUSTUM]")
|
||||
Nz::BoundingVolumef bv(500.f, -0.5f, -0.5f, 1.f, 1.f, 1.f);
|
||||
bv.Update(Nz::Matrix4f::Identity());
|
||||
|
||||
REQUIRE(Nz::IntersectionSide_Inside == frustum.Intersect(bv));
|
||||
REQUIRE(Nz::IntersectionSide_Inside == frustum.Intersect(Nz::Boxf(Nz::Vector3f::UnitX() * 500.f, Nz::Vector3f::Unit())));
|
||||
REQUIRE(Nz::IntersectionSide::Inside == frustum.Intersect(bv));
|
||||
REQUIRE(Nz::IntersectionSide::Inside == frustum.Intersect(Nz::Boxf(Nz::Vector3f::UnitX() * 500.f, Nz::Vector3f::Unit())));
|
||||
Nz::OrientedBoxf obb(Nz::Vector3f::UnitX() * 100.f, Nz::Vector3f::Unit());
|
||||
obb.Update(Nz::Matrix4f::Identity());
|
||||
REQUIRE(Nz::IntersectionSide_Inside == frustum.Intersect(obb));
|
||||
REQUIRE(Nz::IntersectionSide_Inside == frustum.Intersect(Nz::Spheref(Nz::Vector3f::UnitX() * 100.f, 0.5f)));
|
||||
REQUIRE(Nz::IntersectionSide::Inside == frustum.Intersect(obb));
|
||||
REQUIRE(Nz::IntersectionSide::Inside == frustum.Intersect(Nz::Spheref(Nz::Vector3f::UnitX() * 100.f, 0.5f)));
|
||||
Nz::Vector3f tmp = Nz::Vector3f::UnitX() * 100.f;
|
||||
REQUIRE(Nz::IntersectionSide_Inside == frustum.Intersect(&tmp, 1));
|
||||
REQUIRE(Nz::IntersectionSide::Inside == frustum.Intersect(&tmp, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ SCENARIO("Frustum", "[MATH][FRUSTUM]")
|
||||
CHECK(!frustum.Contains(nullVolume));
|
||||
Nz::BoundingVolumef infiniteVolume = Nz::BoundingVolumef::Infinite();
|
||||
CHECK(frustum.Contains(infiniteVolume));
|
||||
REQUIRE(frustum.Intersect(nullVolume) == Nz::IntersectionSide_Outside);
|
||||
REQUIRE(frustum.Intersect(infiniteVolume) == Nz::IntersectionSide_Intersecting);
|
||||
REQUIRE(frustum.Intersect(nullVolume) == Nz::IntersectionSide::Outside);
|
||||
REQUIRE(frustum.Intersect(infiniteVolume) == Nz::IntersectionSide::Intersecting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ SCENARIO("OrientedBox", "[MATH][ORIENTEDBOX]")
|
||||
secondCenterAndUnit.Update(Nz::Matrix4f::Scale(Nz::Vector3f::Unit() * 2.f));
|
||||
|
||||
REQUIRE(firstCenterAndUnit != secondCenterAndUnit);
|
||||
for (unsigned int i = 0; i <= Nz::BoxCorner_Max; ++i)
|
||||
for (unsigned int i = 0; i < Nz::BoxCornerCount; ++i)
|
||||
{
|
||||
REQUIRE(firstCenterAndUnit(i) == secondCenterAndUnit(i));
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ SCENARIO("Ray", "[MATH][RAY]")
|
||||
|
||||
THEN("For the bounding volume collision's")
|
||||
{
|
||||
Nz::BoundingVolumef nullVolume(Nz::Extend_Null);
|
||||
Nz::BoundingVolumef nullVolume(Nz::Extend::Null);
|
||||
CHECK(!ray.Intersect(nullVolume));
|
||||
|
||||
float tmpClosest = -1.f;
|
||||
float tmpFurthest = -1.f;
|
||||
Nz::BoundingVolumef infiniteVolume(Nz::Extend_Infinite);
|
||||
Nz::BoundingVolumef infiniteVolume(Nz::Extend::Infinite);
|
||||
CHECK(ray.Intersect(infiniteVolume, &tmpClosest, &tmpFurthest));
|
||||
CHECK(tmpClosest == Approx(0.f));
|
||||
CHECK(tmpFurthest == std::numeric_limits<float>::infinity());
|
||||
|
||||
@@ -14,7 +14,7 @@ SCENARIO("Rect", "[MATH][RECT]")
|
||||
{
|
||||
CHECK(firstCenterAndUnit == secondCenterAndUnit);
|
||||
CHECK(firstCenterAndUnit.GetCenter() == secondCenterAndUnit.GetCenter());
|
||||
CHECK(firstCenterAndUnit.GetCorner(Nz::RectCorner_LeftBottom) == secondCenterAndUnit.GetCorner(Nz::RectCorner_LeftBottom));
|
||||
CHECK(firstCenterAndUnit.GetCorner(Nz::RectCorner::LeftBottom) == secondCenterAndUnit.GetCorner(Nz::RectCorner::LeftBottom));
|
||||
CHECK(firstCenterAndUnit.IsValid());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user