From 4f2bfa1e9de29f10a97f8ecc85fabaed82d74366 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 7 Oct 2018 01:04:01 +0300 Subject: [PATCH] Add operators for osg types --- components/osghelpers/operators.hpp | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 components/osghelpers/operators.hpp diff --git a/components/osghelpers/operators.hpp b/components/osghelpers/operators.hpp new file mode 100644 index 000000000..fdb0227ea --- /dev/null +++ b/components/osghelpers/operators.hpp @@ -0,0 +1,35 @@ +#ifndef OPENMW_COMPONENTS_OSGHELPERS_OPERATORS_H +#define OPENMW_COMPONENTS_OSGHELPERS_OPERATORS_H + +#include +#include +#include + +#include +#include +#include + +namespace osg +{ + inline std::ostream& operator <<(std::ostream& stream, const Vec2i& value) + { + return stream << "osg::Vec2i(" << value.x() << ", " << value.y() << ")"; + } + + inline std::ostream& operator <<(std::ostream& stream, const Vec2f& value) + { + return stream << "osg::Vec2f(" << std::setprecision(std::numeric_limits::max_exponent10) << value.x() + << ", " << std::setprecision(std::numeric_limits::max_exponent10) << value.y() + << ')'; + } + + inline std::ostream& operator <<(std::ostream& stream, const Vec3f& value) + { + return stream << "osg::Vec3f(" << std::setprecision(std::numeric_limits::max_exponent10) << value.x() + << ", " << std::setprecision(std::numeric_limits::max_exponent10) << value.y() + << ", " << std::setprecision(std::numeric_limits::max_exponent10) << value.z() + << ')'; + } +} + +#endif