1// Copyright 2008-2022 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#ifdef BOOST_QVM_TEST_SINGLE_HEADER
7# include BOOST_QVM_TEST_SINGLE_HEADER
8#else
9# include <boost/qvm/mat_operations.hpp>
10#endif
11
12#include "test_qvm_matrix.hpp"
13#include "gold.hpp"
14
15namespace
16 {
17 template <class T>
18 void
19 test_perspective_lh( T fov_y, T aspect_ratio, T z_near, T z_far )
20 {
21 using namespace boost::qvm;
22 test_qvm::matrix<M1,4,4> const m=perspective_lh(fov_y,aspect_ratio,z_near,z_far);
23 test_qvm::matrix_perspective_lh(m.b,fov_y,aspect_ratio,z_near,z_far);
24 BOOST_QVM_TEST_CLOSE(m.a,m.b,0.000001f);
25 }
26
27 template <class T>
28 void
29 test_perspective_rh( T fov_y, T aspect_ratio, T z_near, T z_far )
30 {
31 using namespace boost::qvm;
32 test_qvm::matrix<M1,4,4> const m=perspective_rh(fov_y,aspect_ratio,z_near,z_far);
33 test_qvm::matrix_perspective_rh(m.b,fov_y,aspect_ratio,z_near,z_far);
34 BOOST_QVM_TEST_CLOSE(m.a,m.b,0.000001f);
35 }
36 }
37
38int
39main()
40 {
41 test_perspective_lh(fov_y: 0.5f,aspect_ratio: 1.3f,z_near: 0.1f,z_far: 2000.0f);
42 test_perspective_rh(fov_y: 0.5f,aspect_ratio: 1.3f,z_near: 0.1f,z_far: 2000.0f);
43 return boost::report_errors();
44 }
45

source code of boost/libs/qvm/test/projection_test.cpp