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 namespace detail
00052 {
00053         template<typename T>
00054         std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T> const & vec)
00055         {
00056                 stream << "<glm_vec2 ";
00057                 stream << "x=\"" << vec.x << "\" ";
00058                 stream << "y=\"" << vec.y << "\" ";
00059                 stream << "/>";
00060 
00061                 return stream;
00062         }
00063 
00064         template<typename T>
00065         std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T> const & vec)
00066         {
00067                 stream << "<glm_vec3 ";
00068                 stream << "x=\"" << vec.x << "\" ";
00069                 stream << "y=\"" << vec.y << "\" ";
00070                 stream << "z=\"" << vec.z << "\" ";
00071                 stream << "/>";
00072 
00073                 return stream;
00074         }
00075 
00076         template<typename T>
00077         std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T> const & vec)
00078         {
00079                 stream << "<glm_vec4 ";
00080                 stream << "x=\"" << vec.x << "\" ";
00081                 stream << "y=\"" << vec.y << "\" ";
00082                 stream << "z=\"" << vec.z << "\" ";
00083                 stream << "w=\"" << vec.w << "\" ";
00084                 stream << "/>";
00085 
00086                 return stream;
00087         }
00088 
00089         template<typename T>
00090         std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T> const & mat)
00091         {
00092                 stream << "<glm_mat2>" << std::endl;
00093                 stream << "<row ";
00094                 stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
00095                 stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
00096                 stream << "/>" << std::endl;
00097                 stream << "<row ";
00098                 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00099                 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00100                 stream << "/>" << std::endl;
00101                 stream << "</glm_mat2>";
00102 
00103                 return stream;
00104         }
00105 
00106         template<typename T>
00107         std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T> const & mat)
00108         {
00109                 stream << "<glm_mat3>" << 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 << "/>" << std::endl;
00115                 stream << "<row ";
00116                 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00117                 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00118                 stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
00119                 stream << "/>" << std::endl;
00120                 stream << "<row ";
00121                 stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
00122                 stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
00123                 stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
00124                 stream << "/>" << std::endl;
00125                 stream << "</glm_mat3>";
00126 
00127                 return stream;
00128         }
00129 
00130         template<typename T>
00131         std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T> const & mat)
00132         {
00133                 stream << "<glm_mat4>" << std::endl;
00134                 stream << "<row ";
00135                 stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
00136                 stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
00137                 stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
00138                 stream << "w=\"" << glm::row(mat, 0)[3] << "\" ";
00139                 stream << "/>" << std::endl;
00140                 stream << "<row ";
00141                 stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
00142                 stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
00143                 stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
00144                 stream << "w=\"" << glm::row(mat, 1)[3] << "\" ";
00145                 stream << "/>" << std::endl;
00146                 stream << "<row ";
00147                 stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
00148                 stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
00149                 stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
00150                 stream << "w=\"" << glm::row(mat, 2)[3] << "\" ";
00151                 stream << "/>" << std::endl;
00152                 stream << "<row ";
00153                 stream << "x=\"" << glm::row(mat, 3)[0] << "\" ";
00154                 stream << "y=\"" << glm::row(mat, 3)[1] << "\" ";
00155                 stream << "z=\"" << glm::row(mat, 3)[2] << "\" ";
00156                 stream << "w=\"" << glm::row(mat, 3)[3] << "\" ";
00157                 stream << "/>" << std::endl;
00158                 stream << "</glm_mat4>";
00159                         
00160                 return stream;
00161         }
00162 
00163 }//namespace detail
00164 }//namespace glm
00165 
00166 #endif//GLM_VIRTREV_xstream