Merge branch 'next' of D:\Git_New\flightgear into next
This commit is contained in:
commit
950769117b
7 changed files with 115 additions and 110 deletions
|
@ -269,7 +269,7 @@ public:
|
||||||
_offset = n->getFloatValue("offset", offset);
|
_offset = n->getFloatValue("offset", offset);
|
||||||
_min = n->getFloatValue("min", min);
|
_min = n->getFloatValue("min", min);
|
||||||
_max = n->getFloatValue("max", max);
|
_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);
|
SGPropertyNode *p = ((SGPropertyNode *)n)->getNode("property", false);
|
||||||
if (p) {
|
if (p) {
|
||||||
const char *path = p->getStringValue();
|
const char *path = p->getStringValue();
|
||||||
|
|
|
@ -378,15 +378,22 @@ wxRadarBg::update (double delta_time_sec)
|
||||||
_texCoords->clear();
|
_texCoords->clear();
|
||||||
_textGeode->removeDrawables(0, _textGeode->getNumDrawables());
|
_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));
|
||||||
|
|
||||||
update_weather();
|
if (_display_mode == ARC) {
|
||||||
|
|
||||||
|
|
||||||
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
|
// erase what is out of sight of antenna
|
||||||
/*
|
/*
|
||||||
|\ /|
|
|\ /|
|
||||||
|
@ -397,13 +404,6 @@ wxRadarBg::update (double delta_time_sec)
|
||||||
| |
|
| |
|
||||||
---------
|
---------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 xOffset = 256.0f;
|
||||||
float yOffset = 200.0f;
|
float yOffset = 200.0f;
|
||||||
|
|
||||||
|
@ -417,6 +417,7 @@ wxRadarBg::update (double delta_time_sec)
|
||||||
_texCoords->push_back(osg::Vec2f(0.5f, 0.5f));
|
_texCoords->push_back(osg::Vec2f(0.5f, 0.5f));
|
||||||
_vertices->push_back(osg::Vec2f(-xOffset, 256.0 + yOffset));
|
_vertices->push_back(osg::Vec2f(-xOffset, 256.0 + yOffset));
|
||||||
maskPSet->set(osg::PrimitiveSet::QUADS, firstQuadVert, 4);
|
maskPSet->set(osg::PrimitiveSet::QUADS, firstQuadVert, 4);
|
||||||
|
firstQuadVert += 4;
|
||||||
|
|
||||||
// The triangles aren't supposed to be textured, but there's
|
// The triangles aren't supposed to be textured, but there's
|
||||||
// no need to set up a different Geometry, switch modes,
|
// no need to set up a different Geometry, switch modes,
|
||||||
|
@ -443,25 +444,33 @@ wxRadarBg::update (double delta_time_sec)
|
||||||
for (int i = 0; i < 3 * 4; i++)
|
for (int i = 0; i < 3 * 4; i++)
|
||||||
_texCoords->push_back(whiteSpot);
|
_texCoords->push_back(whiteSpot);
|
||||||
|
|
||||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, firstQuadVert + 4, 3 * 4);
|
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, firstQuadVert, 3 * 4);
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
maskPSet->set(osg::PrimitiveSet::QUADS, 0, 0);
|
maskPSet->set(osg::PrimitiveSet::QUADS, 0, 0);
|
||||||
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, 0, 0);
|
trimaskPSet->set(osg::PrimitiveSet::TRIANGLES, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskPSet->dirty();
|
maskPSet->dirty();
|
||||||
trimaskPSet->dirty();
|
trimaskPSet->dirty();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// draw without mask
|
// remember index of next vertex
|
||||||
_vertices->clear();
|
int vIndex = _vertices->size();
|
||||||
_texCoords->clear();
|
|
||||||
|
update_weather();
|
||||||
|
|
||||||
|
osg::DrawArrays *quadPSet
|
||||||
|
= static_cast<osg::DrawArrays*>(_geom->getPrimitiveSet(0));
|
||||||
|
|
||||||
update_aircraft();
|
update_aircraft();
|
||||||
update_tacan();
|
update_tacan();
|
||||||
update_heading_marker();
|
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();
|
quadPSet->dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,7 @@ void fgWarpMouse(int x, int y)
|
||||||
|
|
||||||
void fgOSInit(int* argc, char** argv)
|
void fgOSInit(int* argc, char** argv)
|
||||||
{
|
{
|
||||||
|
globals->get_renderer()->init();
|
||||||
WindowSystemAdapter::setWSA(new WindowSystemAdapter);
|
WindowSystemAdapter::setWSA(new WindowSystemAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ static void fgMainLoop( void ) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fgSplashProgress("loading scenery");
|
||||||
// be nice to loader threads while waiting for initial scenery, reduce to 2fps
|
// be nice to loader threads while waiting for initial scenery, reduce to 2fps
|
||||||
simgear::sleepForMSec(500);
|
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
|
// 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
|
// The first few passes take care of initialization things (a couple
|
||||||
// per pass) and once everything has been initialized fgMainLoop from
|
// per pass) and once everything has been initialized fgMainLoop from
|
||||||
|
@ -348,20 +349,17 @@ static void fgIdleFunction ( void ) {
|
||||||
if (!guiFinishInit())
|
if (!guiFinishInit())
|
||||||
return;
|
return;
|
||||||
idle_state++;
|
idle_state++;
|
||||||
fgSplashProgress("reading aircraft list");
|
fgSplashProgress("loading aircraft list");
|
||||||
|
|
||||||
|
|
||||||
} else if ( idle_state == 2 ) {
|
} else if ( idle_state == 2 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
|
fgSplashProgress("loading navigation data");
|
||||||
fgSplashProgress("reading airport & navigation data");
|
|
||||||
|
|
||||||
|
|
||||||
} else if ( idle_state == 3 ) {
|
} else if ( idle_state == 3 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
fgInitNav();
|
fgInitNav();
|
||||||
fgSplashProgress("setting up scenery");
|
|
||||||
|
|
||||||
|
fgSplashProgress("initializing scenery system");
|
||||||
|
|
||||||
} else if ( idle_state == 4 ) {
|
} else if ( idle_state == 4 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
|
@ -386,7 +384,6 @@ static void fgIdleFunction ( void ) {
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
fgInitCommands();
|
fgInitCommands();
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the material manager
|
// Initialize the material manager
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -402,15 +399,12 @@ static void fgIdleFunction ( void ) {
|
||||||
globals->get_scenery()->bind();
|
globals->get_scenery()->bind();
|
||||||
globals->set_tile_mgr( new FGTileMgr );
|
globals->set_tile_mgr( new FGTileMgr );
|
||||||
|
|
||||||
|
|
||||||
fgSplashProgress("loading aircraft");
|
fgSplashProgress("loading aircraft");
|
||||||
|
|
||||||
|
|
||||||
} else if ( idle_state == 5 ) {
|
} else if ( idle_state == 5 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
|
|
||||||
fgSplashProgress("generating sky elements");
|
fgSplashProgress("initializing sky elements");
|
||||||
|
|
||||||
|
|
||||||
} else if ( idle_state == 6 ) {
|
} else if ( idle_state == 6 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
|
@ -471,10 +465,8 @@ static void fgIdleFunction ( void ) {
|
||||||
// airport->setName( "Airport Lighting" );
|
// airport->setName( "Airport Lighting" );
|
||||||
// lighting->addKid( airport );
|
// lighting->addKid( airport );
|
||||||
|
|
||||||
// build our custom render states
|
|
||||||
fgSplashProgress("initializing subsystems");
|
fgSplashProgress("initializing subsystems");
|
||||||
|
|
||||||
|
|
||||||
} else if ( idle_state == 7 ) {
|
} else if ( idle_state == 7 ) {
|
||||||
idle_state++;
|
idle_state++;
|
||||||
// Initialize audio support
|
// Initialize audio support
|
||||||
|
@ -531,18 +523,18 @@ static void fgIdleFunction ( void ) {
|
||||||
fgSetPosFromAirportIDandHdg( apt, hdg );
|
fgSetPosFromAirportIDandHdg( apt, hdg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fgSplashProgress("setting up time & renderer");
|
|
||||||
|
fgSplashProgress("initializing graphics engine");
|
||||||
|
|
||||||
} else if ( idle_state == 8 ) {
|
} else if ( idle_state == 8 ) {
|
||||||
idle_state = 1000;
|
idle_state = 1000;
|
||||||
|
|
||||||
// setup OpenGL view parameters
|
// setup OpenGL view parameters
|
||||||
globals->get_renderer()->init();
|
globals->get_renderer()->setupView();
|
||||||
|
|
||||||
globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"),
|
globals->get_renderer()->resize( fgGetInt("/sim/startup/xsize"),
|
||||||
fgGetInt("/sim/startup/ysize") );
|
fgGetInt("/sim/startup/ysize") );
|
||||||
|
|
||||||
fgSplashProgress("loading scenery objects");
|
|
||||||
int session = fgGetInt("/sim/session",0);
|
int session = fgGetInt("/sim/session",0);
|
||||||
session++;
|
session++;
|
||||||
fgSetInt("/sim/session",session);
|
fgSetInt("/sim/session",session);
|
||||||
|
@ -673,5 +665,3 @@ int fgMainInit( int argc, char **argv ) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -440,7 +440,11 @@ FGRenderer::init( void )
|
||||||
|
|
||||||
_cloud_status = fgGetNode("/environment/clouds/status", true);
|
_cloud_status = fgGetNode("/environment/clouds/status", true);
|
||||||
_visibility_m = fgGetNode("/environment/visibility-m", true);
|
_visibility_m = fgGetNode("/environment/visibility-m", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGRenderer::setupView( void )
|
||||||
|
{
|
||||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
||||||
osg::initNotifyLevel();
|
osg::initNotifyLevel();
|
||||||
|
|
||||||
|
@ -593,12 +597,10 @@ FGRenderer::update()
|
||||||
// Update all Visuals (redraws anything graphics related)
|
// Update all Visuals (redraws anything graphics related)
|
||||||
void
|
void
|
||||||
FGRenderer::update( bool refresh_camera_settings ) {
|
FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
if ((!_scenery_loaded.get())||
|
if (!(_scenery_loaded->getBoolValue() ||
|
||||||
!(_scenery_loaded->getBoolValue() ||
|
|
||||||
_scenery_override->getBoolValue()))
|
_scenery_override->getBoolValue()))
|
||||||
{
|
{
|
||||||
// alas, first "update" is being called before "init"...
|
_splash_alpha->setDoubleValue(1.0);
|
||||||
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
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,
|
double delay_time = SGMiscd::min(fade_time/fade_steps_per_sec,
|
||||||
(SGTimeStamp::now() - _splash_time).toSecs());
|
(SGTimeStamp::now() - _splash_time).toSecs());
|
||||||
_splash_time = SGTimeStamp::now();
|
_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);
|
sAlpha -= SGMiscd::max(0.0,delay_time/fade_time);
|
||||||
FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
|
FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
|
||||||
fgSetDouble("/sim/startup/splash-alpha", sAlpha);
|
_splash_alpha->setDoubleValue(sAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool skyblend = _skyblend->getBoolValue();
|
bool skyblend = _skyblend->getBoolValue();
|
||||||
|
@ -770,16 +772,16 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
// Handle new window size or exposure
|
// Handle new window size or exposure
|
||||||
void
|
void
|
||||||
FGRenderer::resize( int width, int height ) {
|
FGRenderer::resize( int width, int height ) {
|
||||||
int view_h;
|
int view_h = height;
|
||||||
|
|
||||||
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 lastwidth = 0;
|
||||||
static int lastheight = 0;
|
static int lastheight = 0;
|
||||||
if (width != lastwidth)
|
if (width != lastwidth)
|
||||||
|
|
|
@ -47,6 +47,8 @@ public:
|
||||||
void splashinit();
|
void splashinit();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
void setupView();
|
||||||
|
|
||||||
void resize(int width, int height );
|
void resize(int width, int height );
|
||||||
|
|
||||||
// calling update( refresh_camera_settings = false ) will not
|
// 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->setPosition(osg::Vec3(0, -0.92, 0));
|
||||||
text->setAlignment(osgText::Text::CENTER_CENTER);
|
text->setAlignment(osgText::Text::CENTER_CENTER);
|
||||||
SGPropertyNode* prop = fgGetNode("/sim/startup/splash-progress-text", true);
|
SGPropertyNode* prop = fgGetNode("/sim/startup/splash-progress-text", true);
|
||||||
|
prop->setStringValue("initializing");
|
||||||
text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
|
text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue