1
///////////////////////////////////////////////////////////////////////////////////
2
/// OpenGL Mathematics (glm.g-truc.net)
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:
12
/// The above copyright notice and this permission notice shall be included in
13
/// all copies or substantial portions of the Software.
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
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)
28
/// @see core (dependence)
29
/// @see gtc_matrix_access (dependence)
31
/// @defgroup virtrev_xstream GLM_VIRTREV_xstream: xml like output
34
/// @brief Streaming vector and matrix in a xml way.
36
/// Include <glm/virtrev/xstream.hpp> for this functionality.
37
///////////////////////////////////////////////////////////////////////////////////
39
#ifndef GLM_VIRTREV_xstream
40
#define GLM_VIRTREV_xstream GLM_VERSION
43
#include "../gtc/matrix_access.hpp"
46
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
47
# pragma message("GLM: GLM_VIRTREV_xstream extension included")
54
std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T> const & vec)
56
stream << "<glm_vec2 ";
57
stream << "x=\"" << vec.x << "\" ";
58
stream << "y=\"" << vec.y << "\" ";
65
std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T> const & vec)
67
stream << "<glm_vec3 ";
68
stream << "x=\"" << vec.x << "\" ";
69
stream << "y=\"" << vec.y << "\" ";
70
stream << "z=\"" << vec.z << "\" ";
77
std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T> const & vec)
79
stream << "<glm_vec4 ";
80
stream << "x=\"" << vec.x << "\" ";
81
stream << "y=\"" << vec.y << "\" ";
82
stream << "z=\"" << vec.z << "\" ";
83
stream << "w=\"" << vec.w << "\" ";
90
std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T> const & mat)
92
stream << "<glm_mat2>" << std::endl;
94
stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
95
stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
96
stream << "/>" << std::endl;
98
stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
99
stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
100
stream << "/>" << std::endl;
101
stream << "</glm_mat2>";
107
std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T> const & mat)
109
stream << "<glm_mat3>" << std::endl;
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;
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;
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>";
131
std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T> const & mat)
133
stream << "<glm_mat4>" << std::endl;
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;
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;
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;
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>";
166
#endif//GLM_VIRTREV_xstream