diff --git a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp index 15939e1ed..9a1d6b764 100644 --- a/src/osgPlugins/OpenFlight/AncillaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/AncillaryRecords.cpp @@ -12,7 +12,7 @@ */ // -// OpenFlightŪ loader for OpenSceneGraph +// OpenFlight loader for OpenSceneGraph // // Copyright (C) 2005-2007 Brede Johansen // @@ -20,6 +20,7 @@ #include #include #include +#include #include "Registry.h" #include "Document.h" @@ -189,8 +190,8 @@ class Multitexture : public Record { int16 textureIndex = in.readInt16(); int16 effect = in.readInt16(); - /*int16 mappingIndex =*/ in.readInt16(); - /*uint16 data =*/ in.readUInt16(); + int16 mappingIndex = in.readInt16(); + uint16 data = in.readUInt16(); osg::ref_ptr texturePoolStateset = document.getOrCreateTexturePool()->get(textureIndex); if (stateset.valid() && texturePoolStateset.valid()) @@ -198,8 +199,15 @@ class Multitexture : public Record // Apply texture from texture pool. osg::Texture* texture = dynamic_cast(texturePoolStateset->getTextureAttribute(0,osg::StateAttribute::TEXTURE)); if (texture) + { stateset->setTextureAttributeAndModes(layer,texture,osg::StateAttribute::ON); - + if (document.getPreserveNonOsgAttrsAsUserData()) + { + texture->setUserValue("", effect); + texture->setUserValue("", mappingIndex); + texture->setUserValue("", data); + } + } // Apply texture environment switch (effect) { diff --git a/src/osgPlugins/OpenFlight/GeometryRecords.cpp b/src/osgPlugins/OpenFlight/GeometryRecords.cpp index a546a3056..731262b31 100644 --- a/src/osgPlugins/OpenFlight/GeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/GeometryRecords.cpp @@ -474,6 +474,24 @@ protected: { _geometry->setUserValue("", feature); } + + // terrain + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isTerrain()) + { + _geometry->setUserValue("", true); + } + + // roofline + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isRoofline()) + { + _geometry->setUserValue("", true); + } + + // footprint + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isFootprint()) + { + _geometry->setUserValue("", true); + } // Shaders if (shaderIndex >= 0) @@ -957,7 +975,7 @@ protected: int materialIndex = in.readInt16(-1); int16 surface = in.readInt16(); int16 feature = in.readInt16(); - /*int32 IRMaterial =*/ in.readInt32(-1); + int32 IRMaterial = in.readInt32(-1); _transparency = in.readUInt16(0); // version > 13 /*uint8 influenceLOD =*/ in.readUInt8(); @@ -1048,6 +1066,12 @@ protected: _geode->setUserValue("", IRColor); } + // IR Material ID (IRM) + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != IRMaterial) + { + _geode->setUserValue("", IRMaterial); + } + // surface (SMC) if (document.getPreserveNonOsgAttrsAsUserData() && 0 != surface) { @@ -1060,6 +1084,24 @@ protected: _geode->setUserValue("", feature); } + // terrain + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isTerrain()) + { + _geode->setUserValue("", true); + } + + // roofline + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isRoofline()) + { + _geode->setUserValue("", true); + } + + // footprint + if (document.getPreserveNonOsgAttrsAsUserData() && 0 != isFootprint()) + { + _geode->setUserValue("", true); + } + // Shaders if (shaderIndex >= 0) {