1
0
Fork 0

Fix for "falling through ground" problem

The LOD far range on the tile entry scenegraph node was initialized to
0. This meant that any traverals of active children that happened
before the tile manager updated the node would ignore the node
altogether. Among these is the groundcache traversal which was failing
at startup even though scenery was loaded.

Also added a function to dump scene graph nodes to files; very handy
in gdb.
This commit is contained in:
timoore 2007-12-20 23:20:51 +00:00
parent c00ab2588e
commit 853e371d1e
3 changed files with 25 additions and 4 deletions

View file

@ -249,8 +249,8 @@ public:
FGGroundCache::GroundProperty oldGp = mGroundProperty;
if (!enterNode(geode))
return;
for(unsigned i = 0; i < geode.getNumDrawables(); ++i)
unsigned int numDrawables = geode.getNumDrawables();
for(unsigned i = 0; i < numDrawables; ++i)
fillWith(geode.getDrawable(i));
sphIsec = oldSphIsec;
mGroundProperty = oldGp;
@ -438,12 +438,14 @@ public:
FGGroundCache::FGGroundCache() :
ground_radius(0.0),
_type(0),
_material(0),
cache_ref_time(0.0),
wire_id(0),
reference_wgs84_point(SGVec3d(0, 0, 0)),
reference_vehicle_radius(0.0),
found_ground(false),
_material(0)
down(0.0, 0.0, 0.0),
found_ground(false)
{
}

View file

@ -1077,5 +1077,11 @@ fgDumpTerrainBranchToFile(const char* filename)
filename );
}
// For debugging
bool
fgDumpNodeToFile(osg::Node* node, const char* filename)
{
return osgDB::writeNodeFile(*node, filename);
}
// end of renderer.cxx

View file

@ -151,6 +151,10 @@ FGTileEntry::FGTileEntry ( const SGBucket& b )
_node->setCullCallback(new TileCullCallback);
tileFileName += ".stg";
_node->setName(tileFileName);
// Give a default LOD range so that traversals that traverse
// active children (like the groundcache lookup) will work before
// tile manager has had a chance to update this node.
_node->setRange(0, 0.0, 10000.0);
}
@ -569,6 +573,11 @@ bool ReaderWriterSTG::acceptsExtension(const string& extension) const
|| osgDB::equalCaseInsensitive(extension, "stg"));
}
//#define SLOW_PAGER 1
#ifdef SLOW_PAGER
#include <unistd.h>
#endif
osgDB::ReaderWriter::ReadResult
ReaderWriterSTG::readNode(const string& fileName,
const osgDB::ReaderWriter::Options* options) const
@ -589,6 +598,10 @@ ReaderWriterSTG::readNode(const string& fileName,
osg::Node* result
= FGTileEntry::loadTileByName(osgDB::getNameLessExtension(stgFileName),
globals->get_fg_scenery());
// For debugging race conditions
#ifdef SLOW_PAGER
sleep(5);
#endif
if (result)
return result; // Constructor converts to ReadResult
else