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