X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fenvironment%2Fvisual_enviro.cxx;h=b0cb219059f4b8ceecf844b8d7cb3581a0c85886;hb=aa2ed5fb0cb16766f440231f23581bb90e9963d8;hp=b879d025535aac34629954fae4fa601572219507;hpb=cd5a7202111b53d4c69cf6ca3ad267abdd070d78;p=simgear.git diff --git a/simgear/environment/visual_enviro.cxx b/simgear/environment/visual_enviro.cxx index b879d025..b0cb2190 100644 --- a/simgear/environment/visual_enviro.cxx +++ b/simgear/environment/visual_enviro.cxx @@ -1,9 +1,6 @@ // Visual environment helper class // // Written by Harald JOHNSEN, started April 2005. -// Minor changes/additions by Vivian Meazza Apr- May 2007 -// -// Ported to OSG by Tim Moore Jun 2007 // // Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net // @@ -33,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -41,7 +38,7 @@ #include -SG_USING_STD(vector); +using std::vector; typedef struct { @@ -178,7 +175,7 @@ SGEnviro::SGEnviro() : lightning_enable_state(false), elapsed_time(0.0), dt(0.0), - soundMgr(NULL), + sampleGroup(NULL), snd_active(false), snd_dist(0.0), min_time_before_lt(0.0), @@ -192,6 +189,8 @@ SGEnviro::SGEnviro() : } SGEnviro::~SGEnviro(void) { + if (sampleGroup) delete sampleGroup; + // OSGFIXME return; list_of_lightning::iterator iLightning; @@ -206,8 +205,6 @@ void SGEnviro::startOfFrame( sgVec3 p, sgVec3 up, double lon, double lat, double return; view_in_cloud = false; // ask the impostor cache to do some cleanup - if(SGNewCloud::cldCache) - SGNewCloud::cldCache->startNewFrame(); last_cloud_turbulence = cloud_turbulence; cloud_turbulence = 0.0; elapsed_time += delta_time; @@ -258,43 +255,10 @@ void SGEnviro::set_view_in_cloud(bool incloud) { view_in_cloud = incloud; } -int SGEnviro::get_CacheResolution(void) const { - return SGCloudField::get_CacheResolution(); -} - -int SGEnviro::get_clouds_CacheSize(void) const { - return SGCloudField::get_CacheSize(); -} -float SGEnviro::get_clouds_visibility(void) const { - return SGCloudField::get_CloudVis(); -} -float SGEnviro::get_clouds_density(void) const { - return SGCloudField::get_density(); -} -bool SGEnviro::get_clouds_enable_state(void) const { - return SGCloudField::get_enable3dClouds(); -} - bool SGEnviro::get_turbulence_enable_state(void) const { return turbulence_enable_state; } -void SGEnviro::set_CacheResolution(int resolutionPixels) { - SGCloudField::set_CacheResolution(resolutionPixels); -} - -void SGEnviro::set_clouds_CacheSize(int sizeKb) { - SGCloudField::set_CacheSize(sizeKb); -} -void SGEnviro::set_clouds_visibility(float distance) { - SGCloudField::set_CloudVis(distance); -} -void SGEnviro::set_clouds_density(float density) { - SGCloudField::set_density(density); -} -void SGEnviro::set_clouds_enable_state(bool enable) { - SGCloudField::set_enable3dClouds(enable); -} void SGEnviro::set_turbulence_enable_state(bool enable) { turbulence_enable_state = enable; } @@ -333,8 +297,8 @@ void SGEnviro::setLight(sgVec4 adj_fog_color) { // ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, l->scene_diffuse() ); } } - -void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family, float dist, int cloudId) { +#if 0 +void SGEnviro::callback_cloud(float heading, float alt, float radius, int family, float dist, int cloudId) { // send data to wx radar // compute turbulence // draw precipitation @@ -409,7 +373,7 @@ void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family // add to the list for the wxRadar instrument if( LWC > 0.0 ) - radarEcho.push_back( SGWxRadarEcho ( bearing, alt, radius, dist, 0.0 , LWC, false, cloudId, false ) ); + radarEcho.push_back( SGWxRadarEcho ( heading, alt, radius, dist, LWC, false, cloudId ) ); // NB:data valid only from cockpit view @@ -422,7 +386,7 @@ void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family orig.setlon(last_lon * SG_DEGREES_TO_RADIANS ); orig.setelev(0.0); dist = sgSqrt(dist); - dest = calc_gc_lon_lat(orig, bearing, dist); + dest = calc_gc_lon_lat(orig, heading, dist); lon = dest.lon() * SG_RADIANS_TO_DEGREES; lat = dest.lat() * SG_RADIANS_TO_DEGREES; addLightning( lon, lat, alt ); @@ -444,6 +408,8 @@ void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family } } +#endif + list_of_SGWxRadarEcho *SGEnviro::get_radar_echo(void) { return &radarEcho; } @@ -566,8 +532,8 @@ void SGEnviro::drawRain(double pitch, double roll, double heading, double hspeed } -void SGEnviro::set_soundMgr(SGSoundMgr *mgr) { - soundMgr = mgr; +void SGEnviro::set_sampleGroup(SGSampleGroup *sgr) { + sampleGroup = sgr; } void SGEnviro::drawPrecipitation(double rain_norm, double snow_norm, double hail_norm, double pitch, double roll, double heading, double hspeed) { @@ -652,7 +618,7 @@ void SGLightning::lt_build(void) { top[PY] = alt; top[PZ] = 0; lt_build_tree_branch(0, top, 1.0, 50, top[PY] / 8.0); - if( ! sgEnviro.soundMgr ) + if( ! sgEnviro.sampleGroup ) return; Point3D start( sgEnviro.last_lon*SG_DEGREES_TO_RADIANS, sgEnviro.last_lat*SG_DEGREES_TO_RADIANS, 0.0 ); Point3D dest( lon*SG_DEGREES_TO_RADIANS, lat*SG_DEGREES_TO_RADIANS, 0.0 ); @@ -714,7 +680,7 @@ void SGLightning::lt_Render(void) { glTranslatef( ax, ay, -sgEnviro.last_alt ); - sgEnviro.radarEcho.push_back( SGWxRadarEcho ( course, 0.0, 0.0, dist, 0.0, age, true, 0, false ) ); + sgEnviro.radarEcho.push_back( SGWxRadarEcho ( course, 0.0, 0.0, dist, age, true, 0 ) ); for( int n = 0 ; n < nb_tree ; n++ ) { if( lt_tree[n].prev < 0 ) @@ -773,7 +739,7 @@ void SGEnviro::drawLightning(void) { return; list_of_lightning::iterator iLightning; // play 'thunder' for lightning - if( snd_active ) + if( snd_active ) { if( !snd_playing ) { // wait until sound has reached us snd_timer += dt; @@ -787,20 +753,21 @@ void SGEnviro::drawLightning(void) { double ax = 0.0, ay = 0.0; ax = cos(course) * dist; ay = sin(course) * dist; - SGSharedPtr snd = soundMgr->find("thunder"); + SGSharedPtr snd = sampleGroup->find("thunder"); if( snd ) { - ALfloat pos[3]={ax, ay, -sgEnviro.last_alt }; - snd->set_source_pos(pos); + SGVec3d pos = SGVec3d(ax, ay, -sgEnviro.last_alt); + snd->set_position(pos); snd->play_once(); } } } else { - if( !soundMgr->is_playing("thunder") ) { + if( !sampleGroup->is_playing("thunder") ) { snd_active = false; snd_playing = false; } } + } if( ! lightning_enable_state ) return;