00001 #ifndef GLM_EXT_VIRTREV_XSTREAM_HPP
00002 #define GLM_EXT_VIRTREV_XSTREAM_HPP
00003
00005
00006
00008
00009
00010
00011
00013
00014
00015
00017
00018 #include "../glm.hpp"
00019 #include "../gtx/matrix_selection.hpp"
00020 #include <iostream>
00021
00022 namespace glm
00023 {
00024 namespace virtrev_glmext
00025 {
00027 namespace xstream
00028 {
00029 template<typename T>
00030 std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T> const & vec)
00031 {
00032 stream << "<glm_vec2 ";
00033 stream << "x=\"" << vec.x << "\" ";
00034 stream << "y=\"" << vec.y << "\" ";
00035 stream << "/>";
00036
00037 return stream;
00038 }
00039
00040 template<typename T>
00041 std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T> const & vec)
00042 {
00043 stream << "<glm_vec3 ";
00044 stream << "x=\"" << vec.x << "\" ";
00045 stream << "y=\"" << vec.y << "\" ";
00046 stream << "z=\"" << vec.z << "\" ";
00047 stream << "/>";
00048
00049 return stream;
00050 }
00051
00052 template<typename T>
00053 std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T> const & vec)
00054 {
00055 stream << "<glm_vec4 ";
00056 stream << "x=\"" << vec.x << "\" ";
00057 stream << "y=\"" << vec.y << "\" ";
00058 stream << "z=\"" << vec.z << "\" ";
00059 stream << "w=\"" << vec.w << "\" ";
00060 stream << "/>";
00061
00062 return stream;
00063 }
00064
00065 template<typename T>
00066 std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T> const & mat)
00067 {
00068 stream << "<glm_mat2>" << std::endl;
00069 stream << "<row ";
00070 stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
00071 stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
00072 stream << "/>" << std::endl;
00073 stream << "<row ";
00074 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00075 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00076 stream << "/>" << std::endl;
00077 stream << "</glm_mat2>";
00078
00079 return stream;
00080 }
00081
00082 template<typename T>
00083 std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T> const & mat)
00084 {
00085 stream << "<glm_mat3>" << std::endl;
00086 stream << "<row ";
00087 stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
00088 stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
00089 stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
00090 stream << "/>" << std::endl;
00091 stream << "<row ";
00092 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00093 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00094 stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
00095 stream << "/>" << std::endl;
00096 stream << "<row ";
00097 stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
00098 stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
00099 stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
00100 stream << "/>" << std::endl;
00101 stream << "</glm_mat3>";
00102
00103 return stream;
00104 }
00105
00106 template<typename T>
00107 std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T> const & mat)
00108 {
00109 stream << "<glm_mat4>" << std::endl;
00110 stream << "<row ";
00111 stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
00112 stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
00113 stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
00114 stream << "w=\"" << glm::row(mat, 0)[3] << "\" ";
00115 stream << "/>" << std::endl;
00116 stream << "<row ";
00117 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00118 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00119 stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
00120 stream << "w=\"" << glm::row(mat, 1)[3] << "\" ";
00121 stream << "/>" << std::endl;
00122 stream << "<row ";
00123 stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
00124 stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
00125 stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
00126 stream << "w=\"" << glm::row(mat, 2)[3] << "\" ";
00127 stream << "/>" << std::endl;
00128 stream << "<row ";
00129 stream << "x=\"" << glm::row(mat, 3)[0] << "\" ";
00130 stream << "y=\"" << glm::row(mat, 3)[1] << "\" ";
00131 stream << "z=\"" << glm::row(mat, 3)[2] << "\" ";
00132 stream << "w=\"" << glm::row(mat, 3)[3] << "\" ";
00133 stream << "/>" << std::endl;
00134 stream << "</glm_mat3>";
00135
00136 return stream;
00137 }
00138 }
00139 }
00140 }
00141
00142 #define GLM_VIRTREV_xstream namespace glm::virtrev_glmext::xstream
00143 #ifndef GLM_VIRTREV_GLOBAL
00144 namespace glm {using GLM_VIRTREV_xstream;}
00145 #endif//GLM_VIRTREV_GLOBAL
00146
00147 #endif