Various Irix cleanups.
Float/Double clean ups for fg_sound.cxx
This commit is contained in:
parent
9dbb215b1d
commit
99fa3a6e79
4 changed files with 25 additions and 22 deletions
|
@ -295,7 +295,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
type = "rotation";
|
type = "rotation";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propName != "") {
|
if (propName != (string)"") {
|
||||||
target = fgGetNode(propName.c_str(), true);
|
target = fgGetNode(propName.c_str(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -552,7 +552,7 @@ void fgRenderFrame( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable( GL_DEPTH_TEST );
|
glEnable( GL_DEPTH_TEST );
|
||||||
if ( fgGetString("/sim/rendering/fog") != (string)"disabled" ) {
|
if ( fgGetString("/sim/rendering/fog") != "disabled" ) {
|
||||||
glEnable( GL_FOG );
|
glEnable( GL_FOG );
|
||||||
glFogi( GL_FOG_MODE, GL_EXP2 );
|
glFogi( GL_FOG_MODE, GL_EXP2 );
|
||||||
glFogfv( GL_FOG_COLOR, l->adj_fog_color );
|
glFogfv( GL_FOG_COLOR, l->adj_fog_color );
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
#include "matlib.hxx"
|
#include "matlib.hxx"
|
||||||
|
|
||||||
|
SG_USING_NAMESPACE(std);
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ bool FGMaterialLib::load( const string& mpath ) {
|
||||||
for (unsigned int j = 0; j < names.size(); j++) {
|
for (unsigned int j = 0; j < names.size(); j++) {
|
||||||
string name = names[j]->getStringValue();
|
string name = names[j]->getStringValue();
|
||||||
m->ref();
|
m->ref();
|
||||||
std::cerr << "Material " << name << endl;
|
// cerr << "Material " << name << endl;
|
||||||
matlib[name] = m;
|
matlib[name] = m;
|
||||||
SG_LOG( SG_TERRAIN, SG_INFO, " Loading material "
|
SG_LOG( SG_TERRAIN, SG_INFO, " Loading material "
|
||||||
<< names[j]->getStringValue());
|
<< names[j]->getStringValue());
|
||||||
|
|
|
@ -86,18 +86,17 @@ FGSound::init()
|
||||||
_property = fgGetNode(_node->getStringValue("property"), true);
|
_property = fgGetNode(_node->getStringValue("property"), true);
|
||||||
|
|
||||||
//
|
//
|
||||||
// seet sound global properties
|
// set global sound properties
|
||||||
//
|
//
|
||||||
_name = _node->getStringValue("name");
|
_name = _node->getStringValue("name");
|
||||||
|
|
||||||
if ((_factor = _node->getFloatValue("factor")) == 0.0)
|
if ((_factor = _node->getDoubleValue("factor")) == 0.0)
|
||||||
_factor = 1.0;
|
_factor = 1.0;
|
||||||
|
|
||||||
if ((_offset = _node->getFloatValue("offset")) == 0.0)
|
if ((_offset = _node->getDoubleValue("offset")) == 0.0)
|
||||||
_offset = 0.0;
|
_offset = 0.0;
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_INFO,
|
SG_LOG(SG_GENERAL, SG_INFO, "Loading sound information for: " << _name );
|
||||||
"Loading sound information for: " << _name );
|
|
||||||
|
|
||||||
string mode_str = _node->getStringValue("mode");
|
string mode_str = _node->getStringValue("mode");
|
||||||
if (mode_str == "looped") {
|
if (mode_str == "looped") {
|
||||||
|
@ -127,9 +126,9 @@ FGSound::init()
|
||||||
//
|
//
|
||||||
// set position properties
|
// set position properties
|
||||||
//
|
//
|
||||||
_pos.dist = _node->getFloatValue("dist");
|
_pos.dist = _node->getDoubleValue("dist");
|
||||||
_pos.hor = _node->getFloatValue("pos_hor");
|
_pos.hor = _node->getDoubleValue("pos_hor");
|
||||||
_pos.vert = _node->getFloatValue("pos_vert");
|
_pos.vert = _node->getDoubleValue("pos_vert");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -145,7 +144,7 @@ FGSound::init()
|
||||||
== 0)
|
== 0)
|
||||||
volume.prop = fgGetNode("/null", true);
|
volume.prop = fgGetNode("/null", true);
|
||||||
|
|
||||||
if ((volume.factor = kids[i]->getFloatValue("factor")) == 0.0)
|
if ((volume.factor = kids[i]->getDoubleValue("factor")) == 0.0)
|
||||||
volume.factor = 1.0;
|
volume.factor = 1.0;
|
||||||
else
|
else
|
||||||
if (volume.factor < 0.0) {
|
if (volume.factor < 0.0) {
|
||||||
|
@ -164,16 +163,16 @@ FGSound::init()
|
||||||
if (!volume.fn)
|
if (!volume.fn)
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Unknown volume type, default to 'lin'");
|
SG_LOG( SG_GENERAL, SG_INFO, "Unknown volume type, default to 'lin'");
|
||||||
|
|
||||||
if ((volume.offset = kids[i]->getFloatValue("offset")) == 0.0)
|
if ((volume.offset = kids[i]->getDoubleValue("offset")) == 0.0)
|
||||||
volume.offset = 0.0;
|
volume.offset = 0.0;
|
||||||
|
|
||||||
if ((volume.min = kids[i]->getFloatValue("min")) < 0.0) {
|
if ((volume.min = kids[i]->getDoubleValue("min")) < 0.0) {
|
||||||
SG_LOG( SG_GENERAL, SG_WARN,
|
SG_LOG( SG_GENERAL, SG_WARN,
|
||||||
"Volume minimum value below 0. Forced to 0.");
|
"Volume minimum value below 0. Forced to 0.");
|
||||||
volume.min = 0.0;
|
volume.min = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((volume.max = kids[i]->getFloatValue("max")) <= volume.min) {
|
if ((volume.max = kids[i]->getDoubleValue("max")) < volume.min) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Volume maximum value below minimum value. Forced above minimum.");
|
"Volume maximum value below minimum value. Forced above minimum.");
|
||||||
volume.max = volume.min + 5.0;
|
volume.max = volume.min + 5.0;
|
||||||
|
@ -197,12 +196,12 @@ FGSound::init()
|
||||||
== 0)
|
== 0)
|
||||||
pitch.prop = fgGetNode("/null", true);
|
pitch.prop = fgGetNode("/null", true);
|
||||||
|
|
||||||
if ((pitch.factor = kids[i]->getFloatValue("factor")) == 0.0)
|
if ((pitch.factor = kids[i]->getDoubleValue("factor")) == 0.0)
|
||||||
pitch.factor = 1.0;
|
pitch.factor = 1.0;
|
||||||
|
|
||||||
pitch.fn = NULL;
|
pitch.fn = NULL;
|
||||||
for (int j=0; __fg_snd_fn[j].fn; j++)
|
for (int j=0; __fg_snd_fn[j].fn; j++)
|
||||||
if(__fg_snd_fn[j].name == kids[i]->getStringValue("type")) {
|
if (__fg_snd_fn[j].name == kids[i]->getStringValue("type")) {
|
||||||
pitch.fn = __fg_snd_fn[j].fn;
|
pitch.fn = __fg_snd_fn[j].fn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -210,16 +209,16 @@ FGSound::init()
|
||||||
if (!pitch.fn)
|
if (!pitch.fn)
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Unknown pitch type, default to 'lin'");
|
SG_LOG( SG_GENERAL, SG_INFO, "Unknown pitch type, default to 'lin'");
|
||||||
|
|
||||||
if ((pitch.offset = kids[i]->getFloatValue("offset")) == 0.0)
|
if ((pitch.offset = kids[i]->getDoubleValue("offset")) == 0.0)
|
||||||
pitch.offset = 1.0;
|
pitch.offset = 1.0;
|
||||||
|
|
||||||
if ((pitch.min = kids[i]->getFloatValue("min")) < 0.0) {
|
if ((pitch.min = kids[i]->getDoubleValue("min")) < 0.0) {
|
||||||
SG_LOG( SG_GENERAL, SG_WARN,
|
SG_LOG( SG_GENERAL, SG_WARN,
|
||||||
"Pitch minimum value below 0. Forced to 0.");
|
"Pitch minimum value below 0. Forced to 0.");
|
||||||
pitch.min = 0.0;
|
pitch.min = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pitch.max = kids[i]->getFloatValue("max")) <= pitch.min) {
|
if ((pitch.max = kids[i]->getDoubleValue("max")) < pitch.min) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Pitch maximum value below minimum value. Forced above minimum.");
|
"Pitch maximum value below minimum value. Forced above minimum.");
|
||||||
pitch.max = pitch.min + 5.0;
|
pitch.max = pitch.min + 5.0;
|
||||||
|
@ -264,7 +263,10 @@ FGSound::update (int dt)
|
||||||
|
|
||||||
if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) {
|
if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) {
|
||||||
|
|
||||||
bool check = (int)(_offset + _property->getFloatValue() * _factor);
|
//
|
||||||
|
// use an integer to get false when: -1 < check < 1
|
||||||
|
//
|
||||||
|
bool check = (int)(_offset + _property->getDoubleValue() * _factor);
|
||||||
if (_type == FGSound::INVERTED)
|
if (_type == FGSound::INVERTED)
|
||||||
check = !check;
|
check = !check;
|
||||||
|
|
||||||
|
@ -289,7 +291,7 @@ FGSound::update (int dt)
|
||||||
|
|
||||||
} else { // FLIPFLOP, RAISE, FALL
|
} else { // FLIPFLOP, RAISE, FALL
|
||||||
|
|
||||||
bool check = (int)(_offset + _property->getFloatValue() * _factor);
|
bool check = (int)(_offset + _property->getDoubleValue() * _factor);
|
||||||
if (check == _active)
|
if (check == _active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue