Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
93f9b471e6
37 changed files with 186 additions and 339 deletions
src
ATC
ATCDCL
Aircraft
Airports
FDM/YASim
Include
Input
Instrumentation
HUD
airspeed_indicator.cxxattitude_indicator.cxxheading_indicator.cxxheading_indicator_fg.cxxinst_vertical_speed_indicator.cxxslip_skid_ball.cxxturn_indicator.cxxvertical_speed_indicator.cxxMain
Model
Navaids
Scenery
Sound
Systems
utils
|
@ -18,6 +18,10 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Main/fg_commands.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
|
|
|
@ -205,7 +205,13 @@ void FGATCDialog::PopupDialog() {
|
|||
button_group->removeChildren("button", false);
|
||||
|
||||
string label;
|
||||
FGATC* atcptr = globals->get_ATC_mgr()->GetComm1ATCPointer(); // Hardwired to comm1 at the moment
|
||||
FGATCMgr* pAtcMgr = globals->get_ATC_mgr();
|
||||
if (!pAtcMgr)
|
||||
{
|
||||
SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops...");
|
||||
return;
|
||||
}
|
||||
FGATC* atcptr = pAtcMgr->GetComm1ATCPointer(); // Hardwired to comm1 at the moment
|
||||
|
||||
if (!atcptr) {
|
||||
label = "Not currently tuned to any ATC service";
|
||||
|
@ -260,7 +266,13 @@ void FGATCDialog::PopupDialog() {
|
|||
}
|
||||
|
||||
void FGATCDialog::PopupCallback(int num) {
|
||||
FGATC* atcptr = globals->get_ATC_mgr()->GetComm1ATCPointer(); // FIXME - Hardwired to comm1 at the moment
|
||||
FGATCMgr* pAtcMgr = globals->get_ATC_mgr();
|
||||
if (!pAtcMgr)
|
||||
{
|
||||
SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops...");
|
||||
return;
|
||||
}
|
||||
FGATC* atcptr = pAtcMgr->GetComm1ATCPointer(); // FIXME - Hardwired to comm1 at the moment
|
||||
|
||||
if (!atcptr)
|
||||
return;
|
||||
|
|
|
@ -48,6 +48,7 @@ FGATCMgr::FGATCMgr() :
|
|||
voice(false),
|
||||
#endif
|
||||
{
|
||||
globals->set_ATC_mgr(this);
|
||||
}
|
||||
|
||||
FGATCMgr::~FGATCMgr() {
|
||||
|
|
|
@ -76,7 +76,14 @@ FGATIS::FGATIS() :
|
|||
_prev_display(0),
|
||||
refname("atis")
|
||||
{
|
||||
_vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS);
|
||||
FGATCMgr* pAtcMgr = globals->get_ATC_mgr();
|
||||
if (!pAtcMgr)
|
||||
{
|
||||
SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops...");
|
||||
_vPtr = NULL;
|
||||
}
|
||||
else
|
||||
_vPtr = pAtcMgr->GetVoicePointer(ATIS);
|
||||
_voiceOK = (_vPtr == NULL ? false : true);
|
||||
if (!(_type != ATIS || _type == AWOS)) {
|
||||
SG_LOG(SG_ATC, SG_ALERT, "ERROR - _type not ATIS or AWOS in atis.cxx");
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
#include <osg/Geode>
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/xml/easyxml.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "BodyEnvironment.hpp"
|
||||
#include "RigidBody.hpp"
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include "Math.hpp"
|
||||
|
|
|
@ -139,7 +139,14 @@ void YASim::init()
|
|||
SGPath f(fgGetString("/sim/aircraft-dir"));
|
||||
f.append(fgGetString("/sim/aero"));
|
||||
f.concat(".xml");
|
||||
readXML(f.str(), *_fdm);
|
||||
try {
|
||||
readXML(f.str(), *_fdm);
|
||||
} catch (const sg_exception &e) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||
"Error reading YASim FDM: '" << f.str() << "'" << std::endl
|
||||
<< e.getFormattedMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Compile it into a real airplane, and tell the user what they got
|
||||
a->compile();
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
/**************************************************************************
|
||||
* fg_callback.hxx -- Wrapper classes to treat function and method pointers
|
||||
* as objects.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _FG_CALLBACK_HXX
|
||||
#define _FG_CALLBACK_HXX
|
||||
|
||||
/**
|
||||
* Abstract base class for all FlightGear callbacks.
|
||||
*/
|
||||
class fgCallback
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual ~fgCallback() {}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual fgCallback* clone() const = 0;
|
||||
|
||||
/**
|
||||
* Execute the callback function.
|
||||
*/
|
||||
virtual void operator()() = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fgCallback() {}
|
||||
|
||||
private:
|
||||
// Not implemented.
|
||||
void operator=( const fgCallback& );
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for invoking a file scope function.
|
||||
*/
|
||||
template< typename Fun >
|
||||
class fgFunctionCallback : public fgCallback
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fgFunctionCallback( const Fun& fun )
|
||||
: fgCallback(), f_(fun) {}
|
||||
|
||||
fgCallback* clone() const
|
||||
{
|
||||
return new fgFunctionCallback( *this );
|
||||
}
|
||||
|
||||
void operator()() { f_(); }
|
||||
|
||||
private:
|
||||
// Not defined.
|
||||
fgFunctionCallback();
|
||||
|
||||
private:
|
||||
Fun f_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for invoking a member function.
|
||||
*/
|
||||
template< class ObjPtr, typename MemFn >
|
||||
class fgMethodCallback : public fgCallback
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fgMethodCallback( const ObjPtr& pObj, MemFn pMemFn )
|
||||
: fgCallback(),
|
||||
pObj_(pObj),
|
||||
pMemFn_(pMemFn)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fgCallback* clone() const
|
||||
{
|
||||
return new fgMethodCallback( *this );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void operator()()
|
||||
{
|
||||
((*pObj_).*pMemFn_)();
|
||||
}
|
||||
|
||||
private:
|
||||
// Not defined.
|
||||
fgMethodCallback();
|
||||
|
||||
private:
|
||||
ObjPtr pObj_;
|
||||
MemFn pMemFn_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper template functions.
|
||||
*/
|
||||
|
||||
template< typename Fun >
|
||||
fgCallback*
|
||||
make_callback( const Fun& fun )
|
||||
{
|
||||
return new fgFunctionCallback<Fun>(fun);
|
||||
}
|
||||
|
||||
template< class ObjPtr, typename MemFn >
|
||||
fgCallback*
|
||||
make_callback( const ObjPtr& pObj, MemFn pMemFn )
|
||||
{
|
||||
return new fgMethodCallback<ObjPtr,MemFn>(pObj, pMemFn );
|
||||
}
|
||||
|
||||
#endif // _FG_CALLBACK_HXX
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
// Alterations: Copyright C. Hotchkiss 1996
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.2 2010/01/23 22:26:52 fredb
|
||||
// MINGW patch from Benoît Laniel
|
||||
//
|
||||
// Revision 1.1.1.1 2002-09-10 01:14:04 curt
|
||||
// Initial revision of FlightGear-0.9.0
|
||||
//
|
||||
// Revision 1.2 2001/05/16 21:27:59 curt
|
||||
// Added David Megginson's patch for reconfigurable keyboard bindings.
|
||||
//
|
||||
// Revision 1.1.1.1 1999/06/17 18:07:30 curt
|
||||
// Start of 0.7.x branch
|
||||
//
|
||||
// Revision 1.2 1999/04/22 18:45:42 curt
|
||||
// Borland tweaks.
|
||||
//
|
||||
// Revision 1.1.1.1 1999/04/05 21:32:40 curt
|
||||
// Start of 0.6.x branch.
|
||||
//
|
||||
// Revision 1.2 1998/05/13 18:23:46 curt
|
||||
// fg_typedefs.h: updated version by Charlie Hotchkiss
|
||||
// general.h: moved fg_root info to fgOPTIONS structure.
|
||||
//
|
||||
// Revision 1.1 1998/05/11 18:26:12 curt
|
||||
// Initial revision.
|
||||
//
|
||||
// Rev 1.4 11 Nov 1997 15:34:28 CHOTCHKISS
|
||||
// Expanded definitions.
|
||||
//
|
||||
// Rev 1.3 20 Jan 1997 9:21:26 CHOTCHKISS
|
||||
// Minor additions.
|
||||
//
|
||||
// Rev 1.2 12 Nov 1996 15:06:52 CHOTCHKISS
|
||||
// Dropped PC Write print format control lines.
|
||||
//
|
||||
// Rev 1.1 20 Nov 1995 15:59:02 CHOTCHKISS
|
||||
// Additions and improvements. Memcheck compatibilities.
|
||||
//
|
||||
// Rev 1.0 06 Apr 1995 14:00:32 CHOTCHKISS
|
||||
// Initial revision.
|
||||
|
||||
*/
|
||||
/*
|
||||
// TYPEDEFS.H - General purpose definition file
|
||||
// Copyright (C) 1992 Paradigm Systems. All rights reserved.
|
||||
//
|
||||
// Function
|
||||
// ========
|
||||
// This file contains the general purpose definitions common to the
|
||||
// all Paradigm applications. By defining synonyms for the physical
|
||||
// data types to be manipulated, portability between memory models
|
||||
// and machines is maximized.
|
||||
//
|
||||
// Note that this file follows the system include files and before
|
||||
// any application include files.
|
||||
*/
|
||||
|
||||
#ifndef _FG_TYPEDEFS
|
||||
#define _FG_TYPEDEFS
|
||||
|
||||
//
|
||||
// Define the types to be used to manipulate 8-, 16-, and 32-bit
|
||||
// data.
|
||||
//
|
||||
typedef unsigned int BIT ; // Use for defining Borland bit fields
|
||||
typedef char CHAR ; // 8-bit signed data
|
||||
typedef const char COCHAR;
|
||||
typedef unsigned char UCHAR ; // 8-bit unsigned data
|
||||
typedef unsigned char BYTE;
|
||||
typedef int INT ; // 16-bit signed data
|
||||
typedef unsigned int UINT ; // 16-bit unsigned data
|
||||
typedef const int COINT; // 16=bit constant int
|
||||
typedef const UINT COUINT;
|
||||
typedef long LONG ; // 32-bit signed data
|
||||
typedef unsigned long ULONG ; // 32-bit unsigned data
|
||||
|
||||
typedef unsigned short UWORD; // Unsigned 16 bit quantity (WIN=SHORT)
|
||||
#ifndef _WIN32
|
||||
typedef signed short WORD; // Signed 16 bit quantity
|
||||
#endif
|
||||
typedef BYTE UBYTE; // Used in some 3rd party code
|
||||
#ifndef _WIN32
|
||||
typedef int BOOLEAN; //
|
||||
#endif
|
||||
|
||||
typedef float FLOAT ; // 32-bit floating point data
|
||||
typedef double DOUBLE ; // 64-bit floating point data
|
||||
typedef long double LDOUBLE ; // 80-bit floating point data
|
||||
|
||||
typedef void(*VFNPTR) ( void );
|
||||
typedef void(*VFNINTPTR)( int );
|
||||
typedef int (*FNPTR) ( void );
|
||||
typedef int (*FNINTPTR) ( int );
|
||||
typedef int (*FNUIPTR) ( UINT );
|
||||
typedef double( *DBLFNPTR)( void );
|
||||
typedef float( *FLTFNPTR)( void );
|
||||
|
||||
#endif // _FG_TYPEDEFS
|
|
@ -22,6 +22,10 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "FGJoystickInput.hxx"
|
||||
|
||||
#include <simgear/props/props_io.hxx>
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "FGKeyboardInput.hxx"
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
|
|
|
@ -225,7 +225,7 @@ static struct enbet {
|
|||
};
|
||||
|
||||
|
||||
class EventNameByEventType : public map<unsigned,const char*> {
|
||||
class EventNameByEventType : public std::map<unsigned,const char*> {
|
||||
public:
|
||||
EventNameByEventType() {
|
||||
for( unsigned i = 0; i < sizeof(EVENT_NAMES_BY_EVENT_TYPE)/sizeof(EVENT_NAMES_BY_EVENT_TYPE[0]); i++ )
|
||||
|
@ -234,7 +234,7 @@ public:
|
|||
};
|
||||
static EventNameByEventType EVENT_NAME_BY_EVENT_TYPE;
|
||||
|
||||
class EventNameByType : public map<TypeCode,const char*> {
|
||||
class EventNameByType : public std::map<TypeCode,const char*> {
|
||||
public:
|
||||
EventNameByType() {
|
||||
for( unsigned i = 0; i < sizeof(EVENT_TYPES)/sizeof(EVENT_TYPES[0]); i++ )
|
||||
|
@ -246,11 +246,11 @@ static EventNameByType EVENT_NAME_BY_TYPE;
|
|||
|
||||
struct ltstr {
|
||||
bool operator()(const char * s1, const char * s2 ) const {
|
||||
return string(s1).compare( s2 ) < 0;
|
||||
return std::string(s1).compare( s2 ) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
class EventTypeByName : public map<const char *,TypeCode,ltstr> {
|
||||
class EventTypeByName : public std::map<const char *,TypeCode,ltstr> {
|
||||
public:
|
||||
EventTypeByName() {
|
||||
for( unsigned i = 0; i < sizeof(EVENT_TYPES)/sizeof(EVENT_TYPES[0]); i++ )
|
||||
|
@ -260,7 +260,7 @@ public:
|
|||
static EventTypeByName EVENT_TYPE_BY_NAME;
|
||||
|
||||
|
||||
FGLinuxInputDevice::FGLinuxInputDevice( string aName, string aDevname ) :
|
||||
FGLinuxInputDevice::FGLinuxInputDevice( std::string aName, std::string aDevname ) :
|
||||
FGInputDevice(aName),
|
||||
devname( aDevname ),
|
||||
fd(-1)
|
||||
|
@ -290,7 +290,7 @@ void FGLinuxInputDevice::Open()
|
|||
{
|
||||
if( fd != -1 ) return;
|
||||
if( (fd = ::open( devname.c_str(), O_RDWR )) == -1 ) {
|
||||
throw exception();
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
if( GetGrab() && ioctl( fd, EVIOCGRAB, 2 ) == -1 ) {
|
||||
|
@ -440,7 +440,7 @@ const char * FGLinuxInputDevice::TranslateEventName( FGEventData & eventData )
|
|||
return EVENT_NAME_BY_TYPE[typeCode];
|
||||
}
|
||||
|
||||
void FGLinuxInputDevice::SetDevname( string name )
|
||||
void FGLinuxInputDevice::SetDevname( std::string name )
|
||||
{
|
||||
this->devname = name;
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ void FGLinuxEventInput::update( double dt )
|
|||
// index the input devices by the associated fd and prepare
|
||||
// the pollfd array by filling in the file descriptor
|
||||
struct pollfd fds[input_devices.size()];
|
||||
map<int,FGLinuxInputDevice*> devicesByFd;
|
||||
map<int,FGInputDevice*>::const_iterator it;
|
||||
std::map<int,FGLinuxInputDevice*> devicesByFd;
|
||||
std::map<int,FGInputDevice*>::const_iterator it;
|
||||
int i;
|
||||
for( i=0, it = input_devices.begin(); it != input_devices.end(); ++it, i++ ) {
|
||||
FGInputDevice* p = (*it).second;
|
||||
|
|
|
@ -43,7 +43,7 @@ struct FGLinuxEventData : public FGEventData {
|
|||
class FGLinuxInputDevice : public FGInputDevice {
|
||||
public:
|
||||
FGLinuxInputDevice();
|
||||
FGLinuxInputDevice( string name, string devname );
|
||||
FGLinuxInputDevice( std::string name, std::string devname );
|
||||
virtual ~FGLinuxInputDevice();
|
||||
|
||||
virtual void Open();
|
||||
|
@ -51,17 +51,17 @@ public:
|
|||
virtual void Send( const char * eventName, double value );
|
||||
virtual const char * TranslateEventName( FGEventData & eventData );
|
||||
|
||||
void SetDevname( const string name );
|
||||
string GetDevname() const { return devname; }
|
||||
void SetDevname( const std::string name );
|
||||
std::string GetDevname() const { return devname; }
|
||||
|
||||
int GetFd() { return fd; }
|
||||
|
||||
double Normalize( struct input_event & event );
|
||||
private:
|
||||
string devname;
|
||||
std::string devname;
|
||||
int fd;
|
||||
|
||||
map<unsigned int,input_absinfo> absinfo;
|
||||
std::map<unsigned int,input_absinfo> absinfo;
|
||||
};
|
||||
|
||||
class FGLinuxEventInput : public FGEventInput {
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "FGMouseInput.hxx"
|
||||
#include "Main/globals.hxx"
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ using std::vector;
|
|||
#include <Airports/runways.hxx> // FGRunway
|
||||
#include <GUI/gui.h> // fntRenderer ? guiErrorMessage()
|
||||
#include <GUI/new_gui.hxx> // FGFontCache, FGColor
|
||||
#include <Include/fg_typedefs.h>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <simgear/math/interpolater.hxx>
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
// TODO:
|
||||
// - better spin-up
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/sg_inlines.h>
|
||||
#include <iostream>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
#include <simgear/math/interpolater.hxx>
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "slip_skid_ball.hxx"
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/util.hxx>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <simgear/math/interpolater.hxx>
|
||||
|
||||
#include "vertical_speed_indicator.hxx"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
||||
#include <simgear/scene/material/matlib.hxx>
|
||||
#include <simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/tgdb/userdata.hxx>
|
||||
#include <simgear/scene/tgdb/TileEntry.hxx>
|
||||
#include <simgear/scene/model/ModelRegistry.hxx>
|
||||
|
@ -223,15 +223,14 @@ fgviewerMain(int argc, char** argv)
|
|||
// The file path list must be set in the registry.
|
||||
osgDB::Registry::instance()->getDataFilePathList() = filePathList;
|
||||
|
||||
SGReaderWriterBTGOptions* btgOptions = new SGReaderWriterBTGOptions;
|
||||
btgOptions->getDatabasePathList() = filePathList;
|
||||
btgOptions->setMatlib(globals->get_matlib());
|
||||
btgOptions->setUseRandomObjects(fgGetBool("/sim/rendering/random-objects", false));
|
||||
btgOptions->setUseRandomVegetation(fgGetBool("/sim/rendering/random-vegetation", false));
|
||||
simgear::SGReaderWriterOptions* options = new simgear::SGReaderWriterOptions;
|
||||
options->getDatabasePathList() = filePathList;
|
||||
options->setMaterialLib(globals->get_matlib());
|
||||
options->setPropertyNode(globals->get_props());
|
||||
|
||||
// read the scene from the list of file specified command line args.
|
||||
osg::ref_ptr<osg::Node> loadedModel;
|
||||
loadedModel = osgDB::readNodeFiles(dataFiles, btgOptions);
|
||||
loadedModel = osgDB::readNodeFiles(dataFiles, options);
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
if (!loadedModel.valid()) {
|
||||
|
|
|
@ -80,6 +80,7 @@ using std::cout;
|
|||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::vector;
|
||||
using std::cin;
|
||||
|
||||
#define NEW_DEFAULT_MODEL_HZ 120
|
||||
|
||||
|
@ -2189,8 +2190,8 @@ void Options::showUsage() const
|
|||
cout << "For a complete list of options use --help --verbose" << endl;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
cout << "Hit a key to continue..." << endl;
|
||||
cin.get();
|
||||
std::cout << "Hit a key to continue..." << std::endl;
|
||||
std::cin.get();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
|
|||
osg::Node *object;
|
||||
|
||||
try {
|
||||
object = SGModelLib::loadPagedModel(path, globals->get_props());
|
||||
object = SGModelLib::loadDeferredModel(path, globals->get_props());
|
||||
} catch (const sg_throwable& t) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n "
|
||||
<< t.getFormattedMessage() << t.getOrigin());
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Navaids/routePath.hxx>
|
||||
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/scene/model/modellib.hxx>
|
||||
#include <simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/tsync/terrasync.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
|
@ -55,33 +55,11 @@ using simgear::TileEntry;
|
|||
using simgear::TileCache;
|
||||
|
||||
|
||||
// helper: listen to property changes affecting tile loading
|
||||
class LoaderPropertyWatcher : public SGPropertyChangeListener
|
||||
{
|
||||
public:
|
||||
LoaderPropertyWatcher(FGTileMgr* pTileMgr) :
|
||||
_pTileMgr(pTileMgr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void valueChanged(SGPropertyNode*)
|
||||
{
|
||||
_pTileMgr->configChanged();
|
||||
}
|
||||
|
||||
private:
|
||||
FGTileMgr* _pTileMgr;
|
||||
};
|
||||
|
||||
|
||||
FGTileMgr::FGTileMgr():
|
||||
state( Start ),
|
||||
vis( 16000 ),
|
||||
_terra_sync(NULL),
|
||||
_propListener(new LoaderPropertyWatcher(this))
|
||||
_terra_sync(NULL)
|
||||
{
|
||||
_randomObjects = fgGetNode("/sim/rendering/random-objects", true);
|
||||
_randomVegetation = fgGetNode("/sim/rendering/random-vegetation", true);
|
||||
_maxTileRangeM = fgGetNode("/sim/rendering/static-lod/bare", true);
|
||||
}
|
||||
|
||||
|
@ -91,8 +69,6 @@ FGTileMgr::~FGTileMgr()
|
|||
// remove all nodes we might have left behind
|
||||
osg::Group* group = globals->get_scenery()->get_terrain_branch();
|
||||
group->removeChildren(0, group->getNumChildren());
|
||||
delete _propListener;
|
||||
_propListener = NULL;
|
||||
// clear OSG cache
|
||||
osgDB::Registry::instance()->clearObjectCache();
|
||||
}
|
||||
|
@ -102,12 +78,9 @@ FGTileMgr::~FGTileMgr()
|
|||
void FGTileMgr::init() {
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "Initializing Tile Manager subsystem." );
|
||||
|
||||
_options = new SGReaderWriterBTGOptions;
|
||||
_options->setMatlib(globals->get_matlib());
|
||||
|
||||
_randomObjects.get()->addChangeListener(_propListener, false);
|
||||
_randomVegetation.get()->addChangeListener(_propListener, false);
|
||||
configChanged();
|
||||
_options = new simgear::SGReaderWriterOptions;
|
||||
_options->setMaterialLib(globals->get_matlib());
|
||||
_options->setPropertyNode(globals->get_props());
|
||||
|
||||
osgDB::FilePathList &fp = _options->getDatabasePathList();
|
||||
const string_list &sc = globals->get_fg_scenery();
|
||||
|
@ -121,6 +94,10 @@ void FGTileMgr::init() {
|
|||
reinit();
|
||||
}
|
||||
|
||||
void FGTileMgr::refresh_tile(void* tileMgr, long tileIndex)
|
||||
{
|
||||
((FGTileMgr*) tileMgr)->tile_cache.refresh_tile(tileIndex);
|
||||
}
|
||||
|
||||
void FGTileMgr::reinit()
|
||||
{
|
||||
|
@ -143,18 +120,12 @@ void FGTileMgr::reinit()
|
|||
|
||||
_terra_sync = (simgear::SGTerraSync*) globals->get_subsystem("terrasync");
|
||||
if (_terra_sync)
|
||||
_terra_sync->setTileCache(&tile_cache);
|
||||
_terra_sync->setTileRefreshCb(&refresh_tile, this);
|
||||
|
||||
// force an update now
|
||||
update(0.0);
|
||||
}
|
||||
|
||||
void FGTileMgr::configChanged()
|
||||
{
|
||||
_options->setUseRandomObjects(_randomObjects.get()->getBoolValue());
|
||||
_options->setUseRandomVegetation(_randomVegetation.get()->getBoolValue());
|
||||
}
|
||||
|
||||
/* schedule a tile for loading, keep request for given amount of time.
|
||||
* Returns true if tile is already loaded. */
|
||||
bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_view, double duration)
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <simgear/scene/tgdb/TileEntry.hxx>
|
||||
#include <simgear/scene/tgdb/TileCache.hxx>
|
||||
|
||||
class SGReaderWriterBTGOptions;
|
||||
|
||||
namespace osg
|
||||
{
|
||||
class Node;
|
||||
|
@ -41,6 +39,7 @@ class Node;
|
|||
namespace simgear
|
||||
{
|
||||
class SGTerraSync;
|
||||
class SGReaderWriterOptions;
|
||||
}
|
||||
|
||||
class FGTileMgr : public SGSubsystem, public simgear::ModelLoadHelper {
|
||||
|
@ -65,7 +64,7 @@ private:
|
|||
SGBucket previous_bucket;
|
||||
SGBucket current_bucket;
|
||||
SGBucket pending;
|
||||
osg::ref_ptr<SGReaderWriterBTGOptions> _options;
|
||||
osg::ref_ptr<simgear::SGReaderWriterOptions> _options;
|
||||
|
||||
// x and y distance of tiles to load/draw
|
||||
float vis;
|
||||
|
@ -86,10 +85,9 @@ private:
|
|||
// internal function, do not call directly.)
|
||||
void update_queues();
|
||||
|
||||
static void refresh_tile(void* tileMgr, long tileIndex);
|
||||
|
||||
SGPropertyNode* _visibilityMeters;
|
||||
SGPropertyChangeListener* _propListener;
|
||||
SGPropertyNode_ptr _randomObjects;
|
||||
SGPropertyNode_ptr _randomVegetation;
|
||||
SGPropertyNode_ptr _maxTileRangeM;
|
||||
|
||||
public:
|
||||
|
@ -103,9 +101,6 @@ public:
|
|||
|
||||
virtual void update(double dt);
|
||||
|
||||
// update loader configuration options
|
||||
void configChanged();
|
||||
|
||||
int schedule_tiles_at(const SGGeod& location, double rangeM);
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <sstream>
|
||||
#include <simgear/compiler.h>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
//
|
||||
// This file is in the Public Domain and comes with no warranty.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "static.hxx"
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <simgear/io/sg_socket.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class PropertySetter {
|
||||
public:
|
||||
PropertySetter( SGPropertyNode_ptr node ) : _node(node) {}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "FGTextureLoaderInterface.hxx"
|
||||
|
||||
class FGPanelInstrument;
|
||||
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Texture management.
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// fgviewer.cxx -- alternative flightgear viewer application
|
||||
//
|
||||
// Copyright (C) 2009 - 2011 Mathias Froehlich
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
|
@ -18,7 +40,7 @@
|
|||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
||||
#include <simgear/scene/material/matlib.hxx>
|
||||
#include <simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/tgdb/userdata.hxx>
|
||||
#include <simgear/scene/tgdb/TileEntry.hxx>
|
||||
#include <simgear/scene/model/ModelRegistry.hxx>
|
||||
|
@ -95,24 +117,23 @@ main(int argc, char** argv)
|
|||
} else if (const char *fg_root_env = std::getenv("FG_ROOT")) {
|
||||
fg_root = fg_root_env;
|
||||
} else {
|
||||
#if defined(PKGDATADIR)
|
||||
fg_root = PKGDATADIR;
|
||||
#if defined(PKGLIBDIR)
|
||||
fg_root = PKGLIBDIR;
|
||||
#else
|
||||
fg_root = ".";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string fg_scenery;
|
||||
string_list path_list;
|
||||
if (arguments.read("--fg-scenery", fg_scenery)) {
|
||||
path_list.push_back(fg_scenery);
|
||||
} else if (const char *fg_scenery_env = std::getenv("FG_SCENERY")) {
|
||||
path_list = sgPathSplit(fg_scenery_env);
|
||||
fg_scenery = fg_scenery_env;
|
||||
} else {
|
||||
SGPath path(fg_root);
|
||||
path.append("Scenery");
|
||||
path_list.push_back(path.str());
|
||||
fg_scenery = path.str();
|
||||
}
|
||||
string_list path_list = sgPathSplit(fg_scenery);
|
||||
osgDB::FilePathList filePathList;
|
||||
filePathList.push_back(fg_root);
|
||||
for (unsigned i = 0; i < path_list.size(); ++i) {
|
||||
|
@ -151,9 +172,10 @@ main(int argc, char** argv)
|
|||
// The file path list must be set in the registry.
|
||||
osgDB::Registry::instance()->getDataFilePathList() = filePathList;
|
||||
|
||||
SGReaderWriterBTGOptions* btgOptions = new SGReaderWriterBTGOptions;
|
||||
btgOptions->getDatabasePathList() = filePathList;
|
||||
btgOptions->setMatlib(ml);
|
||||
simgear::SGReaderWriterOptions* options = new simgear::SGReaderWriterOptions;
|
||||
options->getDatabasePathList() = filePathList;
|
||||
options->setMaterialLib(ml);
|
||||
options->setPropertyNode(props);
|
||||
|
||||
// Here, all arguments are processed
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
@ -161,7 +183,7 @@ main(int argc, char** argv)
|
|||
|
||||
// read the scene from the list of file specified command line args.
|
||||
osg::ref_ptr<osg::Node> loadedModel;
|
||||
loadedModel = osgDB::readNodeFiles(arguments, btgOptions);
|
||||
loadedModel = osgDB::readNodeFiles(arguments, options);
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
if (!loadedModel.valid()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue