Line data Source code
1 :
2 : /* Copyright (c) 2011-2012, 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 : typedef vmml::matrix< 3, 3, double > Matrix3d; //!< A 3x3 double matrix
39 : typedef vmml::matrix< 4, 4, double > Matrix4d; //!< A 4x4 double matrix
40 : typedef vmml::matrix< 3, 3, float > Matrix3f; //!< A 3x3 float matrix
41 : typedef vmml::matrix< 4, 4, float > Matrix4f; //!< A 4x4 float matrix
42 : typedef vmml::vector< 2, int > Vector2i; //!< A two-component integer vector
43 : typedef vmml::vector< 3, int > Vector3i; //!< A three-component integer vector
44 : typedef vmml::vector< 4, int > Vector4i; //!< A four-component integer vector
45 : typedef vmml::vector< 3, double >Vector3d; //!< A three-component double vector
46 : typedef vmml::vector< 4, double >Vector4d; //!< A four-component double vector
47 : typedef vmml::vector< 2, float > Vector2f; //!< A two-component float vector
48 : typedef vmml::vector< 3, float > Vector3f; //!< A three-component float vector
49 : typedef vmml::vector< 4, float > Vector4f; //!< A four-component float vector
50 : typedef vmml::vector< 3, uint8_t > Vector3ub; //!< A three-component byte vector
51 : typedef vmml::vector< 4, uint8_t > Vector4ub; //!< A four-component byte vector
52 : typedef vmml::frustum< float > Frustumf; //!< A frustum definition
53 : }
54 : }
55 :
56 : namespace lunchbox
57 : {
58 0 : template<> inline void byteswap( eq::fabric::Vector2i& value )
59 : {
60 0 : byteswap( value.x( ));
61 0 : byteswap( value.y( ));
62 0 : }
63 :
64 0 : template<> inline void byteswap( eq::fabric::Vector2f& value )
65 : {
66 0 : byteswap( value.x( ));
67 0 : byteswap( value.y( ));
68 0 : }
69 :
70 0 : template<> inline void byteswap( eq::fabric::Vector3f& value )
71 : {
72 0 : byteswap( value.x( ));
73 0 : byteswap( value.y( ));
74 0 : byteswap( value.z( ));
75 0 : }
76 :
77 : template<> inline void byteswap( eq::fabric::Vector4f& value )
78 : {
79 : byteswap( value.x( ));
80 : byteswap( value.y( ));
81 : byteswap( value.z( ));
82 : byteswap( value.w( ));
83 : }
84 :
85 0 : template<> inline void byteswap( eq::fabric::Vector4i& value )
86 : {
87 0 : byteswap( value.x( ));
88 0 : byteswap( value.y( ));
89 0 : byteswap( value.z( ));
90 0 : byteswap( value.w( ));
91 0 : }
92 :
93 : template<> inline void byteswap( eq::fabric::Vector4ub& ) { /*NOP*/ }
94 : template<> inline void byteswap( eq::fabric::Vector3ub& ) { /*NOP*/ }
95 :
96 0 : template<> inline void byteswap( eq::fabric::Matrix4f& value )
97 : {
98 0 : for( size_t i = 0; i < 16; ++i )
99 0 : byteswap( value.array[ i ]);
100 0 : }
101 :
102 0 : template<> inline void byteswap( eq::fabric::Frustumf& value )
103 : {
104 0 : byteswap( value.left( ));
105 0 : byteswap( value.right( ));
106 0 : byteswap( value.bottom( ));
107 0 : byteswap( value.top( ));
108 0 : byteswap( value.near_plane( ));
109 0 : byteswap( value.far_plane( ));
110 0 : }
111 : }
112 :
113 : #endif // EQFABRIC_VMMLIB_H
|