From b62808bb4ccf0b1b8dd70d27cf453e58121f06b8 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Wed, 30 Dec 2020 16:38:04 +0000 Subject: [PATCH] Fix hang on "Loading Scenery" over the sea Previously attempting to start on an ocean tile with static models present cause FG to spin on "Loading Scenery". This was caused by not creating a BVH for an ocean tile in the specific case where there was STG models, due to a PagedLOD node being inserted in the scene graph. So FG never thought the scenery was loaded sufficient to place the aircraft. By explicitly creating a BVH for ocean tiles the problem is fixed. Candidate for 2020.X --- simgear/scene/tgdb/SGOceanTile.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simgear/scene/tgdb/SGOceanTile.cxx b/simgear/scene/tgdb/SGOceanTile.cxx index 9a41fe50..bbaef02c 100644 --- a/simgear/scene/tgdb/SGOceanTile.cxx +++ b/simgear/scene/tgdb/SGOceanTile.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -340,5 +341,10 @@ osg::Node* SGOceanTile(const SGBucket& b, SGMaterialLib *matlib, int latPoints, transform->addChild(geode); transform->setNodeMask( ~(simgear::CASTSHADOW_BIT | simgear::MODELLIGHT_BIT) ); + // Create a BVH at this point. This is normally provided by the file loader, but as we create the + // geometry programmatically, no file loader is involved. + BoundingVolumeBuildVisitor bvhBuilder(false); + transform->accept(bvhBuilder); + return transform; }