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

« back to all changes in this revision

Viewing changes to 3rd_party/glm/glm/virtrev/xstream.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 virtrev_xstream
24
 
/// @file glm/virtrev/xstream.hpp
25
 
/// @date 2008-05-24 / 2008-05-26
26
 
/// @author Mathieu Roumillac (matrem84.free.fr)
27
 
///
28
 
/// @see core (dependence)
29
 
/// @see gtc_matrix_access (dependence)
30
 
///
31
 
/// @defgroup virtrev_xstream GLM_VIRTREV_xstream: xml like output
32
 
/// @ingroup virtrev
33
 
/// 
34
 
/// @brief Streaming vector and matrix in a xml way.
35
 
/// 
36
 
/// Include <glm/virtrev/xstream.hpp> for this functionality.
37
 
///////////////////////////////////////////////////////////////////////////////////
38
 
 
39
 
#ifndef GLM_VIRTREV_xstream
40
 
#define GLM_VIRTREV_xstream GLM_VERSION
41
 
 
42
 
#include "../glm.hpp"
43
 
#include "../gtc/matrix_access.hpp"
44
 
#include <iostream>
45
 
 
46
 
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
47
 
#       pragma message("GLM: GLM_VIRTREV_xstream extension included")
48
 
#endif
49
 
/*
50
 
namespace glm{
51
 
namespace detail
52
 
{
53
 
        template<typename T>
54
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T> const & vec)
55
 
        {
56
 
                stream << "<glm_vec2 ";
57
 
                stream << "x=\"" << vec.x << "\" ";
58
 
                stream << "y=\"" << vec.y << "\" ";
59
 
                stream << "/>";
60
 
 
61
 
                return stream;
62
 
        }
63
 
 
64
 
        template<typename T>
65
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T> const & vec)
66
 
        {
67
 
                stream << "<glm_vec3 ";
68
 
                stream << "x=\"" << vec.x << "\" ";
69
 
                stream << "y=\"" << vec.y << "\" ";
70
 
                stream << "z=\"" << vec.z << "\" ";
71
 
                stream << "/>";
72
 
 
73
 
                return stream;
74
 
        }
75
 
 
76
 
        template<typename T>
77
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T> const & vec)
78
 
        {
79
 
                stream << "<glm_vec4 ";
80
 
                stream << "x=\"" << vec.x << "\" ";
81
 
                stream << "y=\"" << vec.y << "\" ";
82
 
                stream << "z=\"" << vec.z << "\" ";
83
 
                stream << "w=\"" << vec.w << "\" ";
84
 
                stream << "/>";
85
 
 
86
 
                return stream;
87
 
        }
88
 
 
89
 
        template<typename T>
90
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T> const & mat)
91
 
        {
92
 
                stream << "<glm_mat2>" << std::endl;
93
 
                stream << "<row ";
94
 
                stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
95
 
                stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
96
 
                stream << "/>" << std::endl;
97
 
                stream << "<row ";
98
 
                stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
99
 
                stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
100
 
                stream << "/>" << std::endl;
101
 
                stream << "</glm_mat2>";
102
 
 
103
 
                return stream;
104
 
        }
105
 
 
106
 
        template<typename T>
107
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T> const & mat)
108
 
        {
109
 
                stream << "<glm_mat3>" << std::endl;
110
 
                stream << "<row ";
111
 
                stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
112
 
                stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
113
 
                stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
114
 
                stream << "/>" << std::endl;
115
 
                stream << "<row ";
116
 
                stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
117
 
                stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
118
 
                stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
119
 
                stream << "/>" << std::endl;
120
 
                stream << "<row ";
121
 
                stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
122
 
                stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
123
 
                stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
124
 
                stream << "/>" << std::endl;
125
 
                stream << "</glm_mat3>";
126
 
 
127
 
                return stream;
128
 
        }
129
 
 
130
 
        template<typename T>
131
 
        std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T> const & mat)
132
 
        {
133
 
                stream << "<glm_mat4>" << std::endl;
134
 
                stream << "<row ";
135
 
                stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
136
 
                stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
137
 
                stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
138
 
                stream << "w=\"" << glm::row(mat, 0)[3] << "\" ";
139
 
                stream << "/>" << std::endl;
140
 
                stream << "<row ";
141
 
                stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
142
 
                stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
143
 
                stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
144
 
                stream << "w=\"" << glm::row(mat, 1)[3] << "\" ";
145
 
                stream << "/>" << std::endl;
146
 
                stream << "<row ";
147
 
                stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
148
 
                stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
149
 
                stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
150
 
                stream << "w=\"" << glm::row(mat, 2)[3] << "\" ";
151
 
                stream << "/>" << std::endl;
152
 
                stream << "<row ";
153
 
                stream << "x=\"" << glm::row(mat, 3)[0] << "\" ";
154
 
                stream << "y=\"" << glm::row(mat, 3)[1] << "\" ";
155
 
                stream << "z=\"" << glm::row(mat, 3)[2] << "\" ";
156
 
                stream << "w=\"" << glm::row(mat, 3)[3] << "\" ";
157
 
                stream << "/>" << std::endl;
158
 
                stream << "</glm_mat4>";
159
 
                        
160
 
                return stream;
161
 
        }
162
 
 
163
 
}//namespace detail
164
 
}//namespace glm
165
 
*/
166
 
#endif//GLM_VIRTREV_xstream