Merge pull request #673 from Dyuzz/patch-1

add Vec3dArray* vertex output to avoid inaccuracy
This commit is contained in:
OpenSceneGraph git repository 2018-12-13 14:07:44 +00:00 committed by GitHub
commit 22b1ec8fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,6 +69,18 @@ class ValueVisitor : public osg::ValueVisitor {
if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m; if (_applyMatrix) v = (_isNormal) ? (v * _m) - _origin : v * _m;
_fout << v[0] << ' ' << v[1] << ' ' << v[2]; _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: private:
ValueVisitor& operator = (const ValueVisitor&) { return *this; } ValueVisitor& operator = (const ValueVisitor&) { return *this; }