1
0
Fork 0

fgelev: Support WS3.0

added --use-vpb argument

fgelev: added --tile-file argument

fgelev: enable VPBActive via SGSceneFeatures() as well

When fgelev runs, it does not load the scenery through the normal
process of FGScenery::ScenerySwitchListener(), so
SGSceneFeatures::instance()->setVPBActive() won't get called
unless we do it manually here.
This commit is contained in:
Chris Frey 2020-11-15 16:47:18 -05:00 committed by Stuart Buchanan
parent e1cf9eff49
commit fddb32f5c1
2 changed files with 20 additions and 2 deletions

View file

@ -15,12 +15,13 @@
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\" Or try here: http://www.fsf.org/copyleft/gpl.html
.\"
.TH FGELEV 1 2017-06-04 FlightGear "FlightGear man pages"
.TH FGELEV 1 2020-11-15 FlightGear "FlightGear man pages"
.SH NAME
fgelev \- Compute FlightGear scenery elevation for a given list of points
.SH SYNOPSIS
\fBfgelev\fR [\fB\-\-expire\fR \fInum\fR] [\fB\-\-print\-solidness\fR]
[\fB\-\-fg\-root\fR \fIrootdir\fR] [\fB\-\-fg\-scenery\fR \fIscenerydir\fR]
[--tile-file osgbfilename] [--use-vpb]
.SH DESCRIPTION
.B fgelev
is a standalone utility that, given a list of points on standard input, prints
@ -102,6 +103,14 @@ uses the path specified in the
environment variable or, absent that, the
.B Scenery
subdirectory inside \fB$FG_ROOT\fR.
.TP
\fB\-\-tile\-file\fR \fIosgbfilename\fR
Use a specific tile file when searching for elevation details, instead
of scanning through the whole world.
.TP
\fB\-\-use\-vpb\fR
If specified, enables WS3.0 scenery behaviour, searching under the vpb/
subdirectory.
.SH "EXIT STATUS"
.B fgelev
exits with

View file

@ -41,6 +41,7 @@
#include <simgear/scene/model/ModelRegistry.hxx>
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include <simgear/scene/util/OptionsReadFileCallback.hxx>
#include <simgear/scene/util/SGSceneFeatures.hxx>
#include <simgear/scene/tgdb/userdata.hxx>
namespace sg = simgear;
@ -134,6 +135,10 @@ main(int argc, char** argv)
<< "Probably FG_ROOT is not properly set.");
}
bool use_vpb = arguments.read("--use-vpb");
props->setBoolValue("/scenery/use-vpb", use_vpb);
SGSceneFeatures::instance()->setVPBActive(use_vpb);
/// now set up the simgears required model stuff
simgear::ResourceManager::instance()->addBasePath(fg_root, simgear::ResourceManager::PRIORITY_DEFAULT);
@ -176,13 +181,17 @@ main(int argc, char** argv)
props->getNode("sim/rendering/random-objects", true)->setBoolValue(false);
props->getNode("sim/rendering/random-vegetation", true)->setBoolValue(false);
std::string bvhFile = "w180s90-360x180.spt";
if (arguments.read("--tile-file", s))
bvhFile = s;
// Here, all arguments are processed
arguments.reportRemainingOptionsAsUnrecognized();
arguments.writeErrorMessages(std::cerr);
// Get the whole world bvh tree
SGSharedPtr<sg::BVHNode> node;
node = sg::BVHPageNodeOSG::load("w180s90-360x180.spt", options);
node = sg::BVHPageNodeOSG::load(bvhFile, options);
// if no model has been successfully loaded report failure.
if (!node.valid()) {