Harald JOHNSEN:
- replay.cxx : corrected a bug, now reinitialize the recording data when replay is deactivated - fgclouds.cxx : cloud layers and weather condition are saved when choosing a weather scenario, added a new scenario 'none' so we can switch back to standard flightgear weather - navradio.cxx : force a search() on init to initialize some variables, preventing a nearly infinite loop when delta-time == 0 on the first update() - electrical.cxx : uninitialized variable in apply_load() for FG_EXTERNAL supplier - panel.cxx, panelnode.cxx : added a property "depth-test" for 2.5D panels so that they update the depth buffer and are no more visible from the outside of the aircraft when the aircraft uses textures without an alpha channel - panel.cxx : moved the computation of the instruments diffuse color outside the texturelayer code since this is constant during a frame, this is a big speedup for 2D panels
This commit is contained in:
parent
99276dd060
commit
a760dcdf13
8 changed files with 56 additions and 16 deletions
|
@ -168,6 +168,7 @@ FGCroppedTexture::getTexture ()
|
|||
static fntRenderer text_renderer;
|
||||
static fntTexFont *default_font = 0;
|
||||
static fntTexFont *led_font = 0;
|
||||
static sgVec4 panel_color;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -183,7 +184,8 @@ FGPanel::FGPanel ()
|
|||
_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -382,8 +384,10 @@ FGPanel::draw()
|
|||
glEnable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
if( _enable_depth_test )
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
sgVec4 panel_color;
|
||||
|
||||
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
|
||||
sgCopyVec4( panel_color, l->scene_diffuse());
|
||||
|
@ -451,6 +455,8 @@ FGPanel::draw()
|
|||
|
||||
|
||||
// restore some original state
|
||||
if( _enable_depth_test )
|
||||
glDepthFunc(GL_LESS);
|
||||
glPopAttrib();
|
||||
glPolygonOffset(0, 0);
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
|
@ -584,6 +590,10 @@ FGPanel::doMouseAction (int button, int updown, int x, int y)
|
|||
return doLocalMouseAction(button, updown, x, y);
|
||||
}
|
||||
|
||||
void FGPanel::setDepthTest (bool enable) {
|
||||
_enable_depth_test = enable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////.
|
||||
|
@ -947,15 +957,6 @@ FGTexturedLayer::draw ()
|
|||
|
||||
// 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);
|
||||
|
|
|
@ -183,6 +183,8 @@ public:
|
|||
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();
|
||||
|
@ -209,6 +211,7 @@ private:
|
|||
ssgTexture * _mbg[8];
|
||||
// List of instruments in panel.
|
||||
instrument_list_type _instruments;
|
||||
bool _enable_depth_test;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -44,10 +44,13 @@ extern SGSky *thesky;
|
|||
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() {
|
||||
}
|
||||
|
@ -433,6 +436,15 @@ void FGClouds::buildScenario( string scenario ) {
|
|||
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 != "" ) {
|
||||
|
@ -445,8 +457,22 @@ void FGClouds::build(void) {
|
|||
}
|
||||
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 )
|
||||
|
|
|
@ -59,6 +59,8 @@ private:
|
|||
SGSoundSample *snd_lightning;
|
||||
FGEnvironmentCtrl * _controller;
|
||||
float station_elevation_ft;
|
||||
string last_scenario;
|
||||
SGPropertyNode *last_env_config, *last_env_clouds;
|
||||
|
||||
public:
|
||||
FGClouds(FGEnvironmentCtrl * controller);
|
||||
|
|
|
@ -71,7 +71,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
|||
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;
|
||||
|
|
|
@ -47,6 +47,8 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props)
|
|||
// 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).
|
||||
|
|
|
@ -105,8 +105,13 @@ void FGReplay::update( double dt ) {
|
|||
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
|
||||
|
|
|
@ -110,6 +110,7 @@ float FGElectricalSupplier::apply_load( float amps, float dt ) {
|
|||
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" );
|
||||
|
|
Loading…
Reference in a new issue