Browse Source

Using "initializer-list" constructors for Matrix everywhere.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
8761e1f636
  1. 16
      src/Math/Test/GeometryUtilsTest.cpp
  2. 22
      src/Test/CameraTest.cpp

16
src/Math/Test/GeometryUtilsTest.cpp

@ -42,15 +42,13 @@ void GeometryUtilsTest::intersection_data() {
QTest::addColumn<Vector3>("b"); QTest::addColumn<Vector3>("b");
QTest::addColumn<float>("expected"); QTest::addColumn<float>("expected");
float plane[] = { Matrix3 plane(0.0f, 0.0f, 0.0f,
0, 0, 0, 1.0f, 0.0f, 0.0f,
1, 0, 0, 0.0f, 1.0f, 0.0f);
0, 1, 0 QTest::newRow("inside") << plane << Vector3(0, 0, -1) << Vector3(0, 0, 1) << 0.5f;
}; QTest::newRow("outside") << plane << Vector3(0, 0, 1) << Vector3(0, 0, 2) << -1.0f;
QTest::newRow("inside") << Matrix3(plane) << Vector3(0, 0, -1) << Vector3(0, 0, 1) << 0.5f; QTest::newRow("NaN") << plane << Vector3(1, 0, 0) << Vector3(0, 1, 0) << numeric_limits<float>::quiet_NaN();
QTest::newRow("outside") << Matrix3(plane) << Vector3(0, 0, 1) << Vector3(0, 0, 2) << -1.0f; QTest::newRow("inf") << plane << Vector3(1, 0, 1) << Vector3(0, 0, 1) << numeric_limits<float>::infinity();
QTest::newRow("NaN") << Matrix3(plane) << Vector3(1, 0, 0) << Vector3(0, 1, 0) << numeric_limits<float>::quiet_NaN();
QTest::newRow("inf") << Matrix3(plane) << Vector3(1, 0, 1) << Vector3(0, 0, 1) << numeric_limits<float>::infinity();
} }
void GeometryUtilsTest::intersection() { void GeometryUtilsTest::intersection() {

22
src/Test/CameraTest.cpp

@ -28,12 +28,10 @@ void CameraTest::orthographic() {
Camera camera; Camera camera;
camera.setOrthographic(5, 1, 9); camera.setOrthographic(5, 1, 9);
GLfloat a[] = { Matrix4 a(0.4f, 0.0f, 0.0f, 0.0f,
0.4f, 0, 0, 0, 0.0f, 0.4f, 0.0f, 0.0f,
0, 0.4f, 0, 0, 0.0f, 0.0f, -0.25f, 0.0f,
0, 0, -0.25f, 0, 0.0f, 0.0f, -1.25f, 1.0f);
0, 0, -1.25f, 1
};
QVERIFY(camera.projectionMatrix() == a); QVERIFY(camera.projectionMatrix() == a);
} }
@ -42,14 +40,12 @@ void CameraTest::perspective() {
Camera camera; Camera camera;
camera.setPerspective(deg(27.0f), 32.0f, 100); camera.setPerspective(deg(27.0f), 32.0f, 100);
GLfloat a[] = { Matrix4 a(4.1652994f, 0.0f, 0.0f, 0.0f,
4.1652994f, 0, 0, 0, 0.0f, 4.1652994f, 0.0f, 0.0f,
0, 4.1652994f, 0, 0, 0.0f, 0.0f, -1.9411764f, -1.0f,
0, 0, -1.9411764f, -1, 0.0f, 0.0f, -94.1176452f, 0.0f);
0, 0, -94.1176452f, 0
};
QVERIFY(camera.projectionMatrix() == Matrix4(a)); QVERIFY(camera.projectionMatrix() == a);
} }
}} }}

Loading…
Cancel
Save