From afa27a13ec4b839243604172398f13d635e79560 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 5 Nov 2002 07:50:40 +0000 Subject: [PATCH] From Jason Daly, fix for 14.2 color records in versions of OpenFlight files. --- src/osgPlugins/flt/flt2osg.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index fdb56a627..5dc2f75f7 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -1029,7 +1029,21 @@ void ConvertFromFLT::setColor ( FaceRecord *rec, SFace *pSFace, DynGeoSet *dgset if (bPackedColor) _faceColor = pSFace->PrimaryPackedColor.get(); else - _faceColor = pColorPool->getColor(pSFace->dwPrimaryColorIndex); + { + if (rec->getFlightVersion() >= 1540) + { + _faceColor = + pColorPool->getColor(pSFace->dwPrimaryColorIndex); + } + else // Version 14.2, 15.0 + { + // The field now called wPrimaryNameIndex was + // originally the primary color/intensity code + // for OpenFlight v14.2 and v15.0 files + _faceColor = + pColorPool->getColor(pSFace->wPrimaryNameIndex); + } + } } } else // Version 11, 12 & 13