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