Equalizer  1.9.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vmmlib.h
1 
2 /* Copyright (c) 2011-2014, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_VMMLIB_H
19 #define EQFABRIC_VMMLIB_H
20 
21 #define VMMLIB_CUSTOM_CONFIG
22 #ifndef NDEBUG
23 # define VMMLIB_SAFE_ACCESSORS
24 #endif
25 #define VMMLIB_ALIGN( var ) var
26 
27 #pragma warning(push)
28 #pragma warning(disable : 4996)
29 # include <vmmlib/vmmlib.hpp>
30 #pragma warning(pop)
31 
32 #include <lunchbox/bitOperation.h>
33 
34 namespace eq
35 {
36 namespace fabric
37 {
38 using vmml::Matrix3d;
39 using vmml::Matrix4d;
40 using vmml::Matrix3f;
41 using vmml::Matrix4f;
42 using vmml::Vector2ui;
43 using vmml::Vector2i;
44 using vmml::Vector3ui;
45 using vmml::Vector3i;
46 using vmml::Vector4ui;
47 using vmml::Vector4i;
48 using vmml::Vector3d;
49 using vmml::Vector4d;
50 using vmml::Vector2f;
51 using vmml::Vector3f;
52 using vmml::Vector4f;
53 using vmml::Vector3ub;
54 using vmml::Vector4ub;
55 using vmml::Frustumf;
56 using vmml::AABBf;
57 }
58 }
59 
60 namespace lunchbox
61 {
62 template<> inline void byteswap( eq::fabric::Vector2ui& value )
63 {
64  byteswap( value.x( ));
65  byteswap( value.y( ));
66 }
67 
68 template<> inline void byteswap( eq::fabric::Vector2i& value )
69 {
70  byteswap( value.x( ));
71  byteswap( value.y( ));
72 }
73 
74 template<> inline void byteswap( eq::fabric::Vector2f& value )
75 {
76  byteswap( value.x( ));
77  byteswap( value.y( ));
78 }
79 
80 template<> inline void byteswap( eq::fabric::Vector3f& value )
81 {
82  byteswap( value.x( ));
83  byteswap( value.y( ));
84  byteswap( value.z( ));
85 }
86 
87 template<> inline void byteswap( eq::fabric::Vector4f& value )
88 {
89  byteswap( value.x( ));
90  byteswap( value.y( ));
91  byteswap( value.z( ));
92  byteswap( value.w( ));
93 }
94 
95 template<> inline void byteswap( eq::fabric::Vector4ui& value )
96 {
97  byteswap( value.x( ));
98  byteswap( value.y( ));
99  byteswap( value.z( ));
100  byteswap( value.w( ));
101 }
102 
103 template<> inline void byteswap( eq::fabric::Vector4i& value )
104 {
105  byteswap( value.x( ));
106  byteswap( value.y( ));
107  byteswap( value.z( ));
108  byteswap( value.w( ));
109 }
110 
111 template<> inline void byteswap( eq::fabric::Vector4ub& ) { /*NOP*/ }
112 template<> inline void byteswap( eq::fabric::Vector3ub& ) { /*NOP*/ }
113 
114 template<> inline void byteswap( eq::fabric::Matrix4f& value )
115 {
116  for( size_t i = 0; i < 16; ++i )
117  byteswap( value.array[ i ]);
118 }
119 
120 template<> inline void byteswap( eq::fabric::Frustumf& value )
121 {
122  byteswap( value.left( ));
123  byteswap( value.right( ));
124  byteswap( value.bottom( ));
125  byteswap( value.top( ));
126  byteswap( value.near_plane( ));
127  byteswap( value.far_plane( ));
128 }
129 
130 template<> inline void byteswap( eq::fabric::AABBf& value )
131 {
132  byteswap( value.getMin( ));
133  byteswap( value.getMax( ));
134 }
135 }
136 
137 #endif // EQFABRIC_VMMLIB_H