Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89d426470b | ||
|
|
23c7a1b5b7 | ||
|
|
3b21e9434f | ||
|
|
d4a4428e64 | ||
|
|
2dfc057135 | ||
|
|
a25eebef9b | ||
|
|
741c4ca15a |
@@ -322,6 +322,9 @@ sglog()
|
|||||||
# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << endl
|
# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << endl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SG_STRINGIFY(x) #x
|
||||||
|
#define SG_TOSTRING(x) SG_STRINGIFY(x)
|
||||||
|
#define SG_ORIGIN __FILE__ ":" SG_TOSTRING(__LINE__)
|
||||||
|
|
||||||
#endif // _LOGSTREAM_H
|
#endif // _LOGSTREAM_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
// Visual environment helper class
|
// Visual environment helper class
|
||||||
//
|
//
|
||||||
// Written by Harald JOHNSEN, started April 2005.
|
// 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
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||||
//
|
//
|
||||||
@@ -334,7 +331,7 @@ void SGEnviro::setLight(sgVec4 adj_fog_color) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family, float dist, int cloudId) {
|
void SGEnviro::callback_cloud(float heading, float alt, float radius, int family, float dist, int cloudId) {
|
||||||
// send data to wx radar
|
// send data to wx radar
|
||||||
// compute turbulence
|
// compute turbulence
|
||||||
// draw precipitation
|
// draw precipitation
|
||||||
@@ -409,7 +406,7 @@ void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family
|
|||||||
|
|
||||||
// add to the list for the wxRadar instrument
|
// add to the list for the wxRadar instrument
|
||||||
if( LWC > 0.0 )
|
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
|
// NB:data valid only from cockpit view
|
||||||
|
|
||||||
@@ -422,7 +419,7 @@ void SGEnviro::callback_cloud(float bearing, float alt, float radius, int family
|
|||||||
orig.setlon(last_lon * SG_DEGREES_TO_RADIANS );
|
orig.setlon(last_lon * SG_DEGREES_TO_RADIANS );
|
||||||
orig.setelev(0.0);
|
orig.setelev(0.0);
|
||||||
dist = sgSqrt(dist);
|
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;
|
lon = dest.lon() * SG_RADIANS_TO_DEGREES;
|
||||||
lat = dest.lat() * SG_RADIANS_TO_DEGREES;
|
lat = dest.lat() * SG_RADIANS_TO_DEGREES;
|
||||||
addLightning( lon, lat, alt );
|
addLightning( lon, lat, alt );
|
||||||
@@ -714,7 +711,7 @@ void SGLightning::lt_Render(void) {
|
|||||||
|
|
||||||
glTranslatef( ax, ay, -sgEnviro.last_alt );
|
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++ ) {
|
for( int n = 0 ; n < nb_tree ; n++ ) {
|
||||||
if( lt_tree[n].prev < 0 )
|
if( lt_tree[n].prev < 0 )
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
// Visual environment helper class
|
// Visual environment helper class
|
||||||
//
|
//
|
||||||
// Written by Harald JOHNSEN, started April 2005.
|
// 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
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||||
//
|
//
|
||||||
@@ -43,32 +40,24 @@ class SGSoundMgr;
|
|||||||
*/
|
*/
|
||||||
class SGWxRadarEcho {
|
class SGWxRadarEcho {
|
||||||
public:
|
public:
|
||||||
SGWxRadarEcho(float _bearing, float _alt, float _radius, float _dist, float _heading,
|
SGWxRadarEcho(float _heading, float _alt, float _radius, float _dist,
|
||||||
double _LWC, bool _lightning, int _cloudId, bool _aircraft) :
|
double _LWC, bool _lightning, int _cloudId ) :
|
||||||
bearing (_bearing),
|
|
||||||
heading( _heading ),
|
heading( _heading ),
|
||||||
alt ( _alt ),
|
alt ( _alt ),
|
||||||
radius ( _radius ),
|
radius ( _radius ),
|
||||||
dist ( _dist ),
|
dist ( _dist ),
|
||||||
LWC ( _LWC ),
|
LWC ( _LWC ),
|
||||||
lightning ( _lightning ),
|
lightning ( _lightning ),
|
||||||
aircraft ( _aircraft ),
|
|
||||||
cloudId ( _cloudId )
|
cloudId ( _cloudId )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/** the heading and bearing in radian are versus north */
|
/** the heading in radian is versus north */
|
||||||
float bearing, heading;
|
float heading;
|
||||||
float alt, radius, dist;
|
float alt, radius, dist;
|
||||||
|
|
||||||
/** reflectivity converted to liquid water content. */
|
/** reflectivity converted to liquid water content. */
|
||||||
double LWC;
|
double LWC;
|
||||||
|
|
||||||
/** if true then this data is for a lightning else it is for water echo. */
|
/** if true then this data is for a lightning else it is for water echo. */
|
||||||
bool lightning;
|
bool lightning;
|
||||||
|
|
||||||
/** if true then this data is for an aircraft */
|
|
||||||
bool aircraft;
|
|
||||||
|
|
||||||
/** Unique identifier of cloud */
|
/** Unique identifier of cloud */
|
||||||
int cloudId;
|
int cloudId;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ parse_name (const string &path, int &i)
|
|||||||
name = ".";
|
name = ".";
|
||||||
}
|
}
|
||||||
if (i < max && path[i] != '/')
|
if (i < max && path[i] != '/')
|
||||||
throw string("Illegal character after " + name);
|
throw string("illegal character after " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (isalpha(path[i]) || path[i] == '_') {
|
else if (isalpha(path[i]) || path[i] == '_') {
|
||||||
@@ -295,7 +295,7 @@ find_node (SGPropertyNode * current,
|
|||||||
else if (components[position].name == "..") {
|
else if (components[position].name == "..") {
|
||||||
SGPropertyNode * parent = current->getParent();
|
SGPropertyNode * parent = current->getParent();
|
||||||
if (parent == 0)
|
if (parent == 0)
|
||||||
throw string("Attempt to move past root with '..'");
|
throw string("attempt to move past root with '..'");
|
||||||
else
|
else
|
||||||
return find_node(parent, components, position + 1, create);
|
return find_node(parent, components, position + 1, create);
|
||||||
}
|
}
|
||||||
@@ -739,7 +739,11 @@ SGPropertyNode::SGPropertyNode (const char * name,
|
|||||||
_attr(READ|WRITE),
|
_attr(READ|WRITE),
|
||||||
_listeners(0)
|
_listeners(0)
|
||||||
{
|
{
|
||||||
_name = name;
|
int i = 0;
|
||||||
|
_name = parse_name(name, i);
|
||||||
|
if (i != int(strlen(name)) || name[0] == '.')
|
||||||
|
throw string("plain name expected instead of '") + name + '\'';
|
||||||
|
|
||||||
_local_val.string_val = 0;
|
_local_val.string_val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,13 +32,10 @@
|
|||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#include STL_STRING
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
SG_USING_STD(string);
|
|
||||||
SG_USING_STD(vector);
|
SG_USING_STD(vector);
|
||||||
|
|
||||||
#include <simgear/route/waypoint.hxx>
|
#include <simgear/route/waypoint.hxx>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SGWayPoint::SGWayPoint( const double lon, const double lat, const double alt,
|
SGWayPoint::SGWayPoint( const double lon, const double lat, const double alt,
|
||||||
const modetype m, const string s, const string n ) {
|
const modetype m, const string& s, const string& n ) {
|
||||||
target_lon = lon;
|
target_lon = lon;
|
||||||
target_lat = lat;
|
target_lat = lat;
|
||||||
target_alt = alt;
|
target_alt = alt;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
SGWayPoint( const double lon = 0.0, const double lat = 0.0,
|
SGWayPoint( const double lon = 0.0, const double lat = 0.0,
|
||||||
const double alt = 0.0, const modetype m = WGS84,
|
const double alt = 0.0, const modetype m = WGS84,
|
||||||
const string s = "", const string n = "" );
|
const string& s = "", const string& n = "" );
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
~SGWayPoint();
|
~SGWayPoint();
|
||||||
|
|||||||
@@ -75,12 +75,13 @@ SGSoundSample::SGSoundSample() :
|
|||||||
reference_dist(500.0),
|
reference_dist(500.0),
|
||||||
max_dist(3000.),
|
max_dist(3000.),
|
||||||
loop(AL_FALSE),
|
loop(AL_FALSE),
|
||||||
playing(false)
|
playing(false),
|
||||||
|
no_Doppler_effect(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
SGSoundSample::SGSoundSample( const char *path, const char *file) :
|
SGSoundSample::SGSoundSample( const char *path, const char *file , bool _no_Doppler_effect ) :
|
||||||
buffer(0),
|
buffer(0),
|
||||||
source(0),
|
source(0),
|
||||||
pitch(1.0),
|
pitch(1.0),
|
||||||
@@ -88,8 +89,9 @@ SGSoundSample::SGSoundSample( const char *path, const char *file) :
|
|||||||
reference_dist(500.0),
|
reference_dist(500.0),
|
||||||
max_dist(3000.),
|
max_dist(3000.),
|
||||||
loop(AL_FALSE),
|
loop(AL_FALSE),
|
||||||
playing(false)
|
playing(false),
|
||||||
{
|
no_Doppler_effect(_no_Doppler_effect)
|
||||||
|
{
|
||||||
SGPath samplepath( path );
|
SGPath samplepath( path );
|
||||||
if ( strlen(file) ) {
|
if ( strlen(file) ) {
|
||||||
samplepath.append( file );
|
samplepath.append( file );
|
||||||
@@ -145,7 +147,7 @@ SGSoundSample::SGSoundSample( const char *path, const char *file) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq ) :
|
SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq , bool _no_Doppler_effect ) :
|
||||||
buffer(0),
|
buffer(0),
|
||||||
source(0),
|
source(0),
|
||||||
pitch(1.0),
|
pitch(1.0),
|
||||||
@@ -153,7 +155,8 @@ SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq ) :
|
|||||||
reference_dist(500.0),
|
reference_dist(500.0),
|
||||||
max_dist(3000.),
|
max_dist(3000.),
|
||||||
loop(AL_FALSE),
|
loop(AL_FALSE),
|
||||||
playing(false)
|
playing(false),
|
||||||
|
no_Doppler_effect(_no_Doppler_effect)
|
||||||
{
|
{
|
||||||
SG_LOG( SG_GENERAL, SG_DEBUG, "In memory sounds sample" );
|
SG_LOG( SG_GENERAL, SG_DEBUG, "In memory sounds sample" );
|
||||||
|
|
||||||
@@ -313,6 +316,7 @@ SGSoundSample::set_source_pos( ALfloat *pos ) {
|
|||||||
sgAddVec3( final_pos, source_pos, offset_pos );
|
sgAddVec3( final_pos, source_pos, offset_pos );
|
||||||
|
|
||||||
alSourcefv( source, AL_POSITION, final_pos );
|
alSourcefv( source, AL_POSITION, final_pos );
|
||||||
|
print_openal_error("set_source_pos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +331,7 @@ SGSoundSample::set_offset_pos( ALfloat *pos ) {
|
|||||||
sgAddVec3( final_pos, source_pos, offset_pos );
|
sgAddVec3( final_pos, source_pos, offset_pos );
|
||||||
|
|
||||||
alSourcefv( source, AL_POSITION, final_pos );
|
alSourcefv( source, AL_POSITION, final_pos );
|
||||||
|
print_openal_error("set_offset_pos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,10 +355,16 @@ SGSoundSample::set_orientation( ALfloat *dir, ALfloat inner_angle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SGSoundSample::set_source_vel( ALfloat *vel ) {
|
SGSoundSample::set_source_vel( ALfloat *vel , ALfloat *listener_vel ) {
|
||||||
source_vel[0] = vel[0];
|
if (no_Doppler_effect) {
|
||||||
source_vel[1] = vel[1];
|
source_vel[0] = listener_vel[0];
|
||||||
source_vel[2] = vel[2];
|
source_vel[1] = listener_vel[1];
|
||||||
|
source_vel[2] = listener_vel[2];
|
||||||
|
} else {
|
||||||
|
source_vel[0] = vel[0];
|
||||||
|
source_vel[1] = vel[1];
|
||||||
|
source_vel[2] = vel[2];
|
||||||
|
}
|
||||||
if (playing) {
|
if (playing) {
|
||||||
alSourcefv( source, AL_VELOCITY, source_vel );
|
alSourcefv( source, AL_VELOCITY, source_vel );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
# include <AL/alut.h>
|
# include <AL/alut.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +97,7 @@ private:
|
|||||||
|
|
||||||
bool playing;
|
bool playing;
|
||||||
bool bind_source();
|
bool bind_source();
|
||||||
|
bool no_Doppler_effect;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ public:
|
|||||||
should usually be true unless you want to manipulate the data
|
should usually be true unless you want to manipulate the data
|
||||||
later.)
|
later.)
|
||||||
*/
|
*/
|
||||||
SGSoundSample( const char *path, const char *file );
|
SGSoundSample( const char *path, const char *file , bool no_Doppler_effect = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -123,7 +125,7 @@ public:
|
|||||||
should usually be true unless you want to manipulate the data
|
should usually be true unless you want to manipulate the data
|
||||||
later.)
|
later.)
|
||||||
*/
|
*/
|
||||||
SGSoundSample( unsigned char *_data, int len, int _freq );
|
SGSoundSample( unsigned char *_data, int len, int _freq , bool no_Doppler_effect = true );
|
||||||
|
|
||||||
~SGSoundSample();
|
~SGSoundSample();
|
||||||
|
|
||||||
@@ -208,7 +210,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Set velocity of sound source (uses same coordinate system as opengl)
|
* Set velocity of sound source (uses same coordinate system as opengl)
|
||||||
*/
|
*/
|
||||||
void set_source_vel( ALfloat *vel );
|
void set_source_vel( ALfloat *vel , ALfloat *listener_vel );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -345,6 +345,6 @@ void SGSoundMgr::set_source_vel_all( ALfloat *vel ) {
|
|||||||
sample_map_iterator sample_end = samples.end();
|
sample_map_iterator sample_end = samples.end();
|
||||||
for ( ; sample_current != sample_end; ++sample_current ) {
|
for ( ; sample_current != sample_end; ++sample_current ) {
|
||||||
SGSoundSample *sample = sample_current->second;
|
SGSoundSample *sample = sample_current->second;
|
||||||
sample->set_source_vel( vel );
|
sample->set_source_vel( vel , listener_vel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,8 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr,
|
|||||||
// "alSource". The semantics of what is going on here seems
|
// "alSource". The semantics of what is going on here seems
|
||||||
// confused and needs to be thought through more carefully.
|
// confused and needs to be thought through more carefully.
|
||||||
_sample = new SGSoundSample( path.c_str(),
|
_sample = new SGSoundSample( path.c_str(),
|
||||||
node->getStringValue("path", "") );
|
node->getStringValue("path", ""),
|
||||||
|
false );
|
||||||
|
|
||||||
_mgr->add( _sample, _name );
|
_mgr->add( _sample, _name );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include "lowleveltime.h"
|
#include "lowleveltime.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -331,19 +334,18 @@ static void fgtzset_internal (int always, const char *tz)
|
|||||||
fgtzfile_read (tz);
|
fgtzfile_read (tz);
|
||||||
if (use_fgtzfile)
|
if (use_fgtzfile)
|
||||||
return;
|
return;
|
||||||
// The default behaviour of the originale tzset_internal (int always, char* tz)
|
// The default behaviour of the original tzset_internal (int always, char* tz)
|
||||||
// function is to set up a default timezone, in any casetz file_read() fails
|
// function is to set up a default timezone, in any case file_read() fails
|
||||||
// Currently this leads to problems, because it modidifies the system timezone
|
// Currently this leads to problems, because it modifies the system timezone
|
||||||
// and not the local aircraft timezone, contained in FlightGear. I could adapt
|
// and not the local aircraft timezone, contained in FlightGear. I could adapt
|
||||||
// this in future versions of this code, but doubt whether this is what we really
|
// this in future versions of this code, but doubt whether this is what we really
|
||||||
// want. So right now, exit when timezone information reading failed.
|
// want. So right now, throw an exception when timezone information reading failed.
|
||||||
// Guess I'll change that to something like 12 * (FG_LON / 180.0)
|
// Guess I'll change that to something like 12 * (FG_LON / 180.0)
|
||||||
//
|
//
|
||||||
// For now, I'll leave it like this.
|
// For now, I'll leave it like this.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf ("Timezone reading failed\n");
|
throw sg_exception("Timezone reading failed");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
// this emacs "comment out" function is cool!
|
// this emacs "comment out" function is cool!
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include "timezone.h"
|
#include "timezone.h"
|
||||||
|
|
||||||
SGTimeZone::SGTimeZone(float la, float lo, char* cc, char* desc) :
|
SGTimeZone::SGTimeZone(float la, float lo, char* cc, char* desc) :
|
||||||
@@ -126,8 +129,9 @@ SGTimeZoneContainer::SGTimeZoneContainer(const char *filename)
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
FILE* infile = fopen(filename, "rb");
|
FILE* infile = fopen(filename, "rb");
|
||||||
if (!(infile)) {
|
if (!(infile)) {
|
||||||
fprintf(stderr, "Unable to open file %s\n", filename);
|
string e = "Unable to open time zone file '";
|
||||||
exit(1);
|
throw sg_exception(e + filename + '\'');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user