static fntRenderer text_renderer;
static fntTexFont *default_font = 0;
static fntTexFont *led_font = 0;
+static sgVec4 panel_color;
/**
* Constructor.
_jitter(fgGetNode("/sim/panel/jitter", true)),
_flipx(fgGetNode("/sim/panel/flip-x", true)),
_xsize_node(fgGetNode("/sim/startup/xsize", true)),
- _ysize_node(fgGetNode("/sim/startup/ysize", true))
+ _ysize_node(fgGetNode("/sim/startup/ysize", true)),
+ _enable_depth_test(false)
{
}
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
- glDisable(GL_DEPTH_TEST);
- sgVec4 panel_color;
+ if( _enable_depth_test )
+ glDepthFunc(GL_ALWAYS);
+ else
+ glDisable(GL_DEPTH_TEST);
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
sgCopyVec4( panel_color, l->scene_diffuse());
// restore some original state
+ if( _enable_depth_test )
+ glDepthFunc(GL_LESS);
glPopAttrib();
glPolygonOffset(0, 0);
glDisable(GL_POLYGON_OFFSET_FILL);
return doLocalMouseAction(button, updown, x, y);
}
+void FGPanel::setDepthTest (bool enable) {
+ _enable_depth_test = enable;
+}
+
\f
////////////////////////////////////////////////////////////////////////.
// From Curt: turn on the panel
// lights after sundown.
- sgVec4 panel_color;
-
- FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
- sgCopyVec4( panel_color, l->scene_diffuse());
- if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
- if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
- if ( panel_color[1] < 0.2 ) panel_color[1] = 0.2;
- if ( panel_color[2] < 0.2 ) panel_color[2] = 0.2;
- }
glColor4fv( panel_color );
glTexCoord2f(_texture.getMinX(), _texture.getMinY()); glVertex2f(-w2, -h2);
virtual bool doMouseAction (int button, int updown, int x, int y);
virtual bool doLocalMouseAction(int button, int updown, int x, int y);
+ virtual void setDepthTest (bool enable);
+
private:
void setupVirtualCockpit();
void cleanupVirtualCockpit();
ssgTexture * _mbg[8];
// List of instruments in panel.
instrument_list_type _instruments;
+ bool _enable_depth_test;
};
FGClouds::FGClouds(FGEnvironmentCtrl * controller) :
station_elevation_ft(0.0),
_controller( controller ),
- snd_lightning(NULL)
+ snd_lightning(NULL),
+ last_scenario( "none" ),
+ last_env_config( new SGPropertyNode() ),
+ last_env_clouds( new SGPropertyNode() )
{
update_event = 0;
- fgSetString("/environment/weather-scenario", "METAR");
+ fgSetString("/environment/weather-scenario", last_scenario.c_str());
}
FGClouds::~FGClouds() {
}
void FGClouds::build(void) {
string scenario = fgGetString("/environment/weather-scenario", "METAR");
+ if( scenario == last_scenario)
+ return;
+ if( last_scenario == "none" ) {
+ // save clouds and weather conditions
+ SGPropertyNode *param = fgGetNode("/environment/config", true);
+ copyProperties( param, last_env_config );
+ param = fgGetNode("/environment/clouds", true);
+ copyProperties( param, last_env_clouds );
+ }
if( scenario == "METAR" ) {
string realMetar = fgGetString("/environment/metar/real-metar", "");
if( realMetar != "" ) {
}
buildMETAR();
}
+ else if( scenario == "none" ) {
+ // restore clouds and weather conditions
+ SGPropertyNode *param = fgGetNode("/environment/config", true);
+ copyProperties( last_env_config, param );
+ param = fgGetNode("/environment/clouds", true);
+ copyProperties( last_env_clouds, param );
+ fgSetDouble("/environment/metar/rain-norm", 0.0);
+ fgSetDouble("/environment/metar/snow-norm", 0.0);
+// update_env_config();
+ // propagate aloft tables
+ _controller->reinit();
+ buildMETAR();
+ }
else
buildScenario( scenario );
+ last_scenario = scenario;
// ...
if( snd_lightning == NULL )
SGSoundSample *snd_lightning;
FGEnvironmentCtrl * _controller;
float station_elevation_ft;
+ string last_scenario;
+ SGPropertyNode *last_env_config, *last_env_clouds;
public:
FGClouds(FGEnvironmentCtrl * controller);
last_x(0.0),
name("nav"),
num(0),
- _time_before_search_sec(0.0)
+ _time_before_search_sec(-1.0)
{
SGPath path( globals->get_fg_root() );
SGPath term = path;
// panels). This is a memory leak and should be fixed!`
_panel->init();
+ _panel->setDepthTest( props->getBoolValue("depth-test") );
+
// Initialize the matrices to the identity. PLib prints warnings
// when trying to invert singular matrices (e.g. when not using a
// 3D panel).
static SGPropertyNode *replay_master
= fgGetNode( "/sim/freeze/replay", true );
- if( disable_replay->getBoolValue() )
+ if( disable_replay->getBoolValue() ) {
+ if( sim_time != 0.0 ) {
+ // we were recording data
+ init();
+ }
return;
+ }
if ( replay_master->getBoolValue() ) {
// don't record the replay session
return available_amps - amps;
} else if ( model == FG_EXTERNAL ) {
// cout << "external amps = " << 0.0 << endl;
+ float available_amps = ideal_amps;
return available_amps - amps;
} else {
SG_LOG( SG_ALL, SG_ALERT, "unknown supplier type" );