]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/projection_test.cpp
update sources to v12.2.4
[ceph.git] / ceph / src / boost / libs / qvm / test / projection_test.cpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <boost/qvm/mat_operations.hpp>
7 #include "test_qvm_matrix.hpp"
8 #include "gold.hpp"
9
10 namespace
11 {
12 template <class T>
13 void
14 test_perspective_lh( T fov_y, T aspect_ratio, T z_near, T z_far )
15 {
16 using namespace boost::qvm;
17 test_qvm::matrix<M1,4,4> const m=perspective_lh(fov_y,aspect_ratio,z_near,z_far);
18 test_qvm::matrix_perspective_lh(m.b,fov_y,aspect_ratio,z_near,z_far);
19 BOOST_QVM_TEST_CLOSE(m.a,m.b,0.000001f);
20 }
21
22 template <class T>
23 void
24 test_perspective_rh( T fov_y, T aspect_ratio, T z_near, T z_far )
25 {
26 using namespace boost::qvm;
27 test_qvm::matrix<M1,4,4> const m=perspective_rh(fov_y,aspect_ratio,z_near,z_far);
28 test_qvm::matrix_perspective_rh(m.b,fov_y,aspect_ratio,z_near,z_far);
29 BOOST_QVM_TEST_CLOSE(m.a,m.b,0.000001f);
30 }
31 }
32
33 int
34 main()
35 {
36 test_perspective_lh(0.5f,1.3f,0.1f,2000.0f);
37 test_perspective_rh(0.5f,1.3f,0.1f,2000.0f);
38 return boost::report_errors();
39 }