Uses EPS to compare Camera quads after 50f70b7be3
.
We don't need exact precision in that kind of calculations. Since we use not fixed floating point numbers and use them only for visual stuff. Tested By: Stan Differential Revision: https://code.wildfiregames.com/D2713 This was SVN commit r23608.
This commit is contained in:
parent
7357656df2
commit
2489e57d58
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -126,6 +126,17 @@ public:
|
||||
std::fabs(p1.m_Norm.Z - p2.m_Norm.Z) < EPS;
|
||||
}
|
||||
|
||||
void CompareQuads(const CCamera::Quad& quad, const CCamera::Quad& expected_quad)
|
||||
{
|
||||
const float EPS = 1e-4;
|
||||
for (size_t index = 0; index < expected_quad.size(); ++index)
|
||||
{
|
||||
TS_ASSERT_DELTA(quad[index].X, expected_quad[index].X, EPS);
|
||||
TS_ASSERT_DELTA(quad[index].Y, expected_quad[index].Y, EPS);
|
||||
TS_ASSERT_DELTA(quad[index].Z, expected_quad[index].Z, EPS);
|
||||
}
|
||||
}
|
||||
|
||||
void test_persepctive_plane_points()
|
||||
{
|
||||
SViewPort viewPort;
|
||||
@ -160,6 +171,6 @@ public:
|
||||
CVector3D(-101.0f, 101.0f, 101.0f)
|
||||
};
|
||||
camera.GetViewQuad(camera.GetFarPlane(), quad);
|
||||
TS_ASSERT_EQUALS(quad, expectedFarQuad);
|
||||
CompareQuads(quad, expectedFarQuad);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user