|
|
|
@ -30,8 +30,13 @@ |
|
|
|
|
/// @author Jan P Springer (regnirpsj@gmail.com) |
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
|
|
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw |
|
|
|
|
#include <iomanip> // std::fixed, std::setfill<>, std::setprecision, std::right, std::setw |
|
|
|
|
#include <ostream> // std::basic_ostream<> |
|
|
|
|
#include "../gtc/matrix_access.hpp" // glm::col, glm::row |
|
|
|
|
|
|
|
|
|
#if !defined(GLM_META_PROG_HELPERS) |
|
|
|
|
# pragma error("Please define 'GLM_META_PROG_HELPERS' before using GLM_GTX_io") |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
namespace glm{ |
|
|
|
|
namespace io |
|
|
|
@ -48,7 +53,7 @@ namespace io |
|
|
|
|
delim_right (']'), |
|
|
|
|
space (' '), |
|
|
|
|
newline ('\n'), |
|
|
|
|
order (row_major) |
|
|
|
|
order (column_major) |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
template <typename CTy> |
|
|
|
@ -117,8 +122,7 @@ namespace io |
|
|
|
|
value[2] = c; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* explicit */ GLM_FUNC_QUALIFIER |
|
|
|
|
order::order(order_type a) |
|
|
|
|
/* explicit */ GLM_FUNC_QUALIFIER order::order(order_type a) |
|
|
|
|
: value(a) |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
@ -165,7 +169,7 @@ namespace io |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr> |
|
|
|
|
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, delimeter<CTy> const& a) |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, delimeter<CTy> const& a) |
|
|
|
|
{ |
|
|
|
|
format_punct<CTy> & fmt(const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os))); |
|
|
|
|
|
|
|
|
@ -185,8 +189,11 @@ namespace io |
|
|
|
|
} |
|
|
|
|
} // namespace io |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a) |
|
|
|
|
namespace detail { |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, template <typename, precision> class V, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
|
|
|
|
print_vector_on(std::basic_ostream<CTy,CTr>& os, V<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
@ -202,85 +209,66 @@ namespace io |
|
|
|
|
<< std::right |
|
|
|
|
<< std::setprecision(fmt.precision) |
|
|
|
|
<< std::setfill(fmt.space) |
|
|
|
|
<< fmt.delim_left |
|
|
|
|
<< std::setw(fmt.width) << a.w << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.x << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.y << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.z |
|
|
|
|
<< fmt.delim_right; |
|
|
|
|
<< fmt.delim_left; |
|
|
|
|
|
|
|
|
|
for (unsigned i(0); i < V<T,P>::components; ++i) { |
|
|
|
|
os << std::setw(fmt.width) << a[i]; |
|
|
|
|
|
|
|
|
|
if (V<T,P>::components-1 != i) { os << fmt.separator; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
os << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z; |
|
|
|
|
for (unsigned i(0); i < V<T,P>::components; ++i) { |
|
|
|
|
os << a[i]; |
|
|
|
|
|
|
|
|
|
if (V<T,P>::components-1 != i) { os << fmt.space; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec1<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
io::basic_state_saver<CTy> const bss(os); |
|
|
|
|
|
|
|
|
|
os << std::fixed |
|
|
|
|
<< std::right |
|
|
|
|
<< std::setprecision(fmt.precision) |
|
|
|
|
<< std::setfill(fmt.space) |
|
|
|
|
<< fmt.delim_left |
|
|
|
|
<< std::setw(fmt.width) << a.x |
|
|
|
|
<< fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
os << a.x; |
|
|
|
|
} |
|
|
|
|
return detail::print_vector_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec1<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
return detail::print_vector_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec2<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
return detail::print_vector_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
io::basic_state_saver<CTy> const bss(os); |
|
|
|
|
|
|
|
|
|
os << std::fixed |
|
|
|
|
<< std::right |
|
|
|
|
<< std::setprecision(fmt.precision) |
|
|
|
|
<< std::setfill(fmt.space) |
|
|
|
|
<< fmt.delim_left |
|
|
|
|
<< std::setw(fmt.width) << a.x << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.y |
|
|
|
|
<< fmt.delim_right; |
|
|
|
|
return detail::print_vector_on(os, a); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
os << a.x << fmt.space << a.y; |
|
|
|
|
} |
|
|
|
|
return detail::print_vector_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
namespace detail { |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a) |
|
|
|
|
template <typename CTy, typename CTr, template <typename, precision> class M, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
|
|
|
|
print_matrix_on(std::basic_ostream<CTy,CTr>& os, M<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
@ -288,369 +276,187 @@ namespace io |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
if(fmt.formatted) { |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left; |
|
|
|
|
|
|
|
|
|
switch (fmt.order) { |
|
|
|
|
case io::column_major: |
|
|
|
|
{ |
|
|
|
|
io::basic_state_saver<CTy> const bss(os); |
|
|
|
|
for (unsigned i(0); i < M<T,P>::rows; ++i) { |
|
|
|
|
if (0 != i) { os << fmt.space; } |
|
|
|
|
|
|
|
|
|
os << std::fixed |
|
|
|
|
<< std::right |
|
|
|
|
<< std::setprecision(fmt.precision) |
|
|
|
|
<< std::setfill(fmt.space) |
|
|
|
|
<< fmt.delim_left |
|
|
|
|
<< std::setw(fmt.width) << a.x << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.y << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.z |
|
|
|
|
<< fmt.delim_right; |
|
|
|
|
os << row(a, i); |
|
|
|
|
|
|
|
|
|
if (M<T,P>::rows-1 != i) { os << fmt.newline; } |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case io::row_major: |
|
|
|
|
{ |
|
|
|
|
os << a.x << fmt.space << a.y << fmt.space << a.z; |
|
|
|
|
for (unsigned i(0); i < M<T,P>::cols; ++i) { |
|
|
|
|
if (0 != i) { os << fmt.space; } |
|
|
|
|
|
|
|
|
|
os << column(a, i); |
|
|
|
|
|
|
|
|
|
if (M<T,P>::cols-1 != i) { os << fmt.newline; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a) |
|
|
|
|
os << fmt.delim_right; |
|
|
|
|
} else { |
|
|
|
|
switch (fmt.order) { |
|
|
|
|
case io::column_major: |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
for (unsigned i(0); i < M<T,P>::cols; ++i) { |
|
|
|
|
os << column(a, i); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
if (M<T,P>::cols-1 != i) { os << fmt.space; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
case io::row_major: |
|
|
|
|
{ |
|
|
|
|
io::basic_state_saver<CTy> const bss(os); |
|
|
|
|
for (unsigned i(0); i < M<T,P>::rows; ++i) { |
|
|
|
|
os << row(a, i); |
|
|
|
|
|
|
|
|
|
os << std::fixed |
|
|
|
|
<< std::right |
|
|
|
|
<< std::setprecision(fmt.precision) |
|
|
|
|
<< std::setfill(fmt.space) |
|
|
|
|
<< fmt.delim_left |
|
|
|
|
<< std::setw(fmt.width) << a.x << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.y << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.z << fmt.separator |
|
|
|
|
<< std::setw(fmt.width) << a.w |
|
|
|
|
<< fmt.delim_right; |
|
|
|
|
if (M<T,P>::rows-1 != i) { os << fmt.space; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat2x2<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat3x2<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat4x2<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.newline |
|
|
|
|
<< fmt.space << m[3] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat2x3<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat3x3<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat4x3<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if (fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.newline |
|
|
|
|
<< fmt.space << m[3] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat2x4<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if (fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat3x4<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.delim_right; |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a) |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2]; |
|
|
|
|
} |
|
|
|
|
return detail::print_matrix_on(os, a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
namespace detail { |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a) |
|
|
|
|
template <typename CTy, typename CTr, template <typename, precision> class M, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
|
|
|
|
print_matrix_pair_on(std::basic_ostream<CTy,CTr>& os, std::pair<M<T,P> const, M<T,P> const> const& a) |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat4x4<T,P> m(a); |
|
|
|
|
|
|
|
|
|
if (io::row_major == fmt.order) |
|
|
|
|
m = transpose(a); |
|
|
|
|
M<T,P> const& ml(a.first); |
|
|
|
|
M<T,P> const& mr(a.second); |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
{ |
|
|
|
|
if(fmt.formatted) { |
|
|
|
|
os << fmt.newline |
|
|
|
|
<< fmt.delim_left << m[0] << fmt.newline |
|
|
|
|
<< fmt.space << m[1] << fmt.newline |
|
|
|
|
<< fmt.space << m[2] << fmt.newline |
|
|
|
|
<< fmt.space << m[3] << fmt.delim_right; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
<< fmt.delim_left; |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<( |
|
|
|
|
std::basic_ostream<CTy,CTr> & os, |
|
|
|
|
std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const& a) |
|
|
|
|
switch (fmt.order) { |
|
|
|
|
case io::column_major: |
|
|
|
|
{ |
|
|
|
|
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
|
|
|
|
for (unsigned i(0); i < M<T,P>::rows; ++i) { |
|
|
|
|
if (0 != i) { os << fmt.space; } |
|
|
|
|
|
|
|
|
|
if(cerberus) |
|
|
|
|
{ |
|
|
|
|
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); |
|
|
|
|
tmat4x4<T,P> ml(a.first); |
|
|
|
|
tmat4x4<T,P> mr(a.second); |
|
|
|
|
os << row(ml, i) |
|
|
|
|
<< ((M<T,P>::rows-1 != i) ? fmt.space : fmt.delim_right) |
|
|
|
|
<< fmt.space |
|
|
|
|
<< ((0 != i) ? fmt.space : fmt.delim_left) |
|
|
|
|
<< row(mr, i); |
|
|
|
|
|
|
|
|
|
if(io::row_major == fmt.order) |
|
|
|
|
{ |
|
|
|
|
ml = transpose(a.first); |
|
|
|
|
mr = transpose(a.second); |
|
|
|
|
if (M<T,P>::rows-1 != i) { os << fmt.newline; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
if(fmt.formatted) |
|
|
|
|
case io::row_major: |
|
|
|
|
{ |
|
|
|
|
CTy const & l(fmt.delim_left); |
|
|
|
|
CTy const & r(fmt.delim_right); |
|
|
|
|
CTy const & s(fmt.space); |
|
|
|
|
for (unsigned i(0); i < M<T,P>::cols; ++i) { |
|
|
|
|
if (0 != i) { os << fmt.space; } |
|
|
|
|
|
|
|
|
|
os << fmt.newline |
|
|
|
|
<< l << ml[0] << s << s << l << mr[0] << fmt.newline |
|
|
|
|
<< s << ml[1] << s << s << s << mr[1] << fmt.newline |
|
|
|
|
<< s << ml[2] << s << s << s << mr[2] << fmt.newline |
|
|
|
|
<< s << ml[3] << r << s << s << mr[3] << r; |
|
|
|
|
os << column(ml, i) |
|
|
|
|
<< ((M<T,P>::cols-1 != i) ? fmt.space : fmt.delim_right) |
|
|
|
|
<< fmt.space |
|
|
|
|
<< ((0 != i) ? fmt.space : fmt.delim_left) |
|
|
|
|
<< column(mr, i); |
|
|
|
|
|
|
|
|
|
if (M<T,P>::cols-1 != i) { os << fmt.newline; } |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
os << fmt.delim_right; |
|
|
|
|
} else { |
|
|
|
|
os << ml << fmt.space << mr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return os; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename CTy, typename CTr, typename T, precision P> |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<( |
|
|
|
|
std::basic_ostream<CTy,CTr> & os, |
|
|
|
|
std::pair<tmat4x4<T,P>, tmat4x4<T,P> > const& a) |
|
|
|
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr> & os, |
|
|
|
|
std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const& a) |
|
|
|
|
{ |
|
|
|
|
return operator<<(os, static_cast<std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const&>(a)); |
|
|
|
|
return detail::print_matrix_pair_on(os, a); |
|
|
|
|
} |
|
|
|
|
}//namespace glm |
|
|
|
|