Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
8b17f2b20a
13 changed files with 137 additions and 55 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SDK_PATH="/Developer/SDKs/MacOSX10.5.sdk"
|
SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk"
|
||||||
OSX_TARGET="10.5"
|
OSX_TARGET="10.6"
|
||||||
|
|
||||||
svn co https://macflightgear.svn.sourceforge.net/svnroot/macflightgear/trunk/FlightGearOSX macflightgear
|
svn co https://macflightgear.svn.sourceforge.net/svnroot/macflightgear/trunk/FlightGearOSX macflightgear
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,7 @@ MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
|
||||||
_zoom = 6;
|
_zoom = 6;
|
||||||
_width = maxX - x;
|
_width = maxX - x;
|
||||||
_height = maxY - y;
|
_height = maxY - y;
|
||||||
|
_hasPanned = false;
|
||||||
|
|
||||||
MapData::setFont(legendFont);
|
MapData::setFont(legendFont);
|
||||||
MapData::setPalette(colour);
|
MapData::setPalette(colour);
|
||||||
|
@ -496,6 +497,7 @@ int MapWidget::checkKey (int key, int updown )
|
||||||
|
|
||||||
void MapWidget::pan(const SGVec2d& delta)
|
void MapWidget::pan(const SGVec2d& delta)
|
||||||
{
|
{
|
||||||
|
_hasPanned = true;
|
||||||
_projectionCenter = unproject(-delta);
|
_projectionCenter = unproject(-delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,6 +527,12 @@ void MapWidget::draw(int dx, int dy)
|
||||||
fgGetDouble("/position/latitude-deg"));
|
fgGetDouble("/position/latitude-deg"));
|
||||||
_magneticHeadings = _root->getBoolValue("magnetic-headings");
|
_magneticHeadings = _root->getBoolValue("magnetic-headings");
|
||||||
|
|
||||||
|
if (_hasPanned)
|
||||||
|
{
|
||||||
|
_root->setBoolValue("centre-on-aircraft", false);
|
||||||
|
_hasPanned = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
if (_root->getBoolValue("centre-on-aircraft")) {
|
if (_root->getBoolValue("centre-on-aircraft")) {
|
||||||
_projectionCenter = _aircraft;
|
_projectionCenter = _aircraft;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ private:
|
||||||
double _drawRangeNm;
|
double _drawRangeNm;
|
||||||
double _upHeading; // true heading corresponding to +ve y-axis
|
double _upHeading; // true heading corresponding to +ve y-axis
|
||||||
bool _magneticHeadings;
|
bool _magneticHeadings;
|
||||||
|
bool _hasPanned;
|
||||||
|
|
||||||
SGGeod _projectionCenter;
|
SGGeod _projectionCenter;
|
||||||
SGGeod _aircraft;
|
SGGeod _aircraft;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
#include "FGMouseInput.hxx"
|
#include "FGMouseInput.hxx"
|
||||||
|
#include "Main/globals.hxx"
|
||||||
|
|
||||||
|
|
||||||
void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea )
|
void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea )
|
||||||
{
|
{
|
||||||
// Get the list of hit callbacks. Take the first callback that
|
// Get the list of hit callbacks. Take the first callback that
|
||||||
|
@ -33,7 +33,7 @@ void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea )
|
||||||
// The nearest one is the first one and the deepest
|
// The nearest one is the first one and the deepest
|
||||||
// (the most specialized one in the scenegraph) is the first.
|
// (the most specialized one in the scenegraph) is the first.
|
||||||
std::vector<SGSceneryPick> pickList;
|
std::vector<SGSceneryPick> pickList;
|
||||||
if (FGRenderer::pick(pickList, ea)) {
|
if (globals->get_renderer()->pick(pickList, ea)) {
|
||||||
std::vector<SGSceneryPick>::const_iterator i;
|
std::vector<SGSceneryPick>::const_iterator i;
|
||||||
for (i = pickList.begin(); i != pickList.end(); ++i) {
|
for (i = pickList.begin(); i != pickList.end(); ++i) {
|
||||||
if (i->callback->buttonPressed(b, i->info)) {
|
if (i->callback->buttonPressed(b, i->info)) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ void HUD::Label::draw(void)
|
||||||
|
|
||||||
l = _center_x - pw;
|
l = _center_x - pw;
|
||||||
r = _center_x + pw;
|
r = _center_x + pw;
|
||||||
bool draw_parallel = fabsf(_pointer_width - _w) > 2.0; // draw lines left and right of arrow?
|
bool draw_parallel = fabs(_pointer_width - _w) > 2.0; // draw lines left and right of arrow?
|
||||||
|
|
||||||
if (option_bottom()) {
|
if (option_bottom()) {
|
||||||
if (draw_parallel) {
|
if (draw_parallel) {
|
||||||
|
@ -115,7 +115,7 @@ void HUD::Label::draw(void)
|
||||||
|
|
||||||
l = _center_y - pw;
|
l = _center_y - pw;
|
||||||
r = _center_y + pw;
|
r = _center_y + pw;
|
||||||
draw_parallel = fabsf(_pointer_width - _h) > 2.0;
|
draw_parallel = fabs(_pointer_width - _h) > 2.0;
|
||||||
|
|
||||||
if (option_left()) {
|
if (option_left()) {
|
||||||
if (draw_parallel) {
|
if (draw_parallel) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
|
||||||
_roll(n->getNode("roll-input", false)),
|
_roll(n->getNode("roll-input", false)),
|
||||||
_width_units(int(n->getFloatValue("display-span"))),
|
_width_units(int(n->getFloatValue("display-span"))),
|
||||||
_div_units(int(fabs(n->getFloatValue("divisions")))),
|
_div_units(int(fabs(n->getFloatValue("divisions")))),
|
||||||
_scr_hole(fabsf(n->getFloatValue("screen-hole")) * 0.5f),
|
_scr_hole(fabs(n->getFloatValue("screen-hole")) * 0.5f),
|
||||||
_zero_bar_overlength(n->getFloatValue("zero-bar-overlength", 10)),
|
_zero_bar_overlength(n->getFloatValue("zero-bar-overlength", 10)),
|
||||||
_dive_bar_angle(n->getBoolValue("enable-dive-bar-angle")),
|
_dive_bar_angle(n->getBoolValue("enable-dive-bar-angle")),
|
||||||
_tick_length(n->getFloatValue("tick-length")),
|
_tick_length(n->getFloatValue("tick-length")),
|
||||||
|
|
|
@ -534,7 +534,7 @@ void HUD::Tape::draw_horizontal(float value)
|
||||||
|
|
||||||
char *HUD::Tape::format_value(float v)
|
char *HUD::Tape::format_value(float v)
|
||||||
{
|
{
|
||||||
if (fabsf(v) < 1e-8) // avoid -0.0
|
if (fabs(v) < 1e-8) // avoid -0.0
|
||||||
v = 0.0f;
|
v = 0.0f;
|
||||||
|
|
||||||
if (_label_fmt == INT)
|
if (_label_fmt == INT)
|
||||||
|
|
|
@ -129,12 +129,12 @@ void HUD::TurnBankIndicator::draw_scale()
|
||||||
|
|
||||||
int dir = bank > 0 ? 1 : -1;
|
int dir = bank > 0 ? 1 : -1;
|
||||||
|
|
||||||
if (fabsf(bank) > 25) {
|
if (fabs(bank) > 25) {
|
||||||
draw_tick(45, r, minor, dir);
|
draw_tick(45, r, minor, dir);
|
||||||
draw_tick(60, r, major, dir);
|
draw_tick(60, r, major, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabsf(bank) > 55) {
|
if (fabs(bank) > 55) {
|
||||||
draw_tick(90, r, major, dir);
|
draw_tick(90, r, major, dir);
|
||||||
draw_tick(135, r, major, dir);
|
draw_tick(135, r, major, dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,6 +314,16 @@ do_resume (const SGPropertyNode * arg)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool
|
||||||
|
do_pause (const SGPropertyNode * arg)
|
||||||
|
{
|
||||||
|
bool paused = fgGetBool("/sim/freeze/master",true) || fgGetBool("/sim/freeze/clock",true);
|
||||||
|
fgSetBool("/sim/freeze/master",!paused);
|
||||||
|
fgSetBool("/sim/freeze/clock",!paused);
|
||||||
|
if (fgGetBool("/sim/freeze/replay-state",false))
|
||||||
|
fgSetBool("/sim/replay/disable",true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Built-in command: load flight.
|
* Built-in command: load flight.
|
||||||
|
@ -1432,6 +1442,7 @@ static struct {
|
||||||
{ "reinit", do_reinit },
|
{ "reinit", do_reinit },
|
||||||
{ "suspend", do_reinit },
|
{ "suspend", do_reinit },
|
||||||
{ "resume", do_reinit },
|
{ "resume", do_reinit },
|
||||||
|
{ "pause", do_pause },
|
||||||
{ "load", do_load },
|
{ "load", do_load },
|
||||||
{ "save", do_save },
|
{ "save", do_save },
|
||||||
{ "panel-load", do_panel_load },
|
{ "panel-load", do_panel_load },
|
||||||
|
|
|
@ -203,6 +203,7 @@ static void fgMainLoop( void ) {
|
||||||
if (globals->get_tile_mgr()->isSceneryLoaded()
|
if (globals->get_tile_mgr()->isSceneryLoaded()
|
||||||
&& fgGetBool("sim/fdm-initialized")) {
|
&& fgGetBool("sim/fdm-initialized")) {
|
||||||
fgSetBool("sim/sceneryloaded",true);
|
fgSetBool("sim/sceneryloaded",true);
|
||||||
|
fgSplashProgress("");
|
||||||
if (fgGetBool("/sim/sound/working")) {
|
if (fgGetBool("/sim/sound/working")) {
|
||||||
globals->get_soundmgr()->activate();
|
globals->get_soundmgr()->activate();
|
||||||
}
|
}
|
||||||
|
@ -555,6 +556,10 @@ static void fgIdleFunction ( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fgWinResizeFunction(int width, int height)
|
||||||
|
{
|
||||||
|
globals->get_renderer()->resize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
static void upper_case_property(const char *name)
|
static void upper_case_property(const char *name)
|
||||||
{
|
{
|
||||||
|
@ -644,7 +649,7 @@ int fgMainInit( int argc, char **argv ) {
|
||||||
fgOSInit(&argc, argv);
|
fgOSInit(&argc, argv);
|
||||||
_bootstrap_OSInit++;
|
_bootstrap_OSInit++;
|
||||||
|
|
||||||
fgRegisterWindowResizeHandler( &FGRenderer::resize );
|
fgRegisterWindowResizeHandler( &fgWinResizeFunction );
|
||||||
fgRegisterIdleHandler( &fgIdleFunction );
|
fgRegisterIdleHandler( &fgIdleFunction );
|
||||||
fgRegisterDrawHandler( &FGRenderer::update );
|
fgRegisterDrawHandler( &FGRenderer::update );
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public:
|
||||||
hint->setMode(GL_DONT_CARE);
|
hint->setMode(GL_DONT_CARE);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<SGPropertyNode> mConfigNode;
|
SGPropertyNode_ptr mConfigNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ private:
|
||||||
class FGWireFrameModeUpdateCallback : public osg::StateAttribute::Callback {
|
class FGWireFrameModeUpdateCallback : public osg::StateAttribute::Callback {
|
||||||
public:
|
public:
|
||||||
FGWireFrameModeUpdateCallback() :
|
FGWireFrameModeUpdateCallback() :
|
||||||
mWireframe(fgGetNode("/sim/rendering/wireframe"))
|
mWireframe(fgGetNode("/sim/rendering/wireframe", true))
|
||||||
{ }
|
{ }
|
||||||
virtual void operator()(osg::StateAttribute* stateAttribute,
|
virtual void operator()(osg::StateAttribute* stateAttribute,
|
||||||
osg::NodeVisitor*)
|
osg::NodeVisitor*)
|
||||||
|
@ -289,13 +289,13 @@ public:
|
||||||
osg::PolygonMode::FILL);
|
osg::PolygonMode::FILL);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<SGPropertyNode> mWireframe;
|
SGPropertyNode_ptr mWireframe;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGLightModelUpdateCallback : public osg::StateAttribute::Callback {
|
class FGLightModelUpdateCallback : public osg::StateAttribute::Callback {
|
||||||
public:
|
public:
|
||||||
FGLightModelUpdateCallback() :
|
FGLightModelUpdateCallback() :
|
||||||
mHighlights(fgGetNode("/sim/rendering/specular-highlight"))
|
mHighlights(fgGetNode("/sim/rendering/specular-highlight", true))
|
||||||
{ }
|
{ }
|
||||||
virtual void operator()(osg::StateAttribute* stateAttribute,
|
virtual void operator()(osg::StateAttribute* stateAttribute,
|
||||||
osg::NodeVisitor*)
|
osg::NodeVisitor*)
|
||||||
|
@ -320,13 +320,13 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<SGPropertyNode> mHighlights;
|
SGPropertyNode_ptr mHighlights;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGFogEnableUpdateCallback : public osg::StateSet::Callback {
|
class FGFogEnableUpdateCallback : public osg::StateSet::Callback {
|
||||||
public:
|
public:
|
||||||
FGFogEnableUpdateCallback() :
|
FGFogEnableUpdateCallback() :
|
||||||
mFogEnabled(fgGetNode("/sim/rendering/fog"))
|
mFogEnabled(fgGetNode("/sim/rendering/fog", true))
|
||||||
{ }
|
{ }
|
||||||
virtual void operator()(osg::StateSet* stateSet, osg::NodeVisitor*)
|
virtual void operator()(osg::StateSet* stateSet, osg::NodeVisitor*)
|
||||||
{
|
{
|
||||||
|
@ -337,7 +337,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<SGPropertyNode> mFogEnabled;
|
SGPropertyNode_ptr mFogEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGFogUpdateCallback : public osg::StateAttribute::Callback {
|
class FGFogUpdateCallback : public osg::StateAttribute::Callback {
|
||||||
|
@ -362,15 +362,18 @@ public:
|
||||||
assert(dynamic_cast<osg::Switch*>(node));
|
assert(dynamic_cast<osg::Switch*>(node));
|
||||||
osg::Switch* sw = static_cast<osg::Switch*>(node);
|
osg::Switch* sw = static_cast<osg::Switch*>(node);
|
||||||
|
|
||||||
double t = globals->get_sim_time_sec();
|
bool enabled = scenery_enabled;
|
||||||
bool enabled = 0 < t;
|
|
||||||
sw->setValue(0, enabled);
|
sw->setValue(0, enabled);
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool scenery_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool FGScenerySwitchCallback::scenery_enabled = false;
|
||||||
|
|
||||||
// Sky structures
|
// Sky structures
|
||||||
SGSky *thesky;
|
SGSky *thesky;
|
||||||
|
|
||||||
|
@ -387,6 +390,7 @@ FGRenderer::FGRenderer()
|
||||||
jpgRenderFrame = FGRenderer::update;
|
jpgRenderFrame = FGRenderer::update;
|
||||||
#endif
|
#endif
|
||||||
eventHandler = new FGEventHandler;
|
eventHandler = new FGEventHandler;
|
||||||
|
_splash_screen_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGRenderer::~FGRenderer()
|
FGRenderer::~FGRenderer()
|
||||||
|
@ -409,11 +413,34 @@ FGRenderer::splashinit( void ) {
|
||||||
// visitor automatically.
|
// visitor automatically.
|
||||||
mUpdateVisitor->setFrameStamp(mFrameStamp.get());
|
mUpdateVisitor->setFrameStamp(mFrameStamp.get());
|
||||||
viewer->setUpdateVisitor(mUpdateVisitor.get());
|
viewer->setUpdateVisitor(mUpdateVisitor.get());
|
||||||
|
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FGRenderer::init( void )
|
FGRenderer::init( void )
|
||||||
{
|
{
|
||||||
|
_scenery_loaded = fgGetNode("/sim/sceneryloaded", true);
|
||||||
|
_scenery_override = fgGetNode("/sim/sceneryloaded-override", true);
|
||||||
|
_panel_hotspots = fgGetNode("/sim/panel-hotspots", true);
|
||||||
|
_virtual_cockpit = fgGetNode("/sim/virtual-cockpit", true);
|
||||||
|
|
||||||
|
_sim_delta_sec = fgGetNode("/sim/time/delta-sec", true);
|
||||||
|
|
||||||
|
_xsize = fgGetNode("/sim/startup/xsize", true);
|
||||||
|
_ysize = fgGetNode("/sim/startup/ysize", true);
|
||||||
|
|
||||||
|
_skyblend = fgGetNode("/sim/rendering/skyblend", true);
|
||||||
|
_point_sprites = fgGetNode("/sim/rendering/point-sprites", true);
|
||||||
|
_enhanced_lighting = fgGetNode("/sim/rendering/enhanced-lighting", true);
|
||||||
|
_distance_attenuation = fgGetNode("/sim/rendering/distance-attenuation", true);
|
||||||
|
_horizon_effect = fgGetNode("/sim/rendering/horizon-effect", true);
|
||||||
|
_textures = fgGetNode("/sim/rendering/textures", true);
|
||||||
|
|
||||||
|
_altitude_ft = fgGetNode("/position/altitude-ft", true);
|
||||||
|
|
||||||
|
_cloud_status = fgGetNode("/environment/clouds/status", true);
|
||||||
|
_visibility_m = fgGetNode("/environment/visibility-m", true);
|
||||||
|
|
||||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
||||||
osg::initNotifyLevel();
|
osg::initNotifyLevel();
|
||||||
|
|
||||||
|
@ -557,27 +584,46 @@ FGRenderer::init( void )
|
||||||
stateSet->setAttributeAndModes(new osg::Program, osg::StateAttribute::ON);
|
stateSet->setAttributeAndModes(new osg::Program, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGRenderer::update()
|
||||||
|
{
|
||||||
|
globals->get_renderer()->update(true);
|
||||||
|
}
|
||||||
|
|
||||||
// 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 ) {
|
||||||
bool scenery_loaded = fgGetBool("sim/sceneryloaded", false)
|
if ((!_scenery_loaded.get())||
|
||||||
|| fgGetBool("sim/sceneryloaded-override");
|
!(_scenery_loaded->getBoolValue() ||
|
||||||
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
_scenery_override->getBoolValue()))
|
||||||
if (!scenery_loaded) {
|
{
|
||||||
|
// alas, first "update" is being called before "init"...
|
||||||
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
||||||
|
_splash_screen_active = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
osgViewer::Viewer* viewer = globals->get_renderer()->getViewer();
|
||||||
|
|
||||||
// Fade out the splash screen over the first three seconds.
|
if (_splash_screen_active)
|
||||||
double sAlpha = SGMiscd::max(0, (2.5 - globals->get_sim_time_sec()) / 2.5);
|
{
|
||||||
|
// Fade out the splash screen
|
||||||
|
const double fade_time = 0.8;
|
||||||
|
const double fade_steps_per_sec = 20;
|
||||||
|
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);
|
||||||
|
sAlpha -= SGMiscd::max(0.0,delay_time/fade_time);
|
||||||
|
FGScenerySwitchCallback::scenery_enabled = (sAlpha<1.0);
|
||||||
|
_splash_screen_active = (sAlpha > 0.0);
|
||||||
fgSetDouble("/sim/startup/splash-alpha", sAlpha);
|
fgSetDouble("/sim/startup/splash-alpha", sAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool skyblend = _skyblend->getBoolValue();
|
||||||
|
bool use_point_sprites = _point_sprites->getBoolValue();
|
||||||
|
bool enhanced_lighting = _enhanced_lighting->getBoolValue();
|
||||||
|
bool distance_attenuation = _distance_attenuation->getBoolValue();
|
||||||
|
|
||||||
bool skyblend = fgGetBool("/sim/rendering/skyblend");
|
|
||||||
bool use_point_sprites = fgGetBool("/sim/rendering/point-sprites");
|
|
||||||
bool enhanced_lighting = fgGetBool("/sim/rendering/enhanced-lighting");
|
|
||||||
bool distance_attenuation
|
|
||||||
= fgGetBool("/sim/rendering/distance-attenuation");
|
|
||||||
// OSGFIXME
|
// OSGFIXME
|
||||||
SGConfigureDirectionalLights( use_point_sprites, enhanced_lighting,
|
SGConfigureDirectionalLights( use_point_sprites, enhanced_lighting,
|
||||||
distance_attenuation );
|
distance_attenuation );
|
||||||
|
@ -586,10 +632,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
|
|
||||||
// update fog params
|
// update fog params
|
||||||
double actual_visibility;
|
double actual_visibility;
|
||||||
if (fgGetBool("/environment/clouds/status")) {
|
if (_cloud_status->getBoolValue()) {
|
||||||
actual_visibility = thesky->get_visibility();
|
actual_visibility = thesky->get_visibility();
|
||||||
} else {
|
} else {
|
||||||
actual_visibility = fgGetDouble("/environment/visibility-m");
|
actual_visibility = _visibility_m->getDoubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// idle_state is now 1000 meaning we've finished all our
|
// idle_state is now 1000 meaning we've finished all our
|
||||||
|
@ -602,27 +648,27 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
|
|
||||||
if ( refresh_camera_settings ) {
|
if ( refresh_camera_settings ) {
|
||||||
// update view port
|
// update view port
|
||||||
resize( fgGetInt("/sim/startup/xsize"),
|
resize( _xsize->getIntValue(),
|
||||||
fgGetInt("/sim/startup/ysize") );
|
_ysize->getIntValue() );
|
||||||
}
|
}
|
||||||
osg::Camera *camera = viewer->getCamera();
|
osg::Camera *camera = viewer->getCamera();
|
||||||
|
|
||||||
if ( skyblend ) {
|
if ( skyblend ) {
|
||||||
|
|
||||||
if ( fgGetBool("/sim/rendering/textures") ) {
|
if ( _textures->getBoolValue() ) {
|
||||||
SGVec4f clearColor(l->adj_fog_color());
|
SGVec4f clearColor(l->adj_fog_color());
|
||||||
camera->setClearColor(osg::Vec4(0.0, 0.0, 0.0, 1.0));
|
camera->setClearColor(toOsg(clearColor));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SGVec4f clearColor(l->sky_color());
|
SGVec4f clearColor(l->sky_color());
|
||||||
camera->setClearColor(osg::Vec4(0.0, 0.0, 0.0, 1.0));
|
camera->setClearColor(toOsg(clearColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update fog params if visibility has changed
|
// update fog params if visibility has changed
|
||||||
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
double visibility_meters = _visibility_m->getDoubleValue();
|
||||||
thesky->set_visibility(visibility_meters);
|
thesky->set_visibility(visibility_meters);
|
||||||
|
|
||||||
double altitude_m = fgGetDouble("/position/altitude-ft") * SG_FEET_TO_METER;
|
double altitude_m = _altitude_ft->getDoubleValue() * SG_FEET_TO_METER;
|
||||||
thesky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
|
thesky->modify_vis( altitude_m, 0.0 /* time factor, now unused */);
|
||||||
|
|
||||||
// update the sky dome
|
// update the sky dome
|
||||||
|
@ -635,7 +681,7 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
// Sun distance: 150,000,000 kilometers
|
// Sun distance: 150,000,000 kilometers
|
||||||
|
|
||||||
double sun_horiz_eff, moon_horiz_eff;
|
double sun_horiz_eff, moon_horiz_eff;
|
||||||
if (fgGetBool("/sim/rendering/horizon-effect")) {
|
if (_horizon_effect->getBoolValue()) {
|
||||||
sun_horiz_eff
|
sun_horiz_eff
|
||||||
= 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_sun_angle()),
|
= 0.67 + pow(osg::clampAbove(0.5 + cos(l->get_sun_angle()),
|
||||||
0.0),
|
0.0),
|
||||||
|
@ -666,7 +712,7 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
scolor.sun_angle = l->get_sun_angle();
|
scolor.sun_angle = l->get_sun_angle();
|
||||||
scolor.moon_angle = l->get_moon_angle();
|
scolor.moon_angle = l->get_moon_angle();
|
||||||
|
|
||||||
double delta_time_sec = fgGetDouble("/sim/time/delta-sec");
|
double delta_time_sec = _sim_delta_sec->getDoubleValue();
|
||||||
thesky->reposition( sstate, *globals->get_ephem(), delta_time_sec );
|
thesky->reposition( sstate, *globals->get_ephem(), delta_time_sec );
|
||||||
thesky->repaint( scolor, *globals->get_ephem() );
|
thesky->repaint( scolor, *globals->get_ephem() );
|
||||||
|
|
||||||
|
@ -712,11 +758,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
||||||
l->get_sun_angle()*SGD_RADIANS_TO_DEGREES);
|
l->get_sun_angle()*SGD_RADIANS_TO_DEGREES);
|
||||||
mUpdateVisitor->setVisibility(actual_visibility);
|
mUpdateVisitor->setVisibility(actual_visibility);
|
||||||
simgear::GroundLightManager::instance()->update(mUpdateVisitor.get());
|
simgear::GroundLightManager::instance()->update(mUpdateVisitor.get());
|
||||||
bool hotspots = fgGetBool("/sim/panel-hotspots");
|
|
||||||
osg::Node::NodeMask cullMask = ~simgear::LIGHTS_BITS & ~simgear::PICK_BIT;
|
osg::Node::NodeMask cullMask = ~simgear::LIGHTS_BITS & ~simgear::PICK_BIT;
|
||||||
cullMask |= simgear::GroundLightManager::instance()
|
cullMask |= simgear::GroundLightManager::instance()
|
||||||
->getLightNodeMask(mUpdateVisitor.get());
|
->getLightNodeMask(mUpdateVisitor.get());
|
||||||
if (hotspots)
|
if (_panel_hotspots->getBoolValue())
|
||||||
cullMask |= simgear::PICK_BIT;
|
cullMask |= simgear::PICK_BIT;
|
||||||
CameraGroup::getDefault()->setCameraCullMasks(cullMask);
|
CameraGroup::getDefault()->setCameraCullMasks(cullMask);
|
||||||
}
|
}
|
||||||
|
@ -729,7 +774,7 @@ void
|
||||||
FGRenderer::resize( int width, int height ) {
|
FGRenderer::resize( int width, int height ) {
|
||||||
int view_h;
|
int view_h;
|
||||||
|
|
||||||
if ( (!fgGetBool("/sim/virtual-cockpit"))
|
if ( (!_virtual_cockpit->getBoolValue())
|
||||||
&& fgPanelVisible() && idle_state == 1000 ) {
|
&& fgPanelVisible() && idle_state == 1000 ) {
|
||||||
view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
|
view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
|
||||||
globals->get_current_panel()->getYOffset()) / 768.0);
|
globals->get_current_panel()->getYOffset()) / 768.0);
|
||||||
|
@ -740,9 +785,9 @@ FGRenderer::resize( int width, int height ) {
|
||||||
static int lastwidth = 0;
|
static int lastwidth = 0;
|
||||||
static int lastheight = 0;
|
static int lastheight = 0;
|
||||||
if (width != lastwidth)
|
if (width != lastwidth)
|
||||||
fgSetInt("/sim/startup/xsize", lastwidth = width);
|
_xsize->setIntValue(lastwidth = width);
|
||||||
if (height != lastheight)
|
if (height != lastheight)
|
||||||
fgSetInt("/sim/startup/ysize", lastheight = height);
|
_ysize->setIntValue(lastheight = height);
|
||||||
|
|
||||||
// for all views
|
// for all views
|
||||||
FGViewMgr *viewmgr = globals->get_viewmgr();
|
FGViewMgr *viewmgr = globals->get_viewmgr();
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#define __FG_RENDERER_HXX 1
|
#define __FG_RENDERER_HXX 1
|
||||||
|
|
||||||
#include <simgear/scene/util/SGPickCallback.hxx>
|
#include <simgear/scene/util/SGPickCallback.hxx>
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
#include <simgear/timing/timestamp.hxx>
|
||||||
|
|
||||||
#include <osg/ref_ptr>
|
#include <osg/ref_ptr>
|
||||||
|
|
||||||
|
@ -45,17 +47,17 @@ public:
|
||||||
void splashinit();
|
void splashinit();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
static 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
|
||||||
// touch window or camera settings. This is useful for the tiled
|
// touch window or camera settings. This is useful for the tiled
|
||||||
// renderer which needs to set the view frustum itself.
|
// renderer which needs to set the view frustum itself.
|
||||||
static void update( bool refresh_camera_settings );
|
void update( bool refresh_camera_settings);
|
||||||
inline static void update() { update( true ); }
|
static void update();
|
||||||
|
|
||||||
/** Just pick into the scene and return the pick callbacks on the way ...
|
/** Just pick into the scene and return the pick callbacks on the way ...
|
||||||
*/
|
*/
|
||||||
static bool pick( std::vector<SGSceneryPick>& pickList,
|
bool pick( std::vector<SGSceneryPick>& pickList,
|
||||||
const osgGA::GUIEventAdapter* ea );
|
const osgGA::GUIEventAdapter* ea );
|
||||||
|
|
||||||
/** Get and set the OSG Viewer object, if any.
|
/** Get and set the OSG Viewer object, if any.
|
||||||
|
@ -76,6 +78,16 @@ public:
|
||||||
protected:
|
protected:
|
||||||
osg::ref_ptr<osgViewer::Viewer> viewer;
|
osg::ref_ptr<osgViewer::Viewer> viewer;
|
||||||
osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
|
osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
|
||||||
|
SGPropertyNode_ptr _scenery_loaded,_scenery_override;
|
||||||
|
SGPropertyNode_ptr _skyblend;
|
||||||
|
SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
|
||||||
|
SGPropertyNode_ptr _textures;
|
||||||
|
SGPropertyNode_ptr _cloud_status, _visibility_m;
|
||||||
|
SGPropertyNode_ptr _xsize, _ysize;
|
||||||
|
SGPropertyNode_ptr _panel_hotspots, _sim_delta_sec, _horizon_effect, _altitude_ft;
|
||||||
|
SGPropertyNode_ptr _virtual_cockpit;
|
||||||
|
SGTimeStamp _splash_time;
|
||||||
|
bool _splash_screen_active;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool fgDumpSceneGraphToFile(const char* filename);
|
bool fgDumpSceneGraphToFile(const char* filename);
|
||||||
|
|
2
version
2
version
|
@ -1 +1 @@
|
||||||
2.2.0
|
2.3.0
|
||||||
|
|
Loading…
Reference in a new issue