diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp index 3437a60b9..eaaec1187 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp @@ -69,6 +69,19 @@ class ValueVisitor : public osg::ValueVisitor { if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m; _fout << v[0] << ' ' << v[1] << ' ' << v[2]; } + + //add Vec3dArray* vertex output to avoid inaccuracy + virtual void apply(osg::Vec3d & inv) + { + osg::Vec3d v(inv[0], inv[1], inv[2]); + osg::Vec3d orign_d((double)_origin.x(), (double)_origin.y(), (double)_origin.z()); + if (_applyMatrix) v = (_isNormal) ? (v * _m) - orign_d : v * _m; + + //Setting 10-digit Significant Number + _fout.precision(10); + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + } + private: ValueVisitor& operator = (const ValueVisitor&) { return *this; }