/test-btg

Simple test and explore BTG (Binary TerraGear) files

Primary LanguageC++GNU General Public License v2.0GPL-2.0

Test BTG File

This is a simple project to test and explore BTG (Binary TerraGear) scenery files.

Backgound:

The scenery of flightgear.org, wiki.flightgear, built by Terragear, source.

Documentation on the BTG file format can be found at BTG_File_Format.

The primary class is class SGBinObject, coded in sg_binobj.cxx, and sg_binobj.hxx.

Building:

Prereqisites:

  1. git - http://git-scm.com/downloads
  2. cmake - http://www.cmake.org/download/
  3. build tools, like MSVC in Windows, make/gcc in unix, etc
  4. simgear - http://simgear.sourceforge.net/downloads.html - which has its own dependencies
    1. OpenSceneGraph - http://www.openscenegraph.org/ - v 3.2 or later, which also has many dependencies
    2. plib - http://plib.sourceforge.net/ - v 1.8.5 or later
    3. boost - http://www.boost.org/ - v 1.37 or newer
    4. OpenAL - http://kcat.strangesoft.net/openal.html
    5. zlib - http://www.zlib.net/
    6. png - http://www.libpng.org/pub/png/pngcode.html
    7. freetype - http://www.freetype.org/download.html
    8. glut (freeglut) - http://freeglut.sourceforge.net/
    9. Plus some optional source, and some I have maybe forgotten!

Building SimGear from source is quite a difficult task. I have a repo which can help with that in windows - https://gitlab.com/fgtools/fg-win - where I have tried to include ALL the above sources. And for unix there is download_and_compile.sh

Building:

This project uses cmake to generate native build files. And as usual cmake is better run in an out-of-source build folder.

After the source has been cloned into a directory -

Unix

  1. $ cd build
  2. $ cmake ..
  3. $ make

Windows

  1. cd build
  2. cmake ..
  3. cmake --build . --config Release

Naturally, the 2nd step will FAIL is simgear, and othre prereqisite libraries are not found.

Or, of course the cmake GUI can be used, setting the appropriate source diectory, and the bnary directory to the build folder. Click [configure], perhaps several times until all errors are gone, then click [generate] to create the chosen generator files.

Then in windows, if MSVC is the generator, the MSVC IDE can be opened, and the test_btg.sln file loaded. Select the configuration desired, and build.

Running:

Running test-btg console app with --help, -? will show the brief help. In essence need to give the path to an .btg.gz file. If an .stg file is given, then each object listed in that STG file will be loaded and enumerated.

Also an input directory can be given, with --recurs (-r) to recurse into subdirectory finding all *.btg.gz and *.stg files, and each will be enumerated.

Of course the source of the flightgear scenery files, can be downloaded from scenery, where they can be downloaded using a grpahical interface, from mirror sites, using BitTorrent, or purchased on a DVD.

Additionally a small sample of the scenery is included in the flightgear base data, FGData, or by using terrasync, when running the fgfs simulator. The full source of the scenery files is here.

Essentially test-btg loads the .btg.gz file into memory, and enumerates its contents, giving more information if the 'verbosity', -v2, -v5, -v9, is increased.

It has an additional option to write some of the contents to an xgraph like file, -x out-file.xg, which can then be viewed in PolyView2D. A slightly update source of PolyView2D is part of this repo osm2xg ... in effect this produces a 2D rendering of the BTG file... I would love some day to render them in 3D.

Another tool which loads btg files is the Map component of Atlas/Map, or About Atlas and writes them out to jpeg or png image files to be loaded by Atlas. This repo Atlas-g is my updated source of this tool.

Have FUN!

; eof