Moved the istream and ostream support from Vec* and Matrix* into a seperate io_utils file.
This commit is contained in:
@@ -876,6 +876,10 @@ SOURCE=..\..\include\osg\ref_ptr
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\osg\io_utils
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Include\Osg\Referenced
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -15,17 +15,10 @@
|
||||
#define OSG_MATRIXD 1
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Vec3d>
|
||||
#include <osg/Vec4f>
|
||||
#include <osg/Vec4d>
|
||||
#include <osg/Quat>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <ostream>
|
||||
#include <algorithm>
|
||||
|
||||
namespace osg {
|
||||
|
||||
class Matrixf;
|
||||
@@ -646,18 +639,6 @@ inline Vec4d Matrixd::operator* (const Vec4d& v) const
|
||||
return postMult(v);
|
||||
}
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& os, const Matrixd& m )
|
||||
{
|
||||
os << "{"<<std::endl;
|
||||
for(int row=0; row<4; ++row) {
|
||||
os << "\t";
|
||||
for(int col=0; col<4; ++col)
|
||||
os << m(row,col) << " ";
|
||||
os << std::endl;
|
||||
}
|
||||
os << "}" << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace osg
|
||||
|
||||
|
||||
@@ -15,17 +15,10 @@
|
||||
#define OSG_MATRIXF 1
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Vec3d>
|
||||
#include <osg/Vec4f>
|
||||
#include <osg/Vec4d>
|
||||
#include <osg/Quat>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <ostream>
|
||||
#include <algorithm>
|
||||
|
||||
namespace osg {
|
||||
|
||||
class Matrixf;
|
||||
@@ -633,19 +626,6 @@ inline Vec4d Matrixf::operator* (const Vec4d& v) const
|
||||
return postMult(v);
|
||||
}
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& os, const Matrixf& m )
|
||||
{
|
||||
os << "{"<<std::endl;
|
||||
for(int row=0; row<4; ++row) {
|
||||
os << "\t";
|
||||
for(int col=0; col<4; ++col)
|
||||
os << m(row,col) << " ";
|
||||
os << std::endl;
|
||||
}
|
||||
os << "}" << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
} //namespace osg
|
||||
|
||||
|
||||
@@ -168,22 +168,5 @@ class Vec2d
|
||||
|
||||
}; // end of class Vec2d
|
||||
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec2d& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec2d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace osg
|
||||
#endif
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
#ifndef OSG_VEC2F
|
||||
#define OSG_VEC2F 1
|
||||
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#include <osg/Math>
|
||||
|
||||
namespace osg {
|
||||
@@ -166,22 +163,6 @@ class Vec2f
|
||||
|
||||
}; // end of class Vec2f
|
||||
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec2f& vec)
|
||||
{
|
||||
output << vec._v[0] << " " << vec._v[1];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec2f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace osg
|
||||
#endif
|
||||
|
||||
|
||||
@@ -199,24 +199,6 @@ class Vec3d
|
||||
|
||||
}; // end of class Vec3d
|
||||
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec3d& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec3d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace osg
|
||||
|
||||
#endif
|
||||
|
||||
@@ -197,21 +197,6 @@ class Vec3f
|
||||
|
||||
}; // end of class Vec3f
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec3f& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec3f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2];
|
||||
return input;
|
||||
}
|
||||
|
||||
const Vec3f X_AXIS(1.0,0.0,0.0);
|
||||
const Vec3f Y_AXIS(0.0,1.0,0.0);
|
||||
|
||||
@@ -239,23 +239,6 @@ class Vec4d
|
||||
}; // end of class Vec4d
|
||||
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec4d& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2] << " "
|
||||
<< vec._v[3];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec4d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
/** Compute the dot product of a (Vec3,1.0) and a Vec4d. */
|
||||
inline Vec4d::value_type operator * (const Vec3d& lhs,const Vec4d& rhs)
|
||||
|
||||
@@ -232,23 +232,6 @@ class Vec4f
|
||||
}; // end of class Vec4f
|
||||
|
||||
|
||||
// streaming operators
|
||||
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec4f& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2] << " "
|
||||
<< vec._v[3];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec4f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
/** Compute the dot product of a (Vec3,1.0) and a Vec4f. */
|
||||
inline Vec4f::value_type operator * (const Vec3f& lhs,const Vec4f& rhs)
|
||||
|
||||
163
include/osg/io_utils
Normal file
163
include/osg/io_utils
Normal file
@@ -0,0 +1,163 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_IO_UTILS
|
||||
#define OSG_IO_UTILS 1
|
||||
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#include <osg/Vec2f>
|
||||
#include <osg/Vec2d>
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Vec3d>
|
||||
#include <osg/Vec4f>
|
||||
#include <osg/Vec4d>
|
||||
#include <osg/Matrixf>
|
||||
#include <osg/Matrixd>
|
||||
|
||||
namespace osg {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec2f streaming operators
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec2f& vec)
|
||||
{
|
||||
output << vec._v[0] << " " << vec._v[1];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec2f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1];
|
||||
return input;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec2d steaming operators.
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec2d& vec)
|
||||
{
|
||||
output << vec._v[0] << " " << vec._v[1];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec2d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1];
|
||||
return input;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec3f steaming operators.
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec3f& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec3f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec3d steaming operators.
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec3d& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec3d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec3f steaming operators.
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec4f& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2] << " "
|
||||
<< vec._v[3];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
|
||||
inline std::istream& operator >> (std::istream& input, Vec4f& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Vec4d steaming operators.
|
||||
inline std::ostream& operator << (std::ostream& output, const Vec4d& vec)
|
||||
{
|
||||
output << vec._v[0] << " "
|
||||
<< vec._v[1] << " "
|
||||
<< vec._v[2] << " "
|
||||
<< vec._v[3];
|
||||
return output; // to enable cascading
|
||||
}
|
||||
inline std::istream& operator >> (std::istream& input, Vec4d& vec)
|
||||
{
|
||||
input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3];
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Matrxf steaming operators.
|
||||
inline std::ostream& operator<< (std::ostream& os, const Matrixf& m )
|
||||
{
|
||||
os << "{"<<std::endl;
|
||||
for(int row=0; row<4; ++row) {
|
||||
os << "\t";
|
||||
for(int col=0; col<4; ++col)
|
||||
os << m(row,col) << " ";
|
||||
os << std::endl;
|
||||
}
|
||||
os << "}" << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Matrxd steaming operators.
|
||||
inline std::ostream& operator<< (std::ostream& os, const Matrixd& m )
|
||||
{
|
||||
os << "{"<<std::endl;
|
||||
for(int row=0; row<4; ++row) {
|
||||
os << "\t";
|
||||
for(int col=0; col<4; ++col)
|
||||
os << m(row,col) << " ";
|
||||
os << std::endl;
|
||||
}
|
||||
os << "}" << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace osg
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <osg/AnimationPath>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
#include <osg/io_utils>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/Notify>
|
||||
|
||||
|
||||
using namespace osg;
|
||||
|
||||
ImpostorSprite::ImpostorSprite()
|
||||
@@ -113,10 +112,6 @@ bool ImpostorSprite::computeBound() const
|
||||
if (!_bbox.valid())
|
||||
{
|
||||
notify(WARN) << "******* ImpostorSprite::computeBound() problem"<<std::endl;
|
||||
notify(WARN) << "******* = "<<_coords[0]<<std::endl;
|
||||
notify(WARN) << "******* = "<<_coords[1]<<std::endl;
|
||||
notify(WARN) << "******* = "<<_coords[2]<<std::endl;
|
||||
notify(WARN) << "******* = "<<_coords[3]<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osg/Quat>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
#include <osgUtil/IntersectVisitor>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <osg/LightSource>
|
||||
#include <osg/ApplicationUsage>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgUtil/UpdateVisitor>
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/TriangleFunctor>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <float.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <osg/Notify>
|
||||
#include <osg/TriangleIndexFunctor>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgUtil/TriStripVisitor>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
|
||||
Reference in New Issue
Block a user