Rebase photoscenery patch on next
This commit is contained in:
parent
b73413d52e
commit
88a8cada51
3 changed files with 33 additions and 2 deletions
|
@ -219,7 +219,7 @@ QString AddOnsController::addSceneryPath() const
|
|||
SGPath p(path.toStdString());
|
||||
bool isValid = false;
|
||||
|
||||
for (const auto& dir: {"Objects", "Terrain", "Buildings", "Roads", "Pylons", "NavData", "Airports"}) {
|
||||
for (const auto& dir: {"Objects", "Terrain", "Buildings", "Roads", "Pylons", "NavData", "Airports", "Orthophotos"}) {
|
||||
if ((p / dir).exists()) {
|
||||
isValid = true;
|
||||
break;
|
||||
|
@ -232,7 +232,7 @@ QString AddOnsController::addSceneryPath() const
|
|||
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
mb.setDefaultButton(QMessageBox::No);
|
||||
mb.setInformativeText(tr("Added scenery should contain at least one of the following "
|
||||
"folders: Objects, Terrain, Buildings, Roads, Pylons, NavData, Airports."));
|
||||
"folders: Objects, Terrain, Buildings, Roads, Pylons, NavData, Airports, Orthophotos."));
|
||||
mb.exec();
|
||||
|
||||
if (mb.result() == QMessageBox::No) {
|
||||
|
|
|
@ -46,6 +46,8 @@ TileEntry::TileEntry ( const SGBucket& b )
|
|||
_current_view(false),
|
||||
_time_expired(-1.0)
|
||||
{
|
||||
_create_orthophoto();
|
||||
|
||||
tileFileName += ".stg";
|
||||
_node->setName(tileFileName);
|
||||
// Give a default LOD range so that traversals that traverse
|
||||
|
@ -62,6 +64,8 @@ TileEntry::TileEntry( const TileEntry& t )
|
|||
_current_view(t._current_view),
|
||||
_time_expired(t._time_expired)
|
||||
{
|
||||
_create_orthophoto();
|
||||
|
||||
_node->setName(tileFileName);
|
||||
// Give a default LOD range so that traversals that traverse
|
||||
// active children (like the groundcache lookup) will work before
|
||||
|
@ -69,6 +73,22 @@ TileEntry::TileEntry( const TileEntry& t )
|
|||
_node->setRange(0, 0.0, 10000.0);
|
||||
}
|
||||
|
||||
void TileEntry::_create_orthophoto() {
|
||||
bool use_photoscenery = fgGetBool("/sim/rendering/photoscenery/enabled");
|
||||
if (use_photoscenery) {
|
||||
_orthophoto = simgear::Orthophoto::fromBucket(tile_bucket, globals->get_fg_scenery());
|
||||
if (_orthophoto) {
|
||||
simgear::OrthophotoManager::instance()->registerOrthophoto(tile_bucket.gen_index(), _orthophoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TileEntry::_free_orthophoto() {
|
||||
if (_orthophoto) {
|
||||
simgear::OrthophotoManager::instance()->unregisterOrthophoto(tile_bucket.gen_index());
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
TileEntry::~TileEntry ()
|
||||
{
|
||||
|
@ -115,5 +135,7 @@ TileEntry::removeFromSceneGraph()
|
|||
parent->removeChild( _node.get() );
|
||||
}
|
||||
}
|
||||
|
||||
_free_orthophoto();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <vector>
|
||||
|
@ -36,6 +39,7 @@
|
|||
|
||||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/scene/util/OrthophotoManager.hxx>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
@ -59,6 +63,8 @@ private:
|
|||
// Reference to DatabaseRequest object set and used by the
|
||||
// osgDB::DatabasePager.
|
||||
osg::ref_ptr<osg::Referenced> _databaseRequest;
|
||||
// Overlay image/orthophoto for this tile
|
||||
simgear::OrthophotoRef _orthophoto;
|
||||
|
||||
/**
|
||||
* This value is used by the tile scheduler/loader to load tiles
|
||||
|
@ -72,6 +78,9 @@ private:
|
|||
/** Time when tile expires. */
|
||||
double _time_expired;
|
||||
|
||||
void _create_orthophoto();
|
||||
void _free_orthophoto();
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
|
|
Loading…
Reference in a new issue