commit
ae026e64d3
18 changed files with 998 additions and 241 deletions
@ -0,0 +1,224 @@ |
|||||||
|
/////////////////////////////////////////////////////////////////////////////////// |
||||||
|
/// OpenGL Mathematics (glm.g-truc.net) |
||||||
|
/// |
||||||
|
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) |
||||||
|
/// Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
/// of this software and associated documentation files (the "Software"), to deal |
||||||
|
/// in the Software without restriction, including without limitation the rights |
||||||
|
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
/// copies of the Software, and to permit persons to whom the Software is |
||||||
|
/// furnished to do so, subject to the following conditions: |
||||||
|
/// |
||||||
|
/// The above copyright notice and this permission notice shall be included in |
||||||
|
/// all copies or substantial portions of the Software. |
||||||
|
/// |
||||||
|
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||||
|
/// THE SOFTWARE. |
||||||
|
/// |
||||||
|
/// @ref core |
||||||
|
/// @file glm/core/func_exponential.inl |
||||||
|
/// @date 2008-08-03 / 2011-06-15 |
||||||
|
/// @author Christophe Riccio |
||||||
|
/////////////////////////////////////////////////////////////////////////////////// |
||||||
|
|
||||||
|
#include "func_vector_relational.hpp" |
||||||
|
#include "_vectorize.hpp" |
||||||
|
#include <limits> |
||||||
|
#include <cassert> |
||||||
|
|
||||||
|
namespace glm |
||||||
|
{ |
||||||
|
// pow |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType pow |
||||||
|
( |
||||||
|
genType const & x, |
||||||
|
genType const & y |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'pow' only accept floating-point inputs"); |
||||||
|
|
||||||
|
return std::pow(x, y); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC_VEC(pow) |
||||||
|
|
||||||
|
// exp |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType exp |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'exp' only accept floating-point inputs"); |
||||||
|
|
||||||
|
return std::exp(x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(exp) |
||||||
|
|
||||||
|
// log |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType log |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'log' only accept floating-point inputs"); |
||||||
|
|
||||||
|
return std::log(x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(log) |
||||||
|
|
||||||
|
//exp2, ln2 = 0.69314718055994530941723212145818f |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType exp2 |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'exp2' only accept floating-point inputs"); |
||||||
|
|
||||||
|
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(exp2) |
||||||
|
|
||||||
|
namespace detail |
||||||
|
{ |
||||||
|
template <bool isFloat> |
||||||
|
struct compute_log2 |
||||||
|
{ |
||||||
|
template <typename T> |
||||||
|
T operator() (T const & Value) const; |
||||||
|
}; |
||||||
|
|
||||||
|
template <> |
||||||
|
struct compute_log2<true> |
||||||
|
{ |
||||||
|
template <typename T> |
||||||
|
T operator() (T const & Value) const |
||||||
|
{ |
||||||
|
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
}//namespace detail |
||||||
|
|
||||||
|
// log2, ln2 = 0.69314718055994530941723212145818f |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType log2 |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, |
||||||
|
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support."); |
||||||
|
|
||||||
|
assert(x > genType(0)); // log2 is only defined on the range (0, inf] |
||||||
|
return detail::compute_log2<std::numeric_limits<genType>::is_iec559>()(x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(log2) |
||||||
|
|
||||||
|
// sqrt |
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType sqrt |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'sqrt' only accept floating-point inputs"); |
||||||
|
|
||||||
|
assert(x >= genType(0)); |
||||||
|
|
||||||
|
return std::sqrt(x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(sqrt) |
||||||
|
|
||||||
|
template <typename genType> |
||||||
|
GLM_FUNC_QUALIFIER genType inversesqrt |
||||||
|
( |
||||||
|
genType const & x |
||||||
|
) |
||||||
|
{ |
||||||
|
GLM_STATIC_ASSERT( |
||||||
|
std::numeric_limits<genType>::is_iec559, |
||||||
|
"'inversesqrt' only accept floating-point inputs"); |
||||||
|
|
||||||
|
assert(x > genType(0)); |
||||||
|
|
||||||
|
return genType(1) / std::sqrt(x); |
||||||
|
} |
||||||
|
|
||||||
|
VECTORIZE_VEC(inversesqrt) |
||||||
|
|
||||||
|
namespace detail |
||||||
|
{ |
||||||
|
template <typename genType, typename genUType> |
||||||
|
genType fastInversesqrt(genType const & v) |
||||||
|
{ |
||||||
|
genType tmp(v); |
||||||
|
genType xhalf(tmp * genType(0.5f)); |
||||||
|
genUType i = *reinterpret_cast<genUType*>(const_cast<genType*>(&v)); |
||||||
|
i = genUType(0x5f375a86) - (i >> genUType(1)); |
||||||
|
// tmp = *reinterpret_cast<genType*>(&i); |
||||||
|
{ |
||||||
|
genType* ptr(reinterpret_cast<genType*>(&i)); |
||||||
|
tmp = *ptr; |
||||||
|
} |
||||||
|
tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp); |
||||||
|
return tmp; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
template <> |
||||||
|
GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v) |
||||||
|
{ |
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec1(0)))); |
||||||
|
|
||||||
|
return detail::fastInversesqrt<lowp_vec1, uint>(v); |
||||||
|
} |
||||||
|
|
||||||
|
template <> |
||||||
|
GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v) |
||||||
|
{ |
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec2(0)))); |
||||||
|
|
||||||
|
return detail::fastInversesqrt<lowp_vec2, lowp_uvec2>(v); |
||||||
|
} |
||||||
|
|
||||||
|
template <> |
||||||
|
GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v) |
||||||
|
{ |
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec3(0)))); |
||||||
|
|
||||||
|
return detail::fastInversesqrt<lowp_vec3, lowp_uvec3>(v); |
||||||
|
} |
||||||
|
|
||||||
|
template <> |
||||||
|
GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v) |
||||||
|
{ |
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec4(0)))); |
||||||
|
|
||||||
|
return detail::fastInversesqrt<lowp_vec4, lowp_uvec4>(v); |
||||||
|
} |
||||||
|
|
||||||
|
}//namespace glm |
@ -1,328 +1,579 @@ |
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) |
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) |
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
||||||
// Created : 2013-11-22 |
// Created : 2013-11-22 |
||||||
// Updated : 2013-11-22 |
// Updated : 2013-12-18 |
||||||
// Licence : This source is under MIT License |
// Licence : This source is under MIT License |
||||||
// File : glm/gtx/inl.inl |
// File : glm/gtx/inl.inl |
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
||||||
|
|
||||||
#include "../matrix.hpp" |
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw |
||||||
// #include <boost/io/ios_state.hpp> // boost::io::ios_all_saver |
|
||||||
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, |
|
||||||
// std::setw |
|
||||||
#include <ostream> // std::basic_ostream<> |
#include <ostream> // std::basic_ostream<> |
||||||
|
|
||||||
namespace glm{ |
namespace glm |
||||||
namespace io |
|
||||||
{ |
{ |
||||||
|
namespace io |
||||||
|
{ |
||||||
|
|
||||||
|
template <typename CTy> |
||||||
|
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
format_punct<CTy>::format_punct(size_t a) |
||||||
|
: std::locale::facet(a), |
||||||
|
formatted (true), |
||||||
|
precision (3), |
||||||
|
width (1 + 4 + 1 + precision), |
||||||
|
separator (','), |
||||||
|
delim_left ('['), |
||||||
|
delim_right (']'), |
||||||
|
space (' '), |
||||||
|
newline ('\n'), |
||||||
|
order (row_major) |
||||||
|
{} |
||||||
|
|
||||||
|
template <typename CTy> |
||||||
|
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
format_punct<CTy>::format_punct(format_punct const& a) |
||||||
|
: std::locale::facet(0), |
||||||
|
formatted (a.formatted), |
||||||
|
precision (a.precision), |
||||||
|
width (a.width), |
||||||
|
separator (a.separator), |
||||||
|
delim_left (a.delim_left), |
||||||
|
delim_right (a.delim_right), |
||||||
|
space (a.space), |
||||||
|
newline (a.newline), |
||||||
|
order (a.order) |
||||||
|
{} |
||||||
|
|
||||||
|
template <typename CTy> std::locale::id format_punct<CTy>::id; |
||||||
|
|
||||||
|
template <typename CTy, typename CTr> |
||||||
/* explicit */ GLM_FUNC_QUALIFIER |
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
precision_guard::precision_guard() |
basic_state_saver<CTy,CTr>::basic_state_saver(std::basic_ios<CTy,CTr>& a) |
||||||
: precision_ (precision()), |
: state_ (a), |
||||||
value_width_(value_width()) |
flags_ (a.flags()), |
||||||
|
precision_(a.precision()), |
||||||
|
width_ (a.width()), |
||||||
|
fill_ (a.fill()), |
||||||
|
locale_ (a.getloc()) |
||||||
{} |
{} |
||||||
|
|
||||||
|
template <typename CTy, typename CTr> |
||||||
GLM_FUNC_QUALIFIER |
GLM_FUNC_QUALIFIER |
||||||
precision_guard::~precision_guard() |
basic_state_saver<CTy,CTr>::~basic_state_saver() |
||||||
{ |
{ |
||||||
value_width() = value_width_; |
state_.imbue(locale_); |
||||||
precision() = precision_; |
state_.fill(fill_); |
||||||
|
state_.width(width_); |
||||||
|
state_.precision(precision_); |
||||||
|
state_.flags(flags_); |
||||||
} |
} |
||||||
|
|
||||||
|
template <typename CTy, typename CTr> |
||||||
/* explicit */ GLM_FUNC_QUALIFIER |
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
format_guard::format_guard() |
basic_format_saver<CTy,CTr>::basic_format_saver(std::basic_ios<CTy,CTr>& a) |
||||||
: order_(order()), |
: bss_(a) |
||||||
cr_ (cr()) |
{ |
||||||
{} |
a.imbue(std::locale(a.getloc(), new format_punct<CTy>(get_facet<format_punct<CTy> >(a)))); |
||||||
|
} |
||||||
|
|
||||||
|
template <typename CTy, typename CTr> |
||||||
GLM_FUNC_QUALIFIER |
GLM_FUNC_QUALIFIER |
||||||
format_guard::~format_guard() |
basic_format_saver<CTy,CTr>::~basic_format_saver() |
||||||
|
{} |
||||||
|
|
||||||
|
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
precision::precision(unsigned a) |
||||||
|
: value(a) |
||||||
|
{} |
||||||
|
|
||||||
|
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
width::width(unsigned a) |
||||||
|
: value(a) |
||||||
|
{} |
||||||
|
|
||||||
|
template <typename CTy> |
||||||
|
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
delimeter<CTy>::delimeter(CTy a, CTy b, CTy c) |
||||||
|
: value() |
||||||
{ |
{ |
||||||
cr() = cr_; |
value[0] = a; |
||||||
order() = order_; |
value[1] = b; |
||||||
|
value[2] = c; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER unsigned& precision() |
/* explicit */ GLM_FUNC_QUALIFIER |
||||||
|
order::order(order_type a) |
||||||
|
: value(a) |
||||||
|
{} |
||||||
|
|
||||||
|
template <typename FTy, typename CTy, typename CTr> |
||||||
|
GLM_FUNC_QUALIFIER FTy const& |
||||||
|
get_facet(std::basic_ios<CTy,CTr>& ios) |
||||||
{ |
{ |
||||||
static unsigned p(3); |
if (!std::has_facet<FTy>(ios.getloc())) { |
||||||
|
ios.imbue(std::locale(ios.getloc(), new FTy)); |
||||||
|
} |
||||||
|
|
||||||
return p; |
return std::use_facet<FTy>(ios.getloc()); |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER unsigned& value_width() |
template <typename CTy, typename CTr> |
||||||
|
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& |
||||||
|
formatted(std::basic_ios<CTy,CTr>& ios) |
||||||
{ |
{ |
||||||
static unsigned p(9); |
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = true; |
||||||
|
|
||||||
return p; |
return ios; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER format_guard::order_t& order() |
template <typename CTy, typename CTr> |
||||||
|
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& |
||||||
|
unformatted(std::basic_ios<CTy,CTr>& ios) |
||||||
{ |
{ |
||||||
static format_guard::order_t p(format_guard::row_major); |
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = false; |
||||||
|
|
||||||
return p; |
return ios; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER char& |
template <typename CTy, typename CTr> |
||||||
cr() |
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy, CTr>& os, precision const& a) |
||||||
{ |
{ |
||||||
static char p('\n'); return p; |
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).precision = a.value; |
||||||
|
|
||||||
|
return os; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER std::ios_base& column_major(std::ios_base& os) |
template <typename CTy, typename CTr> |
||||||
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy, CTr>& os, width const& a) |
||||||
{ |
{ |
||||||
order() = format_guard::column_major; |
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).width = a.value; |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER std::ios_base& row_major(std::ios_base& os) |
template <typename CTy, typename CTr> |
||||||
|
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, |
||||||
|
delimeter<CTy> const& a) |
||||||
{ |
{ |
||||||
order() = format_guard::row_major; |
format_punct<CTy>& fmt(const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os))); |
||||||
|
|
||||||
|
fmt.delim_left = a.value[0]; |
||||||
|
fmt.delim_right = a.value[1]; |
||||||
|
fmt.separator = a.value[2]; |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER std::ios_base& formatted(std::ios_base& os) |
template <typename CTy, typename CTr> |
||||||
|
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy, CTr>& os, order const& a) |
||||||
{ |
{ |
||||||
cr() = '\n'; |
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).order = a.value; |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
GLM_FUNC_QUALIFIER std::ios_base& unformatted(std::ios_base& os) |
} // namespace io |
||||||
|
|
||||||
|
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, tquat<T,P> const& a) |
||||||
{ |
{ |
||||||
cr() = ' '; |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
return 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.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; |
||||||
|
} else { |
||||||
|
os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
} // namespace io |
return os; |
||||||
namespace detail |
} |
||||||
{ |
|
||||||
// functions, inlined (inline) |
|
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
// boost::io::ios_all_saver const ias(os); |
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::setprecision(io::precision()) |
os << std::fixed |
||||||
<< '[' |
<< std::right |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w << ',' |
<< std::setprecision(fmt.precision) |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ',' |
<< std::setfill(fmt.space) |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ',' |
<< fmt.delim_left |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z |
<< std::setw(fmt.width) << a.x << fmt.separator |
||||||
<< ']'; |
<< std::setw(fmt.width) << a.y |
||||||
|
<< fmt.delim_right; |
||||||
|
} else { |
||||||
|
os << a.x << fmt.space << a.y; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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) |
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a) |
||||||
{ |
{ |
||||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
// boost::io::ios_all_saver const ias(os); |
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
|
||||||
os << std::fixed << std::setprecision(io::precision()) |
if (fmt.formatted) { |
||||||
<< '[' |
io::basic_state_saver<CTy> const bss(os); |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ',' |
|
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y |
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; |
||||||
|
} else { |
||||||
|
os << a.x << fmt.space << a.y << fmt.space << a.z; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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) |
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a) |
||||||
{ |
{ |
||||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
// boost::io::ios_all_saver const ias(os); |
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
|
||||||
os << std::fixed << std::setprecision(io::precision()) |
if (fmt.formatted) { |
||||||
<< '[' |
io::basic_state_saver<CTy> const bss(os); |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ',' |
|
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ',' |
os << std::fixed |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z |
<< 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; |
||||||
|
} else { |
||||||
|
os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
// boost::io::ios_all_saver const ias(os); |
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat2x2<T,P> m(a); |
||||||
|
|
||||||
os << std::fixed << std::setprecision(io::precision()) |
if (io::row_major == fmt.order) { |
||||||
<< '[' |
m = transpose(a); |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ',' |
} |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ',' |
|
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z << ',' |
if (fmt.formatted) { |
||||||
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w |
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat3x2<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << ']'; |
} |
||||||
|
|
||||||
|
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat4x2<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << ']'; |
} |
||||||
|
|
||||||
|
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
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); |
||||||
|
} |
||||||
|
|
||||||
os << io::cr() |
if (fmt.formatted) { |
||||||
<< '[' << m[0] << io::cr() |
os << fmt.newline |
||||||
<< ' ' << m[1] << ']'; |
<< 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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat3x3<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << io::cr() |
} |
||||||
<< ' ' << m[2] << ']'; |
|
||||||
|
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
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); |
||||||
|
} |
||||||
|
|
||||||
os << io::cr() |
if (fmt.formatted) { |
||||||
<< '[' << m[0] << io::cr() |
os << fmt.newline |
||||||
<< ' ' << m[1] << io::cr() |
<< fmt.delim_left << m[0] << fmt.newline |
||||||
<< ' ' << m[2] << ']'; |
<< 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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat2x4<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << io::cr() |
} |
||||||
<< ' ' << m[2] << ']'; |
|
||||||
|
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat3x4<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << io::cr() |
} |
||||||
<< ' ' << m[2] << io::cr() |
|
||||||
<< ' ' << m[3] << ']'; |
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& |
||||||
|
operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a) |
||||||
{ |
{ |
||||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
if (cerberus) { |
||||||
|
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); |
||||||
|
tmat4x4<T,P> m(a); |
||||||
|
|
||||||
os << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
m = transpose(a); |
||||||
<< ' ' << m[1] << io::cr() |
} |
||||||
<< ' ' << m[2] << io::cr() |
|
||||||
<< ' ' << m[3] << ']'; |
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 os; |
||||||
} |
} |
||||||
|
|
||||||
template <typename CTy, typename CTr, typename T, precision P> |
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& m) |
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) |
||||||
{ |
{ |
||||||
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); |
||||||
|
|
||||||
if (cerberus) { |
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 << io::cr() |
if (io::row_major == fmt.order) { |
||||||
<< '[' << m[0] << io::cr() |
ml = transpose(a.first); |
||||||
<< ' ' << m[1] << io::cr() |
mr = transpose(a.second); |
||||||
<< ' ' << m[2] << io::cr() |
} |
||||||
<< ' ' << m[3] << ']'; |
|
||||||
|
if (fmt.formatted) { |
||||||
|
CTy const& l(fmt.delim_left); |
||||||
|
CTy const& r(fmt.delim_right); |
||||||
|
CTy const& s(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; |
||||||
|
} else { |
||||||
|
os << ml << fmt.space << mr; |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
return os; |
return os; |
||||||
} |
} |
||||||
|
|
||||||
}//namespace detail |
}//namespace detail |
||||||
}//namespace glm |
}//namespace glm |
||||||
|
Loading…
Reference in New Issue