]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS4_HPP_INCLUDED |
2 | #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS4_HPP_INCLUDED | |
92f5a8d4 | 3 | |
1e59de90 | 4 | // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. |
92f5a8d4 | 5 | |
1e59de90 TL |
6 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
7 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
92f5a8d4 | 8 | |
1e59de90 | 9 | // This file was generated by a program. Do not edit manually. |
92f5a8d4 TL |
10 | |
11 | #include <boost/qvm/deduce_vec.hpp> | |
12 | #include <boost/qvm/enable_if.hpp> | |
13 | #include <boost/qvm/inline.hpp> | |
14 | #include <boost/qvm/mat_traits.hpp> | |
15 | #include <boost/qvm/vec_traits.hpp> | |
16 | ||
1e59de90 | 17 | namespace boost { namespace qvm { |
92f5a8d4 | 18 | |
1e59de90 TL |
19 | template <class A,class B> |
20 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
21 | typename lazy_enable_if_c< | |
22 | mat_traits<A>::rows==4 && mat_traits<A>::cols==4 && | |
23 | vec_traits<B>::dim==4, | |
24 | deduce_vec2<A,B,4> >::type | |
25 | operator*( A const & a, B const & b ) | |
26 | { | |
27 | typedef typename mat_traits<A>::scalar_type Ta; | |
28 | typedef typename vec_traits<B>::scalar_type Tb; | |
29 | Ta const a00 = mat_traits<A>::template read_element<0,0>(a); | |
30 | Ta const a01 = mat_traits<A>::template read_element<0,1>(a); | |
31 | Ta const a02 = mat_traits<A>::template read_element<0,2>(a); | |
32 | Ta const a03 = mat_traits<A>::template read_element<0,3>(a); | |
33 | Ta const a10 = mat_traits<A>::template read_element<1,0>(a); | |
34 | Ta const a11 = mat_traits<A>::template read_element<1,1>(a); | |
35 | Ta const a12 = mat_traits<A>::template read_element<1,2>(a); | |
36 | Ta const a13 = mat_traits<A>::template read_element<1,3>(a); | |
37 | Ta const a20 = mat_traits<A>::template read_element<2,0>(a); | |
38 | Ta const a21 = mat_traits<A>::template read_element<2,1>(a); | |
39 | Ta const a22 = mat_traits<A>::template read_element<2,2>(a); | |
40 | Ta const a23 = mat_traits<A>::template read_element<2,3>(a); | |
41 | Ta const a30 = mat_traits<A>::template read_element<3,0>(a); | |
42 | Ta const a31 = mat_traits<A>::template read_element<3,1>(a); | |
43 | Ta const a32 = mat_traits<A>::template read_element<3,2>(a); | |
44 | Ta const a33 = mat_traits<A>::template read_element<3,3>(a); | |
45 | Tb const b0 = vec_traits<B>::template read_element<0>(b); | |
46 | Tb const b1 = vec_traits<B>::template read_element<1>(b); | |
47 | Tb const b2 = vec_traits<B>::template read_element<2>(b); | |
48 | Tb const b3 = vec_traits<B>::template read_element<3>(b); | |
49 | typedef typename deduce_vec2<A,B,4>::type R; | |
50 | BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==4); | |
51 | R r; | |
52 | vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1+a02*b2+a03*b3; | |
53 | vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1+a12*b2+a13*b3; | |
54 | vec_traits<R>::template write_element<2>(r)=a20*b0+a21*b1+a22*b2+a23*b3; | |
55 | vec_traits<R>::template write_element<3>(r)=a30*b0+a31*b1+a32*b2+a33*b3; | |
56 | return r; | |
57 | } | |
92f5a8d4 | 58 | |
1e59de90 TL |
59 | namespace |
60 | sfinae | |
61 | { | |
62 | using ::boost::qvm::operator*; | |
63 | } | |
92f5a8d4 | 64 | |
1e59de90 TL |
65 | namespace |
66 | qvm_detail | |
67 | { | |
68 | template <int R,int C> | |
69 | struct mul_mv_defined; | |
92f5a8d4 | 70 | |
1e59de90 TL |
71 | template <> |
72 | struct | |
73 | mul_mv_defined<4,4> | |
74 | { | |
75 | static bool const value=true; | |
76 | }; | |
77 | } | |
92f5a8d4 | 78 | |
1e59de90 TL |
79 | template <class A,class B> |
80 | BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS | |
81 | typename lazy_enable_if_c< | |
82 | mat_traits<B>::rows==4 && mat_traits<B>::cols==4 && | |
83 | vec_traits<A>::dim==4, | |
84 | deduce_vec2<A,B,4> >::type | |
85 | operator*( A const & a, B const & b ) | |
86 | { | |
87 | typedef typename vec_traits<A>::scalar_type Ta; | |
88 | typedef typename mat_traits<B>::scalar_type Tb; | |
89 | Ta const a0 = vec_traits<A>::template read_element<0>(a); | |
90 | Ta const a1 = vec_traits<A>::template read_element<1>(a); | |
91 | Ta const a2 = vec_traits<A>::template read_element<2>(a); | |
92 | Ta const a3 = vec_traits<A>::template read_element<3>(a); | |
93 | Tb const b00 = mat_traits<B>::template read_element<0,0>(b); | |
94 | Tb const b01 = mat_traits<B>::template read_element<0,1>(b); | |
95 | Tb const b02 = mat_traits<B>::template read_element<0,2>(b); | |
96 | Tb const b03 = mat_traits<B>::template read_element<0,3>(b); | |
97 | Tb const b10 = mat_traits<B>::template read_element<1,0>(b); | |
98 | Tb const b11 = mat_traits<B>::template read_element<1,1>(b); | |
99 | Tb const b12 = mat_traits<B>::template read_element<1,2>(b); | |
100 | Tb const b13 = mat_traits<B>::template read_element<1,3>(b); | |
101 | Tb const b20 = mat_traits<B>::template read_element<2,0>(b); | |
102 | Tb const b21 = mat_traits<B>::template read_element<2,1>(b); | |
103 | Tb const b22 = mat_traits<B>::template read_element<2,2>(b); | |
104 | Tb const b23 = mat_traits<B>::template read_element<2,3>(b); | |
105 | Tb const b30 = mat_traits<B>::template read_element<3,0>(b); | |
106 | Tb const b31 = mat_traits<B>::template read_element<3,1>(b); | |
107 | Tb const b32 = mat_traits<B>::template read_element<3,2>(b); | |
108 | Tb const b33 = mat_traits<B>::template read_element<3,3>(b); | |
109 | typedef typename deduce_vec2<A,B,4>::type R; | |
110 | BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==4); | |
111 | R r; | |
112 | vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10+a2*b20+a3*b30; | |
113 | vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11+a2*b21+a3*b31; | |
114 | vec_traits<R>::template write_element<2>(r)=a0*b02+a1*b12+a2*b22+a3*b32; | |
115 | vec_traits<R>::template write_element<3>(r)=a0*b03+a1*b13+a2*b23+a3*b33; | |
116 | return r; | |
117 | } | |
92f5a8d4 | 118 | |
1e59de90 TL |
119 | namespace |
120 | sfinae | |
121 | { | |
122 | using ::boost::qvm::operator*; | |
123 | } | |
92f5a8d4 | 124 | |
1e59de90 TL |
125 | namespace |
126 | qvm_detail | |
127 | { | |
128 | template <int R,int C> | |
129 | struct mul_vm_defined; | |
92f5a8d4 | 130 | |
1e59de90 TL |
131 | template <> |
132 | struct | |
133 | mul_vm_defined<4,4> | |
134 | { | |
135 | static bool const value=true; | |
136 | }; | |
92f5a8d4 TL |
137 | } |
138 | ||
1e59de90 TL |
139 | } } |
140 | ||
92f5a8d4 | 141 | #endif |