From Brede Johansen,

"I found some artifacts on some models and traced it back to the
external palette override feature.  There are some changes in the
layout of the external record the loader have to take into
consideration.

The other fix is to remove the OF pools from the user data of the
external ProxyNode when it is no longer needed."
This commit is contained in:
Robert Osfield 2006-07-12 09:40:03 +00:00
parent dd6a33da49
commit 5e9b7bef88
2 changed files with 23 additions and 8 deletions

View File

@ -626,14 +626,27 @@ protected:
_external->setFileName(0,strFile);
// Set parent pools as user data
in.forward(4);
unsigned int mask = in.readUInt32();
_external->setUserData( static_cast<osg::Referenced*>( new ParentPools(
((mask & COLOR_PALETTE_OVERRIDE) ? NULL : document.getColorPool()),
((mask & MATERIAL_PALETTE_OVERRIDE) ? NULL : document.getOrCreateMaterialPool()),
((mask & TEXTURE_PALETTE_OVERRIDE) ? NULL : document.getOrCreateTexturePool()),
((mask & LIGHT_POINT_PALETTE_OVERRIDE) ? NULL : document.getOrCreateLightPointAppearancePool()),
((mask & SHADER_PALETTE_OVERRIDE) ? NULL : document.getOrCreateShaderPool()) )));
if (document.version() >= VERSION_14_2)
{
in.forward(2);
if (document.version() >= VERSION_15_1)
in.forward(2);
uint32 mask = in.readUInt32(~0);
// Possible bug in models with version number 15.4.1 ?
// Symptoms: Black trees in VegaPlayer town.
if (document.version() == 1541)
mask = ~0;
_external->setUserData(new ParentPools(
((mask & COLOR_PALETTE_OVERRIDE) ? NULL : document.getColorPool()),
((mask & MATERIAL_PALETTE_OVERRIDE) ? NULL : document.getOrCreateMaterialPool()),
((mask & TEXTURE_PALETTE_OVERRIDE) ? NULL : document.getOrCreateTexturePool()),
((mask & LIGHT_POINT_PALETTE_OVERRIDE) ? NULL : document.getOrCreateLightPointAppearancePool()),
((mask & SHADER_PALETTE_OVERRIDE) ? NULL : document.getOrCreateShaderPool()) ));
}
// Add this implementation to parent implementation.
if (_parent.valid())

View File

@ -41,7 +41,9 @@ public:
virtual void apply(ProxyNode& node)
{
// Transfer ownership of pools.
_options->setUserData( node.getUserData() );
node.setUserData(NULL);
for (unsigned int pos=0; pos<node.getNumFileNames(); pos++)
{