From f0125da6fdff042b66e8946cc7a4ee6997258cff Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 8 Aug 2014 16:42:32 +0000 Subject: [PATCH] From Ryan Kawicki, "There is an issue where the model insets of a terrex terrain are being removed during the loading process. The issue is described below. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - the issue here is that the plugin is removing group nodes if that group node only has one child. becuase transforms are also group nodes, there were cases when the transform would have only one child under it and would cause it to remove the translation portion. this would cause all the vertex data to be loaded around the last matrix operation, which in our case was the origin (0,0,0). We work off of OSG 2.8.1 but see that this has not been addressed on latest yet. I’ve tested this against 2.8.1 and have cleanly applied it to my local repository off of latest." git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14407 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgPlugins/txp/ReaderWriterTXP.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/txp/ReaderWriterTXP.cpp b/src/osgPlugins/txp/ReaderWriterTXP.cpp index 385762120..e8591d48d 100644 --- a/src/osgPlugins/txp/ReaderWriterTXP.cpp +++ b/src/osgPlugins/txp/ReaderWriterTXP.cpp @@ -870,7 +870,9 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); // if group has only one child, then simply use its child. - while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) + // if the node is a transform, then stop processing so as to not loose the transformation + while (tileGroup && !tileGroup->asTransform() && + tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } @@ -882,7 +884,7 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int doSeam = (lod < (archive->getNumLODs() - 1)); // Handle seams - if (doSeam) + if (tileGroup && doSeam) { SeamFinder sfv(x,y,lod,info,archive); tileGroup->accept(sfv); @@ -906,13 +908,15 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, con osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); // if group has only one child, then simply use its child. - while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) + // if the node is a transform, then stop processing so as to not loose the transformation + while (tileGroup && !tileGroup->asTransform() && + tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } // Handle seams - if (childrenLoc.size() > 0) + if (tileGroup && childrenLoc.size() > 0) { SeamFinder sfv(loc.x, loc.y, loc.lod, info, archive); tileGroup->accept(sfv);