From: Braden M. <br...@us...> - 2006-08-23 06:41:31
|
Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9179/src/libopenvrml/openvrml Modified Files: basetypes.cpp basetypes.h Log Message: Overloaded stream extraction operators for the fundamental types. Index: basetypes.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/basetypes.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** basetypes.cpp 6 Aug 2006 02:34:38 -0000 1.37 --- basetypes.cpp 23 Aug 2006 06:41:27 -0000 1.38 *************** *** 4,8 **** // // Copyright 2001 S. K. Bose ! // Copyright 2003, 2004 Braden McDaniel // // This library is free software; you can redistribute it and/or --- 4,8 ---- // // Copyright 2001 S. K. Bose ! // Copyright 2003, 2004, 2005, 2006 Braden McDaniel // // This library is free software; you can redistribute it and/or *************** *** 23,26 **** --- 23,30 ---- # include <numeric> # include <ostream> + # include <boost/spirit.hpp> + # include <boost/spirit/actor.hpp> + # include <boost/spirit/dynamic.hpp> + # include <boost/spirit/phoenix.hpp> # include <private.h> # include "basetypes.h" *************** *** 108,112 **** * @brief A color. * ! * VRML colors are represented as three single precision floating point * components—red, green, and blue—ranging from 0.0 to 1.0. */ --- 112,116 ---- * @brief A color. * ! * VRML colors are represented as three single-precision floating point * components—red, green, and blue—ranging from 0.0 to 1.0. */ *************** *** 278,281 **** --- 282,399 ---- } + namespace { + struct OPENVRML_LOCAL vrml97_space_parser : + boost::spirit::char_parser<vrml97_space_parser> { + + typedef vrml97_space_parser self_t; + + template <typename CharT> + bool test(const CharT & c) const + { + return isspace(c) || c == ','; + } + }; + + const vrml97_space_parser vrml97_space_p = vrml97_space_parser(); + + typedef std::istream::char_type char_t; + typedef boost::spirit::multi_pass<std::istreambuf_iterator<char_t> > + iterator_t; + + typedef boost::spirit::skip_parser_iteration_policy<vrml97_space_parser> + iter_policy_t; + typedef boost::spirit::scanner_policies<iter_policy_t> scanner_policies_t; + typedef boost::spirit::scanner<iterator_t, scanner_policies_t> scanner_t; + + typedef boost::spirit::rule<scanner_t> rule_t; + + + struct OPENVRML_LOCAL intensity_parser { + + typedef double result_t; + + struct valid { + explicit valid(result_t & value): + value_(value) + {} + + bool operator()() const + { + return this->value_ >= 0.0 && this->value_ <= 1.0; + } + + private: + result_t & value_; + }; + + template <typename ScannerT> + std::ptrdiff_t operator()(const ScannerT & scan, + result_t & result) const + { + using boost::spirit::assign_a; + using boost::spirit::eps_p; + using boost::spirit::real_p; + using boost::spirit::match_result; + typedef typename match_result<ScannerT, result_t>::type match_t; + typedef typename boost::spirit::rule<ScannerT> rule_t; + + rule_t rule + = real_p[assign_a(result)] >> eps_p(valid(result)) + ; + match_t match = rule.parse(scan); + return match.length(); + } + }; + + const boost::spirit::functor_parser<intensity_parser> intensity_p; + } + + /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * If any of the color components are outside the the range [0.0, 1.0], the + * @c failbit will be set on @p in and @p c will be left in an arbitrary + * state. + * + * @param[in,out] in input stream. + * @param[out] c a @c color. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, color & c) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t rule + = intensity_p[assign_a(c.rgb[0])] + >> intensity_p[assign_a(c.rgb[1])] + >> intensity_p[assign_a(c.rgb[2])] + ; + + match<> m = rule.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + return in; + } + + return in; + } + /** * @relatesalso openvrml::color *************** *** 284,288 **** * * @param[in,out] out output stream. ! * @param[in] c a color. * * @return @p out. --- 402,406 ---- * * @param[in,out] out output stream. ! * @param[in] c a @c color. * * @return @p out. *************** *** 298,302 **** * @brief A color with alpha channel. * ! * VRML @c color_rgba%s are represented as four single precision floating * point components—red, green, blue, and alpha—ranging from 0.0 * to 1.0. For the alpha channel, 1.0 is opaque. --- 416,420 ---- * @brief A color with alpha channel. * ! * VRML @c color_rgba%s are represented as four single-precision floating * point components—red, green, blue, and alpha—ranging from 0.0 * to 1.0. For the alpha channel, 1.0 is opaque. *************** *** 496,499 **** --- 614,664 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * If any of the color components are outside the the range [0.0, 1.0], the + * @c failbit will be set on @p in and @p c will be left in an arbitrary + * state. + * + * @param[in,out] in input stream. + * @param[out] c a @c color_rgba. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, color_rgba & c) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t rule + = intensity_p[assign_a(c.rgba[0])] + >> intensity_p[assign_a(c.rgba[1])] + >> intensity_p[assign_a(c.rgba[2])] + >> intensity_p[assign_a(c.rgba[3])]; + + match<> m = rule.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + return in; + } + + return in; + } + + /** * @relatesalso openvrml::color_rgba * *************** *** 514,518 **** * @class openvrml::vec2f * ! * @brief Two-component single precision vector. */ --- 679,683 ---- * @class openvrml::vec2f * ! * @brief Two-component single-precision vector. */ *************** *** 855,858 **** --- 1020,1063 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] v a @c vec2f. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, vec2f & v) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t r + = real_p[assign_a(v.vec[0])] >> real_p[assign_a(v.vec[1])] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** * @relatesalso openvrml::vec2f * *************** *** 873,877 **** * @class openvrml::vec2d * ! * @brief Two-component single precision vector. */ --- 1078,1082 ---- * @class openvrml::vec2d * ! * @brief Two-component double-precision vector. */ *************** *** 1214,1217 **** --- 1419,1462 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] v a @c vec2d. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, vec2d & v) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t r + = real_p[assign_a(v.vec[0])] >> real_p[assign_a(v.vec[1])] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** * @relatesalso openvrml::vec2d * *************** *** 1232,1236 **** * @class openvrml::vec3f * ! * @brief Three-component single precision vector. */ --- 1477,1481 ---- * @class openvrml::vec3f * ! * @brief Three-component single-precision vector. */ *************** *** 1703,1706 **** --- 1948,1993 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] v a @c vec3f. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, vec3f & v) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t r + = real_p[assign_a(v.vec[0])] + >> real_p[assign_a(v.vec[1])] + >> real_p[assign_a(v.vec[2])] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** * @relatesalso openvrml::vec3f * *************** *** 1721,1725 **** * @class openvrml::vec3d * ! * @brief Three-component single precision vector. */ --- 2008,2012 ---- * @class openvrml::vec3d * ! * @brief Three-component double-precision vector. */ *************** *** 2192,2195 **** --- 2479,2524 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] v a @c vec3d. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, vec3d & v) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t r + = real_p[assign_a(v.vec[0])] + >> real_p[assign_a(v.vec[1])] + >> real_p[assign_a(v.vec[2])] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** * @relatesalso openvrml::vec3d * *************** *** 2212,2216 **** * @brief A rotation. * ! * VRML rotations are represented with four single precision floating point * components. The first three are an axis of rotation, and the last is * rotation in radians. --- 2541,2545 ---- * @brief A rotation. * ! * VRML rotations are represented with four single-precision floating point * components. The first three are an axis of rotation, and the last is * rotation in radians. *************** *** 2605,2608 **** --- 2934,3013 ---- } + namespace { + struct OPENVRML_LOCAL is_normalized { + is_normalized(float & x, float & y, float & z): + x_(x), + y_(y), + z_(z) + {} + + bool operator()() const + { + using openvrml::vec3f; + using openvrml_::fequal; + return fequal(vec3f(this->x_, this->y_, this->z_).length(), 1.0f); + } + + private: + float & x_, & y_, & z_; + }; + } + + /** + * @relatesalso openvrml::rotation + * + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * If the axis components of the rotation do not represent a normalized + * vector, the @c failbit will be set on @p in and @p rot will not be + * modified. + * + * @param[in,out] in input stream. + * @param[out] rot a @c rotation. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, rotation & rot) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::eps_p; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + float x, y, z, angle; + rule_t rule + = real_p[assign_a(x)] >> real_p[assign_a(y)] >> real_p[assign_a(z)] + >> eps_p(is_normalized(x, y, z)) + >> real_p[assign_a(angle)] + ; + + match<> m = rule.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + return in; + } + + rot.x(x); + rot.y(y); + rot.z(z); + rot.angle(angle); + + return in; + } + /** * @relatesalso openvrml::rotation *************** *** 3422,3429 **** * @relatesalso openvrml::mat4f * * @brief Stream output. * * @param[in,out] out an output stream. ! * @param[in] mat a matrix. * * @return @p out. --- 3827,3911 ---- * @relatesalso openvrml::mat4f * + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * Optionally, brackets may be used in the input to group the rows; i.e., the + * following syntaxes are accepted: + * + * - [ <var>f<sub>11</sub></var>, ... <var>f<sub>14</sub></var> ], ... [ <var>f<sub>41</sub></var>, ... <var>f<sub>44</sub></var> ] + * - <var>f<sub>11</sub></var>, <var>f<sub>12</sub></var>, ... <var>f<sub>44</sub></var> + * + * @param[in,out] in input stream. + * @param[out] m a matrix. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, mat4f & m) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::ch_p; + using boost::spirit::real_p; + using boost::spirit::assign_a; + using boost::spirit::increment_a; + using boost::spirit::decrement_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + size_t row1_bracket_count = 0, row2_bracket_count = 0, row3_bracket_count = 0, + row4_bracket_count = 0; + + rule_t r + = !ch_p('[')[increment_a(row1_bracket_count)] + >> real_p[assign_a(m[0][0])] + >> real_p[assign_a(m[0][1])] + >> real_p[assign_a(m[0][2])] + >> real_p[assign_a(m[0][3])] + >> !ch_p(']')[decrement_a(row1_bracket_count)] + >> !ch_p('[')[increment_a(row2_bracket_count)] + >> real_p[assign_a(m[1][0])] + >> real_p[assign_a(m[1][1])] + >> real_p[assign_a(m[1][2])] + >> real_p[assign_a(m[1][3])] + >> !ch_p(']')[decrement_a(row2_bracket_count)] + >> !ch_p('[')[increment_a(row3_bracket_count)] + >> real_p[assign_a(m[2][0])] + >> real_p[assign_a(m[2][1])] + >> real_p[assign_a(m[2][2])] + >> real_p[assign_a(m[2][3])] + >> !ch_p(']')[decrement_a(row3_bracket_count)] + >> !ch_p('[')[increment_a(row4_bracket_count)] + >> real_p[assign_a(m[3][0])] + >> real_p[assign_a(m[3][1])] + >> real_p[assign_a(m[3][2])] + >> real_p[assign_a(m[3][3])] + >> !ch_p(']')[decrement_a(row4_bracket_count)] + ; + + boost::spirit::match<> match = r.parse(scan); + + if (!match || row1_bracket_count != 0 || row2_bracket_count != 0 + || row3_bracket_count != 0 || row4_bracket_count != 0) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** + * @relatesalso openvrml::mat4f + * * @brief Stream output. * * @param[in,out] out an output stream. ! * @param[in] mat a matrix. * * @return @p out. *************** *** 3431,3435 **** std::ostream & openvrml::operator<<(std::ostream & out, const mat4f & mat) { - out << '['; for (size_t i = 0; i < 4; i++) { out << '['; --- 3913,3916 ---- *************** *** 3441,3445 **** if (i != 3) { out << ", "; } } - out << ']'; return out; } --- 3922,3925 ---- *************** *** 3939,3942 **** --- 4419,4465 ---- /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] q a @c quatf. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, quatf & q) + { + using std::istreambuf_iterator; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::real_p; + using boost::spirit::assign_a; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + rule_t r + = real_p[assign_a(q.quat[0])] + >> real_p[assign_a(q.quat[1])] + >> real_p[assign_a(q.quat[2])] + >> real_p[assign_a(q.quat[3])] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + + /** * @relatesalso openvrml::quatf * *************** *** 4317,4320 **** --- 4840,4963 ---- } + namespace { + + struct OPENVRML_LOCAL set_pixel { + set_pixel(openvrml::image & img, size_t & index): + img_(&img), + index_(&index) + {} + + template <typename NumT> + void operator()(NumT val) const + { + this->img_->pixel(*this->index_, val); + } + + private: + openvrml::image * const img_; + size_t * const index_; + }; + + struct OPENVRML_LOCAL resize_image { + resize_image(openvrml::image & img, + size_t & x, size_t & y, size_t & comp): + img_(&img), + x_(&x), + y_(&y), + comp_(&comp) + {} + + template <typename IteratorT> + void operator()(IteratorT, IteratorT) const + { + openvrml::image temp(*this->x_, *this->y_, *this->comp_); + this->img_->swap(temp); + } + + private: + openvrml::image * const img_; + size_t * const x_, * const y_, * const comp_; + }; + + + struct OPENVRML_LOCAL int32_parser { + typedef openvrml::int32 result_t; + + template <typename ScannerT> + std::ptrdiff_t operator()(const ScannerT & scan, + result_t & result) const + { + using namespace boost::spirit; + using namespace phoenix; + typedef typename match_result<ScannerT, result_t>::type match_t; + match_t match + = ( lexeme_d[ + ch_p('0') >> chset_p("Xx") + >> hex_p[assign_a(result)] + ] + | int_p[assign_a(result)] + ).parse(scan); + return match.length(); + } + }; + + const boost::spirit::functor_parser<int32_parser> int32_p = int32_parser(); + } + + /** + * @brief Stream input. + * + * Consistent with the VRML97 convention, commas (“@c ,”) in the + * input are treated as whitespace. + * + * @param[in,out] in input stream. + * @param[out] img an @c image. + * + * @return @p in. + */ + std::istream & openvrml::operator>>(std::istream & in, image & img) + { + using std::istreambuf_iterator; + using boost::ref; + using boost::spirit::make_multi_pass; + using boost::spirit::match; + using boost::spirit::eps_p; + using boost::spirit::int_p; + using boost::spirit::repeat_p; + using boost::spirit::assign_a; + using boost::spirit::increment_a; + using phoenix::arg1; + using phoenix::var; + + iter_policy_t iter_policy(vrml97_space_p); + scanner_policies_t policies(iter_policy); + iterator_t + first(make_multi_pass(istreambuf_iterator<char_t>(in))), + last(make_multi_pass(istreambuf_iterator<char_t>())); + + scanner_t scan(first, last, policies); + + size_t x = 0, y = 0, comp = 0, pixels = 0, index = 0; + rule_t r + = int32_p[var(pixels) = arg1][assign_a(x)] + >> int32_p[var(pixels) *= arg1][assign_a(y)] + >> int32_p[assign_a(comp)] + // Just resize the image once we have the x, y, and comp values to + // avoid unnecessary reallocation. + >> eps_p[resize_image(img, x, y, comp)] + >> repeat_p(ref(pixels))[ + int32_p[set_pixel(img, index)][increment_a(index)] + ] + ; + + match<> m = r.parse(scan); + + if (!m) { + in.setstate(std::ios_base::failbit); + } + + return in; + } + /** * @relatesalso openvrml::image Index: basetypes.h =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/basetypes.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** basetypes.h 20 Feb 2006 04:37:28 -0000 1.23 --- basetypes.h 23 Aug 2006 06:41:27 -0000 1.24 *************** *** 4,8 **** // // Copyright 2001 S. K. Bose ! // Copyright 2003, 2004 Braden McDaniel // // This library is free software; you can redistribute it and/or --- 4,8 ---- // // Copyright 2001 S. K. Bose ! // Copyright 2003, 2004, 2005, 2006 Braden McDaniel // // This library is free software; you can redistribute it and/or *************** *** 41,45 **** --- 41,52 ---- # endif + + class color; + + OPENVRML_API std::istream & operator>>(std::istream & in, color & c); + class OPENVRML_API color { + friend std::istream & operator>>(std::istream & in, color & c); + float rgb[3]; *************** *** 108,112 **** --- 115,125 ---- + class color_rgba; + + OPENVRML_API std::istream & operator>>(std::istream & in, color_rgba & c); + class OPENVRML_API color_rgba { + friend std::istream & operator>>(std::istream & in, color_rgba & c); + float rgba[4]; *************** *** 189,193 **** --- 202,212 ---- + class vec2f; + + OPENVRML_API std::istream & operator>>(std::istream & in, vec2f & v); + class OPENVRML_API vec2f { + friend std::istream & operator>>(std::istream & in, vec2f & v); + float vec[2]; *************** *** 273,277 **** --- 292,302 ---- + class vec2d; + + OPENVRML_API std::istream & operator>>(std::istream & in, vec2d & v); + class OPENVRML_API vec2d { + friend std::istream & operator>>(std::istream & in, vec2d & v); + double vec[2]; *************** *** 358,363 **** --- 383,393 ---- class mat4f; + class vec3f; + + OPENVRML_API std::istream & operator>>(std::istream & in, vec3f & v); class OPENVRML_API vec3f { + friend std::istream & operator>>(std::istream & in, vec3f & v); + float vec[3]; *************** *** 470,474 **** --- 500,510 ---- + class vec3d; + + OPENVRML_API std::istream & operator>>(std::istream & in, vec3d & v); + class OPENVRML_API vec3d { + friend std::istream & operator>>(std::istream & in, vec3d & v); + double vec[3]; *************** *** 623,626 **** --- 659,663 ---- OPENVRML_API bool operator!=(const rotation & lhs, const rotation & rhs) OPENVRML_NOTHROW; + OPENVRML_API std::istream & operator>>(std::istream & in, rotation & rot); OPENVRML_API std::ostream & operator<<(std::ostream & out, const rotation & r); *************** *** 730,738 **** --- 767,780 ---- OPENVRML_API const mat4f operator*(float scalar, const mat4f & mat) OPENVRML_NOTHROW; + OPENVRML_API std::istream & operator>>(std::istream & in, mat4f & mat); OPENVRML_API std::ostream & operator<<(std::ostream & out, const mat4f & mat); + OPENVRML_API std::istream & operator>>(std::istream & in, quatf & q); + class OPENVRML_API quatf { + friend std::istream & operator>>(std::istream & in, quatf & q); + float quat[4]; *************** *** 990,993 **** --- 1032,1036 ---- } + OPENVRML_API std::istream & operator>>(std::istream & in, image & img); OPENVRML_API std::ostream & operator<<(std::ostream & out, const image & img); |