From 00480d05758b1cacbdd90a26e1c84353357028b4 Mon Sep 17 00:00:00 2001 From: Dyuzz <13070895895@163.com> Date: Thu, 13 Dec 2018 21:15:07 +0800 Subject: [PATCH 1/3] add Vec3dArray* vertex output to avoid inaccuracy --- src/osgPlugins/obj/OBJWriterNodeVisitor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp index 3437a60b9..766affa8f 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp @@ -69,6 +69,18 @@ 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; } From a7623e3b040421b74b17bea97772ba752c086775 Mon Sep 17 00:00:00 2001 From: OpenSceneGraph git repository Date: Thu, 13 Dec 2018 14:05:31 +0000 Subject: [PATCH 2/3] Chnaged tabs to four spaces to fix indentation --- src/osgPlugins/obj/OBJWriterNodeVisitor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp index 766affa8f..25013d411 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp @@ -71,16 +71,16 @@ class ValueVisitor : public osg::ValueVisitor { } //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; + 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]; - } + //Setting 10-digit Significant Number + _fout.precision(10); + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + } private: ValueVisitor& operator = (const ValueVisitor&) { return *this; } From d090be7b4919f853b9167de0e048a9cfbbdd9d7b Mon Sep 17 00:00:00 2001 From: OpenSceneGraph git repository Date: Thu, 13 Dec 2018 14:06:51 +0000 Subject: [PATCH 3/3] Fixed indentation --- src/osgPlugins/obj/OBJWriterNodeVisitor.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp index 25013d411..abea45eb5 100644 --- a/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp +++ b/src/osgPlugins/obj/OBJWriterNodeVisitor.cpp @@ -74,13 +74,13 @@ class ValueVisitor : public osg::ValueVisitor { 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; + 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]; - } + //Setting 10-digit Significant Number + _fout.precision(10); + _fout << v[0] << ' ' << v[1] << ' ' << v[2]; + } private: ValueVisitor& operator = (const ValueVisitor&) { return *this; }