From a76ae5e8304dea226d4d3dbd347565303ab7a4fd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Oct 2005 11:37:03 +0000 Subject: [PATCH] From Tony Horrobin: "This is a small fix for flt2osg.[cpp|h] that handles old style road segments ( from Multigen II w/road tools on IRIX ) in the same way as the newer road constructions. ie create a group and do a nested traversal. This makes roads appear in older format files where there was previously a gap. This actually works properly with the paths which are marked as hidden in the openflight database." --- src/osgPlugins/flt/flt2osg.cpp | 15 +++++++++++++++ src/osgPlugins/flt/flt2osg.h | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 0af7f1ac2..ee03b794b 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -370,6 +370,10 @@ osg::Group* ConvertFromFLT::visitPrimaryNode(osg::Group& osgParent, PrimNodeReco // treat road construction record as a group record for now osgPrim = visitRoadConstruction(osgParent, (GroupRecord*)child); break; + case ROAD_SEGMENT_OP: + // treat road segment record as a group record for now + osgPrim = visitRoadSegment(osgParent, (GroupRecord*)child); + break; default: @@ -1032,6 +1036,17 @@ osg::Group* ConvertFromFLT::visitRoadConstruction(osg::Group& osgParent, GroupRe return group; } +osg::Group* ConvertFromFLT::visitRoadSegment(osg::Group& osgParent, GroupRecord* rec) +{ + osg::Group* group = new osg::Group; + + group->setName(rec->getData()->szIdent); + //cout<<"Converted a road segment node of ID "<getName()<<" to group node."<addChild( group ); + visitPrimaryNode(*group, rec); + return group; +} + osg::Group* ConvertFromFLT::visitLOD(osg::Group& osgParent, LodRecord* rec) { SLevelOfDetail* pSLOD = rec->getData(); diff --git a/src/osgPlugins/flt/flt2osg.h b/src/osgPlugins/flt/flt2osg.h index 01348f162..91255dab5 100644 --- a/src/osgPlugins/flt/flt2osg.h +++ b/src/osgPlugins/flt/flt2osg.h @@ -127,7 +127,7 @@ class ConvertFromFLT // Ancillary records osg::Group* visitMatrix(osg::Group& osgParent, const osg::Group& osgPrimary, MatrixRecord* rec); - osg::Group* visitGeneralMatrix(osg::Group& osgParent, const osg::Group& osgPrimary, GeneralMatrixRecord* rec); + osg::Group* visitGeneralMatrix(osg::Group& osgParent, const osg::Group& osgPrimary, GeneralMatrixRecord* rec); void visitLongID(osg::Group& osgParent, LongIDRecord* rec); void visitComment(osg::Node& osgParent, CommentRecord* rec); @@ -151,6 +151,7 @@ class ConvertFromFLT osg::Group* visitBSP(osg::Group& osgParent, BSPRecord* rec); osg::Group* visitLightSource(osg::Group& osgParent, LightSourceRecord* rec); osg::Group* visitRoadConstruction(osg::Group& osgParent, GroupRecord* rec); + osg::Group* visitRoadSegment(osg::Group& osgParent, GroupRecord* rec); osg::Group* visitLOD(osg::Group& osgParent, LodRecord* rec); osg::Group* visitOldLOD(osg::Group& osgParent, OldLodRecord* rec); osg::Group* visitDOF(osg::Group& osgParent, DofRecord* rec);