~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to 3rd_party/glm/glm/core/_vectorize.hpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
///////////////////////////////////////////////////////////////////////////////////
2
 
/// OpenGL Mathematics (glm.g-truc.net)
3
 
///
4
 
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
 
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
 
/// of this software and associated documentation files (the "Software"), to deal
7
 
/// in the Software without restriction, including without limitation the rights
8
 
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 
/// copies of the Software, and to permit persons to whom the Software is
10
 
/// furnished to do so, subject to the following conditions:
11
 
/// 
12
 
/// The above copyright notice and this permission notice shall be included in
13
 
/// all copies or substantial portions of the Software.
14
 
/// 
15
 
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 
/// THE SOFTWARE.
22
 
///
23
 
/// @ref core
24
 
/// @file glm/core/_vectorize.hpp
25
 
/// @date 2011-10-14 / 2011-10-14
26
 
/// @author Christophe Riccio
27
 
///////////////////////////////////////////////////////////////////////////////////
28
 
 
29
 
#define VECTORIZE2_VEC(func) \
30
 
    template <typename T> \
31
 
    GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
32
 
                detail::tvec2<T> const & v) \
33
 
    { \
34
 
        return detail::tvec2<T>( \
35
 
            func(v.x), \
36
 
            func(v.y)); \
37
 
    }
38
 
 
39
 
#define VECTORIZE3_VEC(func) \
40
 
    template <typename T> \
41
 
    GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
42
 
                detail::tvec3<T> const & v) \
43
 
    { \
44
 
        return detail::tvec3<T>( \
45
 
            func(v.x), \
46
 
            func(v.y), \
47
 
            func(v.z)); \
48
 
    }
49
 
 
50
 
#define VECTORIZE4_VEC(func) \
51
 
    template <typename T> \
52
 
    GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
53
 
                detail::tvec4<T> const & v) \
54
 
    { \
55
 
        return detail::tvec4<T>( \
56
 
            func(v.x), \
57
 
            func(v.y), \
58
 
            func(v.z), \
59
 
            func(v.w)); \
60
 
    }
61
 
 
62
 
#define VECTORIZE_VEC(func) \
63
 
        VECTORIZE2_VEC(func) \
64
 
        VECTORIZE3_VEC(func) \
65
 
        VECTORIZE4_VEC(func)
66
 
 
67
 
#define VECTORIZE2_VEC_SCA(func) \
68
 
    template <typename T> \
69
 
    GLM_FUNC_QUALIFIER detail::tvec2<T> func \
70
 
        ( \
71
 
                detail::tvec2<T> const & x,  \
72
 
                typename detail::tvec2<T>::value_type const & y \
73
 
        ) \
74
 
    { \
75
 
        return detail::tvec2<T>( \
76
 
            func(x.x, y), \
77
 
            func(x.y, y)); \
78
 
    }
79
 
 
80
 
#define VECTORIZE3_VEC_SCA(func) \
81
 
    template <typename T> \
82
 
    GLM_FUNC_QUALIFIER detail::tvec3<T> func \
83
 
        ( \
84
 
                detail::tvec3<T> const & x,  \
85
 
                typename detail::tvec3<T>::value_type const & y \
86
 
        ) \
87
 
    { \
88
 
        return detail::tvec3<T>( \
89
 
            func(x.x, y), \
90
 
            func(x.y, y), \
91
 
            func(x.z, y)); \
92
 
    }
93
 
 
94
 
#define VECTORIZE4_VEC_SCA(func) \
95
 
    template <typename T> \
96
 
    GLM_FUNC_QUALIFIER detail::tvec4<T> func \
97
 
        ( \
98
 
                detail::tvec4<T> const & x,  \
99
 
                typename detail::tvec4<T>::value_type const & y \
100
 
        ) \
101
 
    { \
102
 
        return detail::tvec4<T>( \
103
 
            func(x.x, y), \
104
 
            func(x.y, y), \
105
 
            func(x.z, y), \
106
 
            func(x.w, y)); \
107
 
    }
108
 
 
109
 
#define VECTORIZE_VEC_SCA(func) \
110
 
        VECTORIZE2_VEC_SCA(func) \
111
 
        VECTORIZE3_VEC_SCA(func) \
112
 
        VECTORIZE4_VEC_SCA(func)
113
 
 
114
 
#define VECTORIZE2_VEC_VEC(func) \
115
 
    template <typename T> \
116
 
    GLM_FUNC_QUALIFIER detail::tvec2<T> func \
117
 
        ( \
118
 
                detail::tvec2<T> const & x,  \
119
 
                detail::tvec2<T> const & y \
120
 
        ) \
121
 
    { \
122
 
        return detail::tvec2<T>( \
123
 
            func(x.x, y.x), \
124
 
            func(x.y, y.y)); \
125
 
    }
126
 
 
127
 
#define VECTORIZE3_VEC_VEC(func) \
128
 
    template <typename T> \
129
 
    GLM_FUNC_QUALIFIER detail::tvec3<T> func \
130
 
        ( \
131
 
                detail::tvec3<T> const & x,  \
132
 
                detail::tvec3<T> const & y \
133
 
        ) \
134
 
    { \
135
 
        return detail::tvec3<T>( \
136
 
            func(x.x, y.x), \
137
 
            func(x.y, y.y), \
138
 
            func(x.z, y.z)); \
139
 
    }
140
 
 
141
 
#define VECTORIZE4_VEC_VEC(func) \
142
 
    template <typename T> \
143
 
    GLM_FUNC_QUALIFIER detail::tvec4<T> func \
144
 
        ( \
145
 
                detail::tvec4<T> const & x,  \
146
 
                detail::tvec4<T> const & y \
147
 
        ) \
148
 
    { \
149
 
        return detail::tvec4<T>( \
150
 
            func(x.x, y.x), \
151
 
            func(x.y, y.y), \
152
 
            func(x.z, y.z), \
153
 
            func(x.w, y.w)); \
154
 
    }
155
 
 
156
 
#define VECTORIZE_VEC_VEC(func) \
157
 
        VECTORIZE2_VEC_VEC(func) \
158
 
        VECTORIZE3_VEC_VEC(func) \
159
 
        VECTORIZE4_VEC_VEC(func)