Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
cbec277ed4
30 changed files with 603 additions and 338 deletions
1
projects/VC90/fgpanel/.gitignore
vendored
Executable file
1
projects/VC90/fgpanel/.gitignore
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
*.user
|
259
projects/VC90/fgpanel/fgpanel.vcproj
Executable file
259
projects/VC90/fgpanel/fgpanel.vcproj
Executable file
|
@ -0,0 +1,259 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="fgpanel"
|
||||
ProjectGUID="{FA27B353-179C-4DE8-B3AC-E260F8F790DD}"
|
||||
RootNamespace="fgpanel"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\..\src;..\..\..\src\include;..\..\..\src\FDM\JSBSim;..\..\..\..\SimGear;..\..\..\..\install\msvc90\OpenSceneGraph\include;..\..\..\..\3rdParty\include;..\..\..\..\boost_1_44_0"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;HAVE_CONFIG_H;FGFS;ENABLE_AUDIO_SUPPORT;_FG_NDEBUG;ENABLE_THREADS=1;FG_ENABLE_MULTIPASS_CLOUDS;ENABLE_SP_FMDS;_USE_MATH_DEFINES;FG_JPEG_SERVER;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_VERSION_H=$(HAVE_VERSION_H)0"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wsock32.lib net.lib sg.lib pui.lib fnt.lib ul.lib libpng.lib zlib.lib "
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\..\install\msvc90\OpenSceneGraph\lib;..\..\..\..\3rdParty\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\ApplicationProperties.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGFontCache.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGFontCache.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGGLApplication.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGGLApplication.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPanelApplication.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPanelApplication.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPanelProtocol.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPanelProtocol.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPNGTextureLoader.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGPNGTextureLoader.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGRGBTextureLoader.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGRGBTextureLoader.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\FGTextureLoaderInterface.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\main.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\panel.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\panel.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\panel_io.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\utils\fgpanel\panel_io.hxx"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -182,7 +182,7 @@ void FGAIBallistic::bind() {
|
|||
|
||||
props->tie("sim/time/elapsed-sec",
|
||||
SGRawValueMethods<FGAIBallistic,double>(*this,
|
||||
&FGAIBallistic::_getTime));
|
||||
&FGAIBallistic::_getTime, &FGAIBallistic::setTime));
|
||||
//props->tie("mass-slug",
|
||||
// SGRawValueMethods<FGAIBallistic,double>(*this,
|
||||
// &FGAIBallistic::getMass));
|
||||
|
@ -586,6 +586,7 @@ void FGAIBallistic::setHt(double h, double dt, double coeff){
|
|||
int FGAIBallistic::setHdg(double tgt_hdg, double dt, double coeff){
|
||||
double recip = getRecip(hdg);
|
||||
double c = dt / (coeff + dt);
|
||||
//cout << "set heading " << tgt_hdg << endl;
|
||||
//we need to ensure that we turn the short way to the new hdg
|
||||
if (tgt_hdg < recip && tgt_hdg < hdg && hdg > 180) {
|
||||
hdg = ((tgt_hdg + 360) * c) + (hdg * (1 - c));
|
||||
|
@ -626,6 +627,9 @@ void FGAIBallistic::setTgtZOffset(double z){
|
|||
|
||||
void FGAIBallistic::slaveToAC(double dt){
|
||||
|
||||
if (invisible)
|
||||
return;
|
||||
|
||||
double hdg, pch, rll, agl = 0;
|
||||
|
||||
if (_pnode != 0) {
|
||||
|
@ -652,6 +656,7 @@ void FGAIBallistic::slaveToAC(double dt){
|
|||
setPitch(pch + _pitch_offset);
|
||||
setBank(rll + _roll_offset);
|
||||
setOffsetVelocity(dt, pos);
|
||||
setTime(0);
|
||||
|
||||
//update the mass (slugs)
|
||||
_mass = (_weight_lb + getContents()) / slugs_to_lbs;
|
||||
|
@ -710,23 +715,13 @@ void FGAIBallistic::Run(double dt) {
|
|||
speed = 0.0;
|
||||
|
||||
double speed_fps = speed * SG_KT_TO_FPS;
|
||||
//double hs;
|
||||
|
||||
// calculate vertical and horizontal speed components
|
||||
if (speed == 0.0) {
|
||||
hs = vs = 0.0;
|
||||
} else {
|
||||
vs = sin( _elevation * SG_DEGREES_TO_RADIANS ) * speed_fps;
|
||||
hs = cos( _elevation * SG_DEGREES_TO_RADIANS ) * speed_fps;
|
||||
}
|
||||
calcVSHS();
|
||||
|
||||
//resolve horizontal speed into north and east components:
|
||||
double speed_north_fps = cos(_azimuth / SG_RADIANS_TO_DEGREES) * hs;
|
||||
double speed_east_fps = sin(_azimuth / SG_RADIANS_TO_DEGREES) * hs;
|
||||
|
||||
// convert horizontal speed (fps) to degrees per second
|
||||
double speed_north_deg_sec = speed_north_fps / ft_per_deg_lat;
|
||||
double speed_east_deg_sec = speed_east_fps / ft_per_deg_lon;
|
||||
//and convert horizontal speed (fps) to degrees per second
|
||||
calcNE();
|
||||
|
||||
// if wind not required, set to zero
|
||||
if (!_wind) {
|
||||
|
@ -755,55 +750,61 @@ void FGAIBallistic::Run(double dt) {
|
|||
double friction_force_speed_north_deg_sec = 0;
|
||||
double friction_force_speed_east_deg_sec = 0;
|
||||
double force_elevation_deg = 0;
|
||||
double force_azimuth_deg = 0;
|
||||
double force_lbs = 0;
|
||||
|
||||
if (_external_force) {
|
||||
//cout << _name << " external force" << endl;
|
||||
//cout << _name << " external force " << hdg << " az " << _azimuth << endl;
|
||||
|
||||
SGPropertyNode *n = fgGetNode(_force_path.c_str(), true);
|
||||
double force_lbs = n->getChild("force-lb", 0, true)->getDoubleValue();
|
||||
force_elevation_deg = n->getChild("force-elevation-deg", 0, true)->getDoubleValue();
|
||||
double force_azimuth_deg = n->getChild("force-azimuth-deg", 0, true)->getDoubleValue();
|
||||
force_lbs = n->getChild("force-lb", 0, true)->getDoubleValue();
|
||||
force_elevation_deg = n->getChild("force-elevation-deg", 0, true)->getDoubleValue();
|
||||
force_azimuth_deg = n->getChild("force-azimuth-deg", 0, true)->getDoubleValue();
|
||||
|
||||
//resolve force into vertical and horizontal components:
|
||||
double v_force_lbs = force_lbs * sin( force_elevation_deg * SG_DEGREES_TO_RADIANS );
|
||||
h_force_lbs = force_lbs * cos( force_elevation_deg * SG_DEGREES_TO_RADIANS );
|
||||
|
||||
//ground interaction
|
||||
//we don't do this if impacts are calculated
|
||||
if(!_report_impact){
|
||||
|
||||
if (getHtAGL(10000)){
|
||||
double deadzone = 0.1;
|
||||
if (getHtAGL(10000)){
|
||||
double deadzone = 0.1;
|
||||
|
||||
if (_ht_agl_ft <= (0 + _ground_offset + deadzone) && _solid){
|
||||
normal_force_lbs = (_mass * slugs_to_lbs) - v_force_lbs;
|
||||
if (_ht_agl_ft <= (0 + _ground_offset + deadzone) && _solid){
|
||||
normal_force_lbs = (_mass * slugs_to_lbs) - v_force_lbs;
|
||||
|
||||
if ( normal_force_lbs < 0 )
|
||||
normal_force_lbs = 0;
|
||||
if ( normal_force_lbs < 0 )
|
||||
normal_force_lbs = 0;
|
||||
|
||||
pos.setElevationFt(0 + _ground_offset);
|
||||
if (vs < 0)
|
||||
vs = -vs * 0.5;
|
||||
pos.setElevationFt(0 + _ground_offset);
|
||||
if (vs < 0)
|
||||
vs = -vs * 0.5;
|
||||
|
||||
// calculate friction
|
||||
// we assume a static Coefficient of Friction (mu) of 0.62 (wood on concrete)
|
||||
double mu = 0.62;
|
||||
// calculate friction
|
||||
// we assume a static Coefficient of Friction (mu) of 0.62 (wood on concrete)
|
||||
double mu = 0.62;
|
||||
|
||||
static_friction_force_lbs = mu * normal_force_lbs * _frictionFactor;
|
||||
static_friction_force_lbs = mu * normal_force_lbs * _frictionFactor;
|
||||
|
||||
//adjust horizontal force. We assume that a speed of <= 5 fps is static
|
||||
if (h_force_lbs <= static_friction_force_lbs && hs <= 5){
|
||||
h_force_lbs = hs = 0;
|
||||
speed_north_fps = speed_east_fps = 0;
|
||||
} else
|
||||
dynamic_friction_force_lbs = (static_friction_force_lbs * 0.95);
|
||||
//adjust horizontal force. We assume that a speed of <= 5 fps is static
|
||||
if (h_force_lbs <= static_friction_force_lbs && hs <= 5){
|
||||
h_force_lbs = hs = 0;
|
||||
_speed_north_fps = _speed_east_fps = 0;
|
||||
} else
|
||||
dynamic_friction_force_lbs = (static_friction_force_lbs * 0.95);
|
||||
|
||||
//ignore wind when on the ground for now
|
||||
//TODO fix this
|
||||
_wind_from_north = 0;
|
||||
_wind_from_east = 0;
|
||||
//ignore wind when on the ground for now
|
||||
//TODO fix this
|
||||
_wind_from_north = 0;
|
||||
_wind_from_east = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} //endif
|
||||
|
||||
//acceleration = (force(lbsf)/mass(slugs))
|
||||
v_force_acc_fpss = v_force_lbs/_mass;
|
||||
|
@ -835,10 +836,10 @@ void FGAIBallistic::Run(double dt) {
|
|||
double wind_speed_from_east_deg_sec = _wind_from_east / ft_per_deg_lon;
|
||||
|
||||
//recombine the horizontal velocity components
|
||||
hs = sqrt(((speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps)
|
||||
* (speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps))
|
||||
+ ((speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps)
|
||||
* (speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps)));
|
||||
hs = sqrt(((_speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps)
|
||||
* (_speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps))
|
||||
+ ((_speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps)
|
||||
* (_speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps)));
|
||||
|
||||
if (hs <= 0.00001)
|
||||
hs = 0;
|
||||
|
@ -890,8 +891,8 @@ void FGAIBallistic::Run(double dt) {
|
|||
|
||||
// recalculate elevation and azimuth (velocity vectors)
|
||||
_elevation = atan2( vs, hs ) * SG_RADIANS_TO_DEGREES;
|
||||
_azimuth = atan2((speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps),
|
||||
(speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps))
|
||||
_azimuth = atan2((_speed_east_fps + force_speed_east_fps + friction_force_speed_east_fps),
|
||||
(_speed_north_fps + force_speed_north_fps + friction_force_speed_north_fps))
|
||||
* SG_RADIANS_TO_DEGREES;
|
||||
|
||||
// rationalise azimuth
|
||||
|
@ -899,7 +900,7 @@ void FGAIBallistic::Run(double dt) {
|
|||
_azimuth += 360;
|
||||
|
||||
if (_aero_stabilised) { // we simulate rotational moment of inertia by using a filter
|
||||
//cout<< "_aero_stabilised "<< endl;
|
||||
//cout<< "_aero_stabilised " << hdg << " az " << _azimuth << endl;
|
||||
const double coeff = 0.9;
|
||||
|
||||
// we assume a symetrical MI about the pitch and yaw axis
|
||||
|
@ -941,16 +942,20 @@ double FGAIBallistic::_getTime() const {
|
|||
return _life_timer;
|
||||
}
|
||||
|
||||
void FGAIBallistic::setTime(double s){
|
||||
_life_timer = s;
|
||||
}
|
||||
|
||||
void FGAIBallistic::handle_impact() {
|
||||
|
||||
// try terrain intersection
|
||||
double start = pos.getElevationM() + 10;
|
||||
double start = pos.getElevationM() + 100;
|
||||
|
||||
if(!getHtAGL(start))
|
||||
return;
|
||||
|
||||
if (_ht_agl_ft <= 0) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: terrain impact");
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
|
||||
report_impact(_elevation_m);
|
||||
_impact_reported = true;
|
||||
|
||||
|
@ -1004,7 +1009,8 @@ void FGAIBallistic::report_impact(double elevation, const FGAIBase *object)
|
|||
else
|
||||
n->setStringValue("type", "terrain");
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact" << _name << " lon " <<_impact_lon);
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name
|
||||
<< " lon " <<_impact_lon << " lat " <<_impact_lat);
|
||||
|
||||
n->setDoubleValue("longitude-deg", _impact_lon);
|
||||
n->setDoubleValue("latitude-deg", _impact_lat);
|
||||
|
@ -1239,9 +1245,17 @@ void FGAIBallistic::setOffsetVelocity(double dt, SGGeod offsetpos) {
|
|||
calcVSHS();
|
||||
|
||||
//calculate the bearing of the new offset position from the old
|
||||
double az1, az2, dist;
|
||||
geo_inverse_wgs_84(_oldoffsetpos, offsetpos, &az1, &az2, &dist);
|
||||
_azimuth = az1;
|
||||
//don't do this if speed is low
|
||||
//cout << "speed " << speed << endl;
|
||||
if (speed > 0.1){
|
||||
double az1, az2, dist;
|
||||
geo_inverse_wgs_84(_oldoffsetpos, offsetpos, &az1, &az2, &dist);
|
||||
_azimuth = az1;
|
||||
//cout << "offset az " << _azimuth << endl;
|
||||
} else {
|
||||
_azimuth = hdg;
|
||||
//cout << " slow offset az " << _azimuth << endl;
|
||||
}
|
||||
|
||||
//resolve horizontal speed into north and east components:
|
||||
calcNE();
|
||||
|
|
|
@ -96,9 +96,9 @@ public:
|
|||
void setParentPos();
|
||||
void setOffsetPos(SGGeod pos, double heading, double pitch, double roll);
|
||||
void setOffsetVelocity(double dt, SGGeod pos);
|
||||
void setTime(double sec);
|
||||
|
||||
|
||||
double _getTime() const;
|
||||
double _getTime()const;
|
||||
double getRelBrgHitchToUser() const;
|
||||
double getElevHitchToUser() const;
|
||||
double getLoadOffset() const;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
//
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include <simgear/xml/easyxml.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
@ -84,11 +84,16 @@ void XMLLoader::load(FGSidStar* p) {
|
|||
bool XMLLoader::findAirportData(const std::string& aICAO,
|
||||
const std::string& aFileName, SGPath& aPath)
|
||||
{
|
||||
string fileName(aFileName);
|
||||
if (!simgear::strutils::ends_with(aFileName, ".xml")) {
|
||||
fileName.append(".xml");
|
||||
}
|
||||
|
||||
string_list sc = globals->get_fg_scenery();
|
||||
char buffer[128];
|
||||
::snprintf(buffer, 128, "%c/%c/%c/%s.%s.xml",
|
||||
::snprintf(buffer, 128, "%c/%c/%c/%s.%s",
|
||||
aICAO[0], aICAO[1], aICAO[2],
|
||||
aICAO.c_str(), aFileName.c_str());
|
||||
aICAO.c_str(), fileName.c_str());
|
||||
|
||||
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
|
||||
SGPath path(*it);
|
||||
|
|
|
@ -224,6 +224,15 @@ void FGRouteMgr::init() {
|
|||
|
||||
void FGRouteMgr::postinit()
|
||||
{
|
||||
SGPath path(_pathNode->getStringValue());
|
||||
if (path.exists()) {
|
||||
SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from:" << path.str());
|
||||
loadRoute();
|
||||
}
|
||||
|
||||
// this code only matters for the --wp option now - perhaps the option
|
||||
// should be deprecated in favour of an explicit flight-plan file?
|
||||
// then the global initial waypoint list could die.
|
||||
string_list *waypoints = globals->get_initial_waypoints();
|
||||
if (waypoints) {
|
||||
string_list::iterator it;
|
||||
|
|
|
@ -269,7 +269,7 @@ public:
|
|||
_offset = n->getFloatValue("offset", offset);
|
||||
_min = n->getFloatValue("min", min);
|
||||
_max = n->getFloatValue("max", max);
|
||||
_coeff = 1.0 - 1.0 / powf(10, fabsf(n->getFloatValue("damp", 0.0)));
|
||||
_coeff = 1.0 - 1.0 / powf(10, fabs(n->getFloatValue("damp", 0.0)));
|
||||
SGPropertyNode *p = ((SGPropertyNode *)n)->getNode("property", false);
|
||||
if (p) {
|
||||
const char *path = p->getStringValue();
|
||||
|
|
|
@ -378,90 +378,99 @@ wxRadarBg::update (double delta_time_sec)
|
|||
_texCoords->clear();
|
||||
_textGeode->removeDrawables(0, _textGeode->getNumDrawables());
|
||||
|
||||
#if 0
|
||||
//TODO FIXME Mask below (only used for ARC mode) isn't properly aligned, i.e.
|
||||
// it assumes the a/c position at the center of the display - though it's somewhere at
|
||||
// bottom part for ARC mode.
|
||||
// The mask hadn't worked at all for a while (probably since the OSG port) due to
|
||||
// another bug (which is fixed now). Now, the mask is disabled completely until s.o.
|
||||
// adapted the coordinates below. And the mask is only really useful to limit displayed
|
||||
// weather blobs (not support yet).
|
||||
// Aircraft echos are already limited properly through wxradar's "limit-deg" property.
|
||||
{
|
||||
osg::DrawArrays *maskPSet
|
||||
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(1));
|
||||
osg::DrawArrays *trimaskPSet
|
||||
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(2));
|
||||
|
||||
if (_display_mode == ARC) {
|
||||
// erase what is out of sight of antenna
|
||||
/*
|
||||
|\ /|
|
||||
| \ / |
|
||||
| \ / |
|
||||
---------
|
||||
| |
|
||||
| |
|
||||
---------
|
||||
*/
|
||||
float xOffset = 256.0f;
|
||||
float yOffset = 200.0f;
|
||||
|
||||
int firstQuadVert = _vertices->size();
|
||||
_texCoords->push_back(osg::Vec2f(0.5f, 0.25f));
|
||||
_vertices->push_back(osg::Vec2f(-xOffset, 0.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(1.0f, 0.25f));
|
||||
_vertices->push_back(osg::Vec2f(xOffset, 0.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(1.0f, 0.5f));
|
||||
_vertices->push_back(osg::Vec2f(xOffset, 256.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(0.5f, 0.5f));
|
||||
_vertices->push_back(osg::Vec2f(-xOffset, 256.0 + yOffset));
|
||||
maskPSet->set(osg::PrimitiveSet::QUADS, firstQuadVert, 4);
|
||||
firstQuadVert += 4;
|
||||
|
||||
// The triangles aren't supposed to be textured, but there's
|
||||
// no need to set up a different Geometry, switch modes,
|
||||
// etc. I happen to know that there's a white pixel in the
|
||||
// texture at 1.0, 0.0 :)
|
||||
float centerY = tan(30 * SG_DEGREES_TO_RADIANS);
|
||||
_vertices->push_back(osg::Vec2f(0.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, 256.0 * centerY));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(0.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 256.0 * centerY));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(-256, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, -256.0));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(256, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, -256.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, -256.0));
|
||||
|
||||
const osg::Vec2f whiteSpot(1.0f, 0.0f);
|
||||
for (int i = 0; i < 3 * 4; i++)
|
||||
_texCoords->push_back(whiteSpot);
|
||||
|
||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, firstQuadVert, 3 * 4);
|
||||
|
||||
} else
|
||||
{
|
||||
maskPSet->set(osg::PrimitiveSet::QUADS, 0, 0);
|
||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, 0, 0);
|
||||
}
|
||||
|
||||
maskPSet->dirty();
|
||||
trimaskPSet->dirty();
|
||||
}
|
||||
#endif
|
||||
|
||||
// remember index of next vertex
|
||||
int vIndex = _vertices->size();
|
||||
|
||||
update_weather();
|
||||
|
||||
|
||||
osg::DrawArrays *quadPSet
|
||||
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(0));
|
||||
quadPSet->set(osg::PrimitiveSet::QUADS, 0, _vertices->size());
|
||||
quadPSet->dirty();
|
||||
|
||||
// erase what is out of sight of antenna
|
||||
/*
|
||||
|\ /|
|
||||
| \ / |
|
||||
| \ / |
|
||||
---------
|
||||
| |
|
||||
| |
|
||||
---------
|
||||
*/
|
||||
|
||||
osg::DrawArrays *maskPSet
|
||||
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(1));
|
||||
osg::DrawArrays *trimaskPSet
|
||||
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(2));
|
||||
|
||||
if (_display_mode == ARC) {
|
||||
float xOffset = 256.0f;
|
||||
float yOffset = 200.0f;
|
||||
|
||||
int firstQuadVert = _vertices->size();
|
||||
_texCoords->push_back(osg::Vec2f(0.5f, 0.25f));
|
||||
_vertices->push_back(osg::Vec2f(-xOffset, 0.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(1.0f, 0.25f));
|
||||
_vertices->push_back(osg::Vec2f(xOffset, 0.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(1.0f, 0.5f));
|
||||
_vertices->push_back(osg::Vec2f(xOffset, 256.0 + yOffset));
|
||||
_texCoords->push_back(osg::Vec2f(0.5f, 0.5f));
|
||||
_vertices->push_back(osg::Vec2f(-xOffset, 256.0 + yOffset));
|
||||
maskPSet->set(osg::PrimitiveSet::QUADS, firstQuadVert, 4);
|
||||
|
||||
// The triangles aren't supposed to be textured, but there's
|
||||
// no need to set up a different Geometry, switch modes,
|
||||
// etc. I happen to know that there's a white pixel in the
|
||||
// texture at 1.0, 0.0 :)
|
||||
float centerY = tan(30 * SG_DEGREES_TO_RADIANS);
|
||||
_vertices->push_back(osg::Vec2f(0.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, 256.0 * centerY));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(0.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 256.0 * centerY));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(-256, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, -256.0));
|
||||
|
||||
_vertices->push_back(osg::Vec2f(256, 0.0));
|
||||
_vertices->push_back(osg::Vec2f(256.0, -256.0));
|
||||
_vertices->push_back(osg::Vec2f(-256.0, -256.0));
|
||||
|
||||
const osg::Vec2f whiteSpot(1.0f, 0.0f);
|
||||
for (int i = 0; i < 3 * 4; i++)
|
||||
_texCoords->push_back(whiteSpot);
|
||||
|
||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, firstQuadVert + 4, 3 * 4);
|
||||
|
||||
} else {
|
||||
maskPSet->set(osg::PrimitiveSet::QUADS, 0, 0);
|
||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, 0, 0);
|
||||
}
|
||||
|
||||
maskPSet->dirty();
|
||||
trimaskPSet->dirty();
|
||||
|
||||
// draw without mask
|
||||
_vertices->clear();
|
||||
_texCoords->clear();
|
||||
|
||||
update_aircraft();
|
||||
update_tacan();
|
||||
update_heading_marker();
|
||||
|
||||
quadPSet->set(osg::PrimitiveSet::QUADS, 0, _vertices->size());
|
||||
// draw all new vertices are quads
|
||||
quadPSet->set(osg::PrimitiveSet::QUADS, vIndex, _vertices->size()-vIndex);
|
||||
quadPSet->dirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <Scenery/scenery.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
#include <Sound/sample_queue.hxx>
|
||||
#include <Time/sunsolver.hxx>
|
||||
#include <Airports/xmlloader.hxx>
|
||||
|
||||
#include "fg_init.hxx"
|
||||
#include "fg_io.hxx"
|
||||
|
@ -698,85 +698,6 @@ do_set_dewpoint_degc (const SGPropertyNode * arg)
|
|||
return do_set_dewpoint_sea_level_degc(dummy.get_dewpoint_sea_level_degc());
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Update the lighting manually.
|
||||
*/
|
||||
static bool
|
||||
do_timeofday (const SGPropertyNode * arg)
|
||||
{
|
||||
const string &offset_type = arg->getStringValue("timeofday", "noon");
|
||||
|
||||
static const SGPropertyNode *longitude
|
||||
= fgGetNode("/position/longitude-deg");
|
||||
static const SGPropertyNode *latitude
|
||||
= fgGetNode("/position/latitude-deg");
|
||||
|
||||
int orig_warp = globals->get_warp();
|
||||
SGTime *t = globals->get_time_params();
|
||||
time_t cur_time = t->get_cur_time();
|
||||
// cout << "cur_time = " << cur_time << endl;
|
||||
// cout << "orig_warp = " << orig_warp << endl;
|
||||
|
||||
int warp = 0;
|
||||
if ( offset_type == "real" ) {
|
||||
warp = -orig_warp;
|
||||
} else if ( offset_type == "dawn" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
90.0, true );
|
||||
} else if ( offset_type == "morning" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
75.0, true );
|
||||
} else if ( offset_type == "noon" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
0.0, true );
|
||||
} else if ( offset_type == "afternoon" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
60.0, false );
|
||||
} else if ( offset_type == "dusk" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
90.0, false );
|
||||
} else if ( offset_type == "evening" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
100.0, false );
|
||||
} else if ( offset_type == "midnight" ) {
|
||||
warp = fgTimeSecondsUntilSunAngle( cur_time,
|
||||
longitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue()
|
||||
* SGD_DEGREES_TO_RADIANS,
|
||||
180.0, false );
|
||||
}
|
||||
|
||||
|
||||
fgSetInt("/sim/time/warp", orig_warp + warp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Built-in command: toggle a bool property value.
|
||||
|
@ -1301,11 +1222,20 @@ do_load_xml_to_proptree(const SGPropertyNode * arg)
|
|||
|
||||
if (file.extension() != "xml")
|
||||
file.concat(".xml");
|
||||
|
||||
if (file.isRelative()) {
|
||||
file = globals->resolve_maybe_aircraft_path(file.str());
|
||||
|
||||
std::string icao = arg->getStringValue("icao");
|
||||
if (icao.empty()) {
|
||||
if (file.isRelative()) {
|
||||
file = globals->resolve_maybe_aircraft_path(file.str());
|
||||
}
|
||||
} else {
|
||||
if (!XMLLoader::findAirportData(icao, file.str(), file)) {
|
||||
SG_LOG(SG_IO, SG_INFO, "loadxml: failed to find airport data for "
|
||||
<< file.str() << " at ICAO:" << icao);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!fgValidatePath(file.c_str(), false)) {
|
||||
SG_LOG(SG_IO, SG_ALERT, "loadxml: reading '" << file.str() << "' denied "
|
||||
"(unauthorized access)");
|
||||
|
@ -1458,7 +1388,6 @@ static struct {
|
|||
{ "set-dewpoint-sea-level-air-temp-degc", do_set_dewpoint_sea_level_degc },
|
||||
{ "set-dewpoint-temp-degc", do_set_dewpoint_degc },
|
||||
*/
|
||||
{ "timeofday", do_timeofday },
|
||||
{ "property-toggle", do_property_toggle },
|
||||
{ "property-assign", do_property_assign },
|
||||
{ "property-adjust", do_property_adjust },
|
||||
|
|
|
@ -306,6 +306,7 @@ void fgWarpMouse(int x, int y)
|
|||
|
||||
void fgOSInit(int* argc, char** argv)
|
||||
{
|
||||
globals->get_renderer()->init();
|
||||
WindowSystemAdapter::setWSA(new WindowSystemAdapter);
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,8 @@ void FGGlobals::set_fg_scenery (const string &scenery)
|
|||
|
||||
string_list path_list = sgPathSplit( s.str() );
|
||||
fg_scenery.clear();
|
||||
|
||||
SGPropertyNode* sim = fgGetNode("/sim", true);
|
||||
|
||||
for (unsigned i = 0; i < path_list.size(); i++) {
|
||||
SGPath path(path_list[i]);
|
||||
if (!path.exists()) {
|
||||
|
@ -271,6 +272,12 @@ void FGGlobals::set_fg_scenery (const string &scenery)
|
|||
// FG_SCENERY=A:B becomes list ["A/Terrain", "A/Objects", "",
|
||||
// "B/Terrain", "B/Objects", ""]
|
||||
fg_scenery.push_back("");
|
||||
|
||||
// make scenery dirs available to Nasal
|
||||
sim->removeChild("fg-scenery", i, false);
|
||||
SGPropertyNode* n = sim->getChild("fg-scenery", i, true);
|
||||
n->setStringValue(path.str());
|
||||
n->setAttribute(SGPropertyNode::WRITE, false);
|
||||
} // of path list iteration
|
||||
}
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ static void fgMainLoop( void ) {
|
|||
}
|
||||
else
|
||||
{
|
||||
fgSplashProgress("loading scenery");
|
||||
// be nice to loader threads while waiting for initial scenery, reduce to 2fps
|
||||
simgear::sleepForMSec(500);
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ SGPath resolve_path(const std::string& s)
|
|||
}
|
||||
|
||||
// This is the top level master main function that is registered as
|
||||
// our idle funciton
|
||||
// our idle function
|
||||
|
||||
// The first few passes take care of initialization things (a couple
|
||||
// per pass) and once everything has been initialized fgMainLoop from
|
||||
|
@ -348,20 +349,17 @@ static void fgIdleFunction ( void ) {
|
|||
if (!guiFinishInit())
|
||||
return;
|
||||
idle_state++;
|
||||
fgSplashProgress("reading aircraft list");
|
||||
|
||||
fgSplashProgress("loading aircraft list");
|
||||
|
||||
} else if ( idle_state == 2 ) {
|
||||
idle_state++;
|
||||
|
||||
fgSplashProgress("reading airport & navigation data");
|
||||
|
||||
fgSplashProgress("loading navigation data");
|
||||
|
||||
} else if ( idle_state == 3 ) {
|
||||
idle_state++;
|
||||
fgInitNav();
|
||||
fgSplashProgress("setting up scenery");
|
||||
|
||||
fgSplashProgress("initializing scenery system");
|
||||
|
||||
} else if ( idle_state == 4 ) {
|
||||
idle_state++;
|
||||
|
@ -386,14 +384,13 @@ static void fgIdleFunction ( void ) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
fgInitCommands();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the material manager
|
||||
////////////////////////////////////////////////////////////////////
|
||||
globals->set_matlib( new SGMaterialLib );
|
||||
simgear::SGModelLib::init(globals->get_fg_root(), globals->get_props());
|
||||
simgear::SGModelLib::setPanelFunc(load_panel);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the TG scenery subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -402,15 +399,12 @@ static void fgIdleFunction ( void ) {
|
|||
globals->get_scenery()->bind();
|
||||
globals->set_tile_mgr( new FGTileMgr );
|
||||
|
||||
|
||||
fgSplashProgress("loading aircraft");
|
||||
|
||||
|
||||
} else if ( idle_state == 5 ) {
|
||||
idle_state++;
|
||||
|
||||
fgSplashProgress("generating sky elements");
|
||||
|
||||
fgSplashProgress("initializing sky elements");
|
||||
|
||||
} else if ( idle_state == 6 ) {
|
||||
idle_state++;
|
||||
|
@ -471,10 +465,8 @@ static void fgIdleFunction ( void ) {
|
|||
// airport->setName( "Airport Lighting" );
|
||||
// lighting->addKid( airport );
|
||||
|
||||
// build our custom render states
|
||||
fgSplashProgress("initializing subsystems");
|
||||
|
||||
|
||||
} else if ( idle_state == 7 ) {
|
||||
idle_state++;
|
||||
// Initialize audio support
|
||||
|
@ -531,18 +523,18 @@ static void fgIdleFunction ( void ) {
|
|||
fgSetPosFromAirportIDandHdg( apt, hdg );
|
||||
}
|
||||
}
|
||||
fgSplashProgress("setting up time & renderer");
|
||||
|
||||
fgSplashProgress("initializing graphics engine");
|
||||
|
||||
} else if ( idle_state == 8 ) {
|
||||
idle_state = 1000;
|
||||
|
||||
// setup OpenGL view parameters
|
||||
globals->get_renderer()->init();
|
||||
globals->get_renderer()->setupView();
|
||||
|
||||
globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"),
|
||||
fgGetInt("/sim/startup/ysize") );
|
||||
|
||||
fgSplashProgress("loading scenery objects");
|
||||
int session = fgGetInt("/sim/session",0);
|
||||
session++;
|
||||
fgSetInt("/sim/session",session);
|
||||
|
@ -673,5 +665,3 @@ int fgMainInit( int argc, char **argv ) {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -555,54 +555,6 @@ add_channel( const string& type, const string& channel_str ) {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// The parse wp and parse flight-plan options don't work anymore, because
|
||||
// the route manager and the airport subsystems have not yet been initialized
|
||||
// at this stage.
|
||||
|
||||
// Parse --wp=ID[@alt]
|
||||
static void
|
||||
parse_wp( const string& arg ) {
|
||||
string_list *waypoints = globals->get_initial_waypoints();
|
||||
if (!waypoints) {
|
||||
waypoints = new string_list;
|
||||
globals->set_initial_waypoints(waypoints);
|
||||
}
|
||||
waypoints->push_back(arg);
|
||||
}
|
||||
|
||||
|
||||
// Parse --flight-plan=[file]
|
||||
static bool
|
||||
parse_flightplan(const string& arg)
|
||||
{
|
||||
string_list *waypoints = globals->get_initial_waypoints();
|
||||
if (!waypoints) {
|
||||
waypoints = new string_list;
|
||||
globals->set_initial_waypoints(waypoints);
|
||||
}
|
||||
|
||||
sg_gzifstream in(arg.c_str());
|
||||
if ( !in.is_open() )
|
||||
return false;
|
||||
|
||||
while ( true ) {
|
||||
string line;
|
||||
getline( in, line, '\n' );
|
||||
|
||||
// catch extraneous (DOS) line ending character
|
||||
if ( line[line.length() - 1] < 32 )
|
||||
line = line.substr( 0, line.length()-1 );
|
||||
|
||||
if ( in.eof() )
|
||||
break;
|
||||
|
||||
waypoints->push_back(line);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
fgOptLanguage( const char *arg )
|
||||
{
|
||||
|
@ -1067,14 +1019,12 @@ fgOptCeiling( const char *arg )
|
|||
static int
|
||||
fgOptWp( const char *arg )
|
||||
{
|
||||
parse_wp( arg );
|
||||
return FG_OPTIONS_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
fgOptFlightPlan( const char *arg )
|
||||
{
|
||||
parse_flightplan ( arg );
|
||||
string_list *waypoints = globals->get_initial_waypoints();
|
||||
if (!waypoints) {
|
||||
waypoints = new string_list;
|
||||
globals->set_initial_waypoints(waypoints);
|
||||
}
|
||||
waypoints->push_back(arg);
|
||||
return FG_OPTIONS_OK;
|
||||
}
|
||||
|
||||
|
@ -1496,7 +1446,7 @@ struct OptionDesc {
|
|||
{"turbulence", true, OPTION_FUNC, "", false, "", fgOptTurbulence },
|
||||
{"ceiling", true, OPTION_FUNC, "", false, "", fgOptCeiling },
|
||||
{"wp", true, OPTION_FUNC, "", false, "", fgOptWp },
|
||||
{"flight-plan", true, OPTION_FUNC, "", false, "", fgOptFlightPlan },
|
||||
{"flight-plan", true, OPTION_STRING, "/autopilot/route-manager/file-path", false, "", NULL },
|
||||
{"config", true, OPTION_FUNC, "", false, "", fgOptConfig },
|
||||
{"aircraft", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
||||
{"vehicle", true, OPTION_STRING, "/sim/aircraft", false, "", 0 },
|
||||
|
|
|
@ -440,7 +440,11 @@ FGRenderer::init( void )
|
|||
|
||||
_cloud_status = fgGetNode("/environment/clouds/status", true);
|
||||
_visibility_m = fgGetNode("/environment/visibility-m", true);
|
||||
}
|
||||
|
||||
void
|
||||
FGRenderer::setupView( void )
|
||||
{
|
||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
||||
osg::initNotifyLevel();
|
||||
|
||||
|
@ -593,12 +597,10 @@ FGRenderer::update()
|
|||
// Update all Visuals (redraws anything graphics related)
|
||||
void
|
||||
FGRenderer::update( bool refresh_camera_settings ) {
|
||||
if ((!_scenery_loaded.get())||
|
||||
!(_scenery_loaded->getBoolValue() ||
|
||||
if (!(_scenery_loaded->getBoolValue() ||
|
||||
_scenery_override->getBoolValue()))
|
||||
{
|
||||
// alas, first "update" is being called before "init"...
|
||||
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
||||
_splash_alpha->setDoubleValue(1.0);
|
||||
return;
|
||||
}
|
||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
||||
|
@ -611,10 +613,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
|||
double delay_time = SGMiscd::min(fade_time/fade_steps_per_sec,
|
||||
(SGTimeStamp::now() - _splash_time).toSecs());
|
||||
_splash_time = SGTimeStamp::now();
|
||||
double sAlpha = fgGetDouble("/sim/startup/splash-alpha", 1.0);
|
||||
double sAlpha = _splash_alpha->getDoubleValue();
|
||||
sAlpha -= SGMiscd::max(0.0,delay_time/fade_time);
|
||||
FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
|
||||
fgSetDouble("/sim/startup/splash-alpha", sAlpha);
|
||||
_splash_alpha->setDoubleValue(sAlpha);
|
||||
}
|
||||
|
||||
bool skyblend = _skyblend->getBoolValue();
|
||||
|
@ -770,30 +772,29 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
|||
// Handle new window size or exposure
|
||||
void
|
||||
FGRenderer::resize( int width, int height ) {
|
||||
int view_h;
|
||||
|
||||
if ( (!_virtual_cockpit->getBoolValue())
|
||||
&& fgPanelVisible() && idle_state == 1000 ) {
|
||||
view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
|
||||
globals->get_current_panel()->getYOffset()) / 768.0);
|
||||
} else {
|
||||
view_h = height;
|
||||
}
|
||||
// the following breaks aspect-ratio of the main 3D scenery window when 2D panels are moved
|
||||
// in y direction - causing issues for aircraft with 2D panels (/sim/virtual_cockpit=false).
|
||||
// Disabling for now. Seems this useful for the pre-OSG time only.
|
||||
// if ( (!_virtual_cockpit->getBoolValue())
|
||||
// && fgPanelVisible() && idle_state == 1000 ) {
|
||||
// view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
|
||||
// globals->get_current_panel()->getYOffset()) / 768.0);
|
||||
// }
|
||||
|
||||
static int lastwidth = 0;
|
||||
static int lastheight = 0;
|
||||
if (width != lastwidth)
|
||||
_xsize->setIntValue(lastwidth = width);
|
||||
if (height != lastheight)
|
||||
_ysize->setIntValue(lastheight = height);
|
||||
int curWidth = _xsize->getIntValue(),
|
||||
curHeight = _ysize->getIntValue();
|
||||
|
||||
_xsize->setIntValue(width);
|
||||
_ysize->setIntValue(height);
|
||||
double aspect = height / (double) width;
|
||||
|
||||
// for all views
|
||||
FGViewMgr *viewmgr = globals->get_viewmgr();
|
||||
if (viewmgr) {
|
||||
for ( int i = 0; i < viewmgr->size(); ++i ) {
|
||||
viewmgr->get_view(i)->
|
||||
set_aspect_ratio((float)view_h / (float)width);
|
||||
}
|
||||
for ( int i = 0; i < viewmgr->size(); ++i ) {
|
||||
viewmgr->get_view(i)->set_aspect_ratio(aspect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
void splashinit();
|
||||
void init();
|
||||
|
||||
void setupView();
|
||||
|
||||
void resize(int width, int height );
|
||||
|
||||
// calling update( refresh_camera_settings = false ) will not
|
||||
|
|
|
@ -295,6 +295,7 @@ static osg::Node* fgCreateSplashCamera()
|
|||
text->setPosition(osg::Vec3(0, -0.92, 0));
|
||||
text->setAlignment(osgText::Text::CENTER_CENTER);
|
||||
SGPropertyNode* prop = fgGetNode("/sim/startup/splash-progress-text", true);
|
||||
prop->setStringValue("initializing");
|
||||
text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
|
||||
geode->addDrawable(text);
|
||||
|
||||
|
|
|
@ -35,16 +35,32 @@
|
|||
#include <simgear/structure/event_mgr.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/timing/lowleveltime.h>
|
||||
#include <simgear/structure/commands.hxx>
|
||||
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Time/sunsolver.hxx>
|
||||
|
||||
static bool do_timeofday (const SGPropertyNode * arg)
|
||||
{
|
||||
const string &offset_type = arg->getStringValue("timeofday", "noon");
|
||||
int offset = arg->getIntValue("offset", 0);
|
||||
TimeManager* self = (TimeManager*) globals->get_subsystem("time");
|
||||
if (offset_type == "real") {
|
||||
// without this, setting 'real' time is a no-op, since the current
|
||||
// wrap value (orig_warp) is retained in setTimeOffset. Ick.
|
||||
fgSetInt("/sim/time/warp", 0);
|
||||
}
|
||||
|
||||
self->setTimeOffset(offset_type, offset);
|
||||
return true;
|
||||
}
|
||||
|
||||
TimeManager::TimeManager() :
|
||||
_inited(false),
|
||||
_impl(NULL)
|
||||
{
|
||||
|
||||
SGCommandMgr::instance()->addCommand("timeofday", do_timeofday);
|
||||
}
|
||||
|
||||
void TimeManager::init()
|
||||
|
@ -345,6 +361,14 @@ void TimeManager::updateLocalTime()
|
|||
}
|
||||
|
||||
void TimeManager::initTimeOffset()
|
||||
{
|
||||
|
||||
int offset = fgGetInt("/sim/startup/time-offset");
|
||||
string offset_type = fgGetString("/sim/startup/time-offset-type");
|
||||
setTimeOffset(offset_type, offset);
|
||||
}
|
||||
|
||||
void TimeManager::setTimeOffset(const std::string& offset_type, int offset)
|
||||
{
|
||||
// Handle potential user specified time offsets
|
||||
int orig_warp = _warp->getIntValue();
|
||||
|
@ -355,8 +379,6 @@ void TimeManager::initTimeOffset()
|
|||
sgTimeGetGMT( fgLocaltime(&cur_time, _impl->get_zonename() ) );
|
||||
|
||||
// Okay, we now have several possible scenarios
|
||||
int offset = fgGetInt("/sim/startup/time-offset");
|
||||
string offset_type = fgGetString("/sim/startup/time-offset-type");
|
||||
double lon = _longitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
double lat = _latitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
int warp = 0;
|
||||
|
@ -394,12 +416,12 @@ void TimeManager::initTimeOffset()
|
|||
warp = offset - (aircraftLocalTime - currGMT)- cur_time;
|
||||
} else {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"TimeManager::initTimeOffset: unsupported offset: " << offset_type );
|
||||
"TimeManager::setTimeOffset: unsupported offset: " << offset_type );
|
||||
warp = 0;
|
||||
}
|
||||
|
||||
_warp->setIntValue( orig_warp + warp );
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "After fgInitTimeOffset(): warp = "
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "After TimeManager::setTimeOffset(): warp = "
|
||||
<< _warp->getIntValue() );
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
|
||||
// SGPropertyChangeListener overrides
|
||||
virtual void valueChanged(SGPropertyNode *);
|
||||
|
||||
void setTimeOffset(const std::string& offset_type, int offset);
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
4
utils/fgpanel/.cvsignore
Normal file
4
utils/fgpanel/.cvsignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
fgpanel
|
|
@ -17,7 +17,12 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
#include "FGGLApplication.hxx"
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include "ApplicationProperties.hxx"
|
||||
|
@ -93,7 +98,7 @@ inline bool FGFontCache::FntParamsLess::operator()(const FntParams& f1,
|
|||
struct FGFontCache::fnt *
|
||||
FGFontCache::getfnt(const char *name, float size, float slant)
|
||||
{
|
||||
string fontName(name);
|
||||
std::string fontName(name);
|
||||
FntParams fntParams(fontName, size, slant);
|
||||
PuFontMap::iterator i = _puFonts.find(fntParams);
|
||||
if (i != _puFonts.end())
|
||||
|
@ -183,7 +188,7 @@ FGFontCache::getfntpath(const char *name)
|
|||
|
||||
bool FGFontCache::initializeFonts()
|
||||
{
|
||||
static string fontext("txf");
|
||||
static std::string fontext("txf");
|
||||
init();
|
||||
ulDir* fontdir = ulOpenDir(_path.c_str());
|
||||
if (!fontdir)
|
||||
|
@ -195,7 +200,7 @@ bool FGFontCache::initializeFonts()
|
|||
if (path.extension() == fontext) {
|
||||
fntTexFont* f = new fntTexFont;
|
||||
if (f->load((char *)path.c_str()))
|
||||
_texFonts[string(dirEntry->d_name)] = f;
|
||||
_texFonts[std::string(dirEntry->d_name)] = f;
|
||||
else
|
||||
delete f;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//
|
||||
#ifndef __FGFONTCACHE_HXX
|
||||
#define __FGFONTCACHE_HXX
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <plib/pu.h>
|
||||
|
@ -55,8 +56,8 @@ private:
|
|||
// Path to the font directory
|
||||
SGPath _path;
|
||||
|
||||
typedef map<const string, fntTexFont*> TexFontMap;
|
||||
typedef map<const FntParams, fnt*, FntParamsLess> PuFontMap;
|
||||
typedef std::map<const std::string, fntTexFont*> TexFontMap;
|
||||
typedef std::map<const FntParams, fnt*, FntParamsLess> PuFontMap;
|
||||
TexFontMap _texFonts;
|
||||
PuFontMap _puFonts;
|
||||
|
||||
|
|
|
@ -15,9 +15,18 @@
|
|||
// 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 "FGGLApplication.hxx"
|
||||
#include "GL/gl.h"
|
||||
#include "GL/glut.h"
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
|
|
@ -13,6 +13,13 @@
|
|||
// 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
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "FGPNGTextureLoader.hxx"
|
||||
|
||||
#include <GL/glu.h>
|
||||
|
|
|
@ -15,6 +15,16 @@
|
|||
// 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
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "FGGLApplication.hxx"
|
||||
#include "FGPanelApplication.hxx"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
|
@ -131,7 +141,7 @@ void FGPanelApplication::Init()
|
|||
{
|
||||
glAlphaFunc(GL_GREATER, 0.1);
|
||||
glutSetCursor( GLUT_CURSOR_NONE );
|
||||
ApplicationProperties::fontCache.initializeFonts();
|
||||
ApplicationProperties::fontCache.initializeFonts();
|
||||
}
|
||||
|
||||
void FGPanelApplication::Reshape( int width, int height )
|
||||
|
@ -172,8 +182,7 @@ void FGPanelApplication::Key( unsigned char key, int x, int y )
|
|||
{
|
||||
switch( key ) {
|
||||
case 0x1b:
|
||||
if( gameMode ) glutLeaveGameMode();
|
||||
else glutDestroyWindow( windowId );
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +235,11 @@ double FGPanelApplication::Sleep()
|
|||
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
|
||||
if ( elapsed_us < frame_us ) {
|
||||
double requested_us = frame_us - elapsed_us;
|
||||
#ifdef _WIN32
|
||||
::Sleep ((int)(requested_us / 1000.0)) ;
|
||||
#else
|
||||
usleep ( (useconds_t)(requested_us ) ) ;
|
||||
#endif
|
||||
}
|
||||
// busy wait timing loop.
|
||||
//
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "FGGLApplication.hxx"
|
||||
#include "FGPanelProtocol.hxx"
|
||||
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
|
|
|
@ -15,6 +15,18 @@
|
|||
// 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
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define strtof strtod
|
||||
#endif
|
||||
|
||||
#include "FGPanelProtocol.hxx"
|
||||
#include "ApplicationProperties.hxx"
|
||||
#include <simgear/io/sg_socket.hxx>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//
|
||||
#ifndef __FGPANELPROTOCOL_HXX
|
||||
#define __FGPANELPROTOCOL_HXX
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
// Reader for sgi's .rgb format.
|
||||
// specification can be found at http://local.wasp.uwa.edu.au/~pbourke/dataformats/sgirgb/sgiversion.html
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "FGRGBTextureLoader.hxx"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <plib/fnt.h>
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include "panel.hxx"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <string.h> // for strcmp()
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
|
Loading…
Add table
Reference in a new issue