1
0
Fork 0

- Added "SG" prefix to sound classes that recently moved to SimGear.

- Cleaned up some minor compiler warnings.
- Moved src/Model/placement.[ch]xx over into simgear/scene/model/
This commit is contained in:
curt 2003-05-09 19:39:48 +00:00
parent eafdb70890
commit 51c04e9e4c
26 changed files with 62 additions and 312 deletions

View file

@ -25,9 +25,9 @@
#include <plib/ssg.h>
#include <simgear/math/point3d.hxx>
#include <simgear/scene/model/placement.hxx>
#include <Model/model.hxx>
#include <Model/placement.hxx>
/*****************************************************************

View file

@ -74,7 +74,7 @@ void FGATC::Render(string msg, string refname, bool repeating) {
int len;
unsigned char* buf = vPtr->WriteMessage((char*)msg.c_str(), len, voice);
if(voice) {
SimpleSound* simple = new SimpleSound(buf, len);
SGSimpleSound* simple = new SGSimpleSound(buf, len);
// TODO - at the moment the volume is always set off comm1
// and can't be changed after the transmission has started.
simple->set_volume(5.0 * fgGetDouble("/radios/comm[0]/volume"));

View file

@ -445,7 +445,7 @@ void FGKR_87::update( double dt ) {
// play station ident via audio system if on + ant mode,
// otherwise turn it off
if ( vol_btn >= 0.01 && audio_btn ) {
SimpleSound *sound;
SGSimpleSound *sound;
sound = globals->get_soundmgr()->find( "adf-ident" );
if ( sound != NULL ) {
if ( !adf_btn ) {
@ -514,7 +514,7 @@ void FGKR_87::search() {
if ( globals->get_soundmgr()->exists( "adf-ident" ) ) {
globals->get_soundmgr()->remove( "adf-ident" );
}
SimpleSound *sound;
SGSimpleSound *sound;
sound = morse.make_ident( trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "adf-ident" );

View file

@ -193,7 +193,7 @@ void FGMarkerBeacon::search()
// cout << "OUTER MARKER" << endl;
if ( last_beacon != FGMkrBeacon::OUTER ) {
if ( ! globals->get_soundmgr()->exists( "outer-marker" ) ) {
SimpleSound *sound = beacon.get_outer();
SGSimpleSound *sound = beacon.get_outer();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "outer-marker" );
}
@ -210,7 +210,7 @@ void FGMarkerBeacon::search()
// cout << "MIDDLE MARKER" << endl;
if ( last_beacon != FGMkrBeacon::MIDDLE ) {
if ( ! globals->get_soundmgr()->exists( "middle-marker" ) ) {
SimpleSound *sound = beacon.get_middle();
SGSimpleSound *sound = beacon.get_middle();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "middle-marker" );
}
@ -227,7 +227,7 @@ void FGMarkerBeacon::search()
// cout << "INNER MARKER" << endl;
if ( last_beacon != FGMkrBeacon::INNER ) {
if ( ! globals->get_soundmgr()->exists( "inner-marker" ) ) {
SimpleSound *sound = beacon.get_inner();
SGSimpleSound *sound = beacon.get_inner();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "inner-marker" );
}

View file

@ -336,7 +336,7 @@ FGNavCom::update(double dt)
nav_gs_dist = sqrt( dist );
// cout << nav_gs_dist;
Point3D tmp( nav_gs_x, nav_gs_y, nav_gs_z );
// Point3D tmp( nav_gs_x, nav_gs_y, nav_gs_z );
// cout << " (" << aircraft.distance3D( tmp ) << ")" << endl;
// wgs84 heading to glide slope (to determine sign of distance)
@ -410,7 +410,7 @@ FGNavCom::update(double dt)
if ( power_btn && (bus_power->getDoubleValue() > 1.0)
&& nav_ident_btn && audio_btn )
{
SimpleSound *sound;
SGSimpleSound *sound;
sound = globals->get_soundmgr()->find( nav_fx_name );
if ( sound != NULL ) {
sound->set_volume( nav_vol_btn );
@ -522,7 +522,7 @@ void FGNavCom::search()
if ( globals->get_soundmgr()->exists( nav_fx_name ) ) {
globals->get_soundmgr()->remove( nav_fx_name );
}
SimpleSound *sound;
SGSimpleSound *sound;
sound = morse.make_ident( nav_trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, nav_fx_name );
@ -572,7 +572,7 @@ void FGNavCom::search()
if ( globals->get_soundmgr()->exists( nav_fx_name ) ) {
globals->get_soundmgr()->remove( nav_fx_name );
}
SimpleSound *sound;
SGSimpleSound *sound;
sound = morse.make_ident( nav_trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
if ( globals->get_soundmgr()->add( sound, nav_fx_name ) ) {

View file

@ -174,13 +174,13 @@ FGPanel::FGPanel ()
_mouseInstrument(0),
_width(WIN_W), _height(int(WIN_H * 0.5768 + 1)),
_view_height(int(WIN_H * 0.4232)),
_xsize_node(fgGetNode("/sim/startup/xsize", true)),
_ysize_node(fgGetNode("/sim/startup/ysize", true)),
_visibility(fgGetNode("/sim/panel/visibility", true)),
_x_offset(fgGetNode("/sim/panel/x-offset", true)),
_y_offset(fgGetNode("/sim/panel/y-offset", true)),
_jitter(fgGetNode("/sim/panel/jitter", true)),
_flipx(fgGetNode("/sim/panel/flip-x", true))
_flipx(fgGetNode("/sim/panel/flip-x", true)),
_xsize_node(fgGetNode("/sim/startup/xsize", true)),
_ysize_node(fgGetNode("/sim/startup/ysize", true))
{
}
@ -438,7 +438,7 @@ FGPanel::draw()
glDisable(GL_TEXTURE_2D);
glColor3f(1, 1, 0);
for(int i=0; i<_instruments.size(); i++)
for ( unsigned int i = 0; i < _instruments.size(); i++ )
_instruments[i]->drawHotspots();
glPopAttrib();
@ -673,7 +673,7 @@ FGPanelInstrument::~FGPanelInstrument ()
void
FGPanelInstrument::drawHotspots()
{
for(int i=0; i<_actions.size(); i++) {
for ( unsigned int i = 0; i < _actions.size(); i++ ) {
FGPanelAction* a = _actions[i];
float x1 = getXPos() + a->getX();
float x2 = x1 + a->getWidth();

View file

@ -25,10 +25,10 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/scene/model/location.hxx>
#include <simgear/scene/model/placement.hxx>
#include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx>
#include <Model/placement.hxx>
#include <FDM/flight.hxx>
#include <FDM/LaRCsim/ls_cockpit.h>
#include <FDM/LaRCsim/ls_generic.h>

View file

@ -1,12 +1,12 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/scene/model/location.hxx>
#include <simgear/scene/model/placement.hxx>
#include <simgear/xml/easyxml.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Model/acmodel.hxx>
#include <Model/placement.hxx>
#include "FGFDM.hpp"
#include "Atmosphere.hpp"

View file

@ -29,13 +29,13 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/scene/model/location.hxx>
#include <simgear/scene/model/placement.hxx>
#include <simgear/timing/timestamp.hxx>
#include <Scenery/scenery.hxx>
#include <FDM/LaRCsim/ls_interface.h>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Model/placement.hxx>
#include <Model/acmodel.hxx>
#include "flight.hxx"

View file

@ -208,7 +208,7 @@ FGMenuBar::~FGMenuBar ()
hide();
puDeleteObject(_menuBar);
int i;
unsigned int i;
// Delete all the character arrays
// we were forced to keep around for
@ -233,7 +233,7 @@ FGMenuBar::~FGMenuBar ()
it = _bindings.begin();
for (it = _bindings.begin(); it != _bindings.end(); it++) {
SG_LOG(SG_GENERAL, SG_INFO, "Deleting bindings for " << it->first);
for (int i = 0; i < it->second.size(); i++)
for ( i = 0; i < it->second.size(); i++ )
delete it->second[i];
}
@ -296,7 +296,7 @@ FGMenuBar::make_menu (SGPropertyNode * node)
char ** items = make_char_array(array_size);
puCallback * callbacks = make_callback_array(array_size);
for (int i = 0, j = item_nodes.size() - 1;
for (unsigned int i = 0, j = item_nodes.size() - 1;
i < item_nodes.size();
i++, j--) {
@ -308,7 +308,7 @@ FGMenuBar::make_menu (SGPropertyNode * node)
vector<SGPropertyNode_ptr> binding_nodes =
item_nodes[i]->getChildren("binding");
for (int k = 0; k < binding_nodes.size(); k++)
for (unsigned int k = 0; k < binding_nodes.size(); k++)
_bindings[items[j]].push_back(new FGBinding(binding_nodes[k]));
}
@ -323,7 +323,7 @@ FGMenuBar::make_menubar ()
fgLoadProps("gui/menubar.xml", &props);
vector<SGPropertyNode_ptr> menu_nodes = props.getChildren("menu");
for (int i = 0; i < menu_nodes.size(); i++)
for (unsigned int i = 0; i < menu_nodes.size(); i++)
make_menu(menu_nodes[i]);
_menuBar->close();

View file

@ -1539,7 +1539,7 @@ bool fgInitSubsystems() {
// Initialize the sound subsystem.
////////////////////////////////////////////////////////////////////
globals->set_soundmgr(new SoundMgr);
globals->set_soundmgr(new SGSoundMgr);
globals->get_soundmgr()->init();
globals->get_soundmgr()->bind();

View file

@ -234,7 +234,7 @@ setFreeze (bool f)
frozen = f;
// Stop sound on a pause
SoundMgr *s = globals->get_soundmgr();
SGSoundMgr *s = globals->get_soundmgr();
if ( s != NULL ) {
if ( f ) {
s->pause();

View file

@ -55,7 +55,7 @@ class SGMagVar;
class SGPropertyNode;
class SGRoute;
class SGTime;
class SoundMgr;
class SGSoundMgr;
class FGAIMgr;
class FGATCMgr;
@ -130,7 +130,7 @@ private:
FGPanel *current_panel;
// sound manager
SoundMgr *soundmgr;
SGSoundMgr *soundmgr;
// environment information
FGEnvironmentMgr * environment_mgr;
@ -257,8 +257,8 @@ public:
inline FGPanel *get_current_panel() const { return current_panel; }
inline void set_current_panel( FGPanel *cp ) { current_panel = cp; }
inline SoundMgr *get_soundmgr() const { return soundmgr; }
inline void set_soundmgr( SoundMgr *sm ) { soundmgr = sm; }
inline SGSoundMgr *get_soundmgr() const { return soundmgr; }
inline void set_soundmgr( SGSoundMgr *sm ) { soundmgr = sm; }
inline FGControls *get_controls() const { return controls; }
inline void set_controls( FGControls *c ) { controls = c; }

View file

@ -38,12 +38,12 @@
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/scene/model/location.hxx>
#include <simgear/scene/model/placement.hxx>
#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
#include <Scenery/scenery.hxx>
#include <Model/acmodel.hxx>
#include <Model/placement.hxx>
#include "viewer.hxx"

View file

@ -6,7 +6,6 @@ libModel_a_SOURCES = \
model.cxx model.hxx \
model_panel.cxx model_panel.hxx \
modelmgr.cxx modelmgr.hxx \
panelnode.cxx panelnode.hxx \
placement.cxx placement.hxx
panelnode.cxx panelnode.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -16,6 +16,7 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/exception.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/scene/model/placement.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
@ -23,7 +24,6 @@
#include <Scenery/scenery.hxx>
#include "model_panel.hxx"
#include "placement.hxx"
#include "acmodel.hxx"

View file

@ -3,16 +3,23 @@
//
// This file is in the Public Domain, and comes with no warranty.
#include <simgear/compiler.h>
#include <vector>
#include <plib/ssg.h>
#include <simgear/scene/model/placement.hxx>
#include <Main/fg_props.hxx>
#include <Scenery/scenery.hxx>
#include "model.hxx"
#include "placement.hxx"
#include "modelmgr.hxx"
SG_USING_STD(vector);
FGModelMgr::FGModelMgr ()
: _selector(new ssgSelector)

View file

@ -1,140 +0,0 @@
// placement.cxx - manage the placment of a 3D model.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain, and comes with no warranty.
#include <simgear/compiler.h>
#include <string.h> // for strcmp()
#include <vector>
#include <plib/sg.h>
#include <plib/ssg.h>
#include <plib/ul.h>
#include <simgear/scene/model/location.hxx>
#include "placement.hxx"
SG_USING_STD(vector);
////////////////////////////////////////////////////////////////////////
// Implementation of FGModelPlacement.
////////////////////////////////////////////////////////////////////////
FGModelPlacement::FGModelPlacement ()
: _lon_deg(0),
_lat_deg(0),
_elev_ft(0),
_roll_deg(0),
_pitch_deg(0),
_heading_deg(0),
_selector(new ssgSelector),
_position(new ssgTransform),
_location(new FGLocation)
{
}
FGModelPlacement::~FGModelPlacement ()
{
}
void
FGModelPlacement::init( ssgBranch * model )
{
if (model != 0) {
_position->addKid(model);
}
_selector->addKid(_position);
_selector->clrTraversalMaskBits(SSGTRAV_HOT);
}
void
FGModelPlacement::update( const Point3D scenery_center )
{
_location->setPosition( _lon_deg, _lat_deg, _elev_ft );
_location->setOrientation( _roll_deg, _pitch_deg, _heading_deg );
sgCopyMat4( POS, _location->getTransformMatrix(scenery_center) );
sgVec3 trans;
sgCopyVec3(trans, _location->get_view_pos());
for(int i = 0; i < 4; i++) {
float tmp = POS[i][3];
for( int j=0; j<3; j++ ) {
POS[i][j] += (tmp * trans[j]);
}
}
_position->setTransform(POS);
}
bool
FGModelPlacement::getVisible () const
{
return (_selector->getSelect() != 0);
}
void
FGModelPlacement::setVisible (bool visible)
{
_selector->select(visible);
}
void
FGModelPlacement::setLongitudeDeg (double lon_deg)
{
_lon_deg = lon_deg;
}
void
FGModelPlacement::setLatitudeDeg (double lat_deg)
{
_lat_deg = lat_deg;
}
void
FGModelPlacement::setElevationFt (double elev_ft)
{
_elev_ft = elev_ft;
}
void
FGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft)
{
_lon_deg = lon_deg;
_lat_deg = lat_deg;
_elev_ft = elev_ft;
}
void
FGModelPlacement::setRollDeg (double roll_deg)
{
_roll_deg = roll_deg;
}
void
FGModelPlacement::setPitchDeg (double pitch_deg)
{
_pitch_deg = pitch_deg;
}
void
FGModelPlacement::setHeadingDeg (double heading_deg)
{
_heading_deg = heading_deg;
}
void
FGModelPlacement::setOrientation (double roll_deg, double pitch_deg,
double heading_deg)
{
_roll_deg = roll_deg;
_pitch_deg = pitch_deg;
_heading_deg = heading_deg;
}
// end of model.cxx

View file

@ -1,115 +0,0 @@
// placement.hxx - manage the placment of a 3D model.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain, and comes with no warranty.
#ifndef _SG_PLACEMENT_HXX
#define _SG_PLACEMENT_HXX 1
#ifndef __cplusplus
# error This library requires C++
#endif
#include <vector>
SG_USING_STD(vector);
#include <plib/sg.h>
#include <plib/ssg.h>
#include <simgear/math/point3d.hxx>
#include <simgear/props/props.hxx>
// Don't pull in the headers, since we don't need them here.
class FGLocation;
// Has anyone done anything *really* stupid, like making min and max macros?
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
////////////////////////////////////////////////////////////////////////
// Model placement.
////////////////////////////////////////////////////////////////////////
/**
* A wrapper for a model with a definite placement.
*/
class FGModelPlacement
{
public:
FGModelPlacement ();
virtual ~FGModelPlacement ();
virtual void FGModelPlacement::init( ssgBranch * model );
/* virtual void init( const string &fg_root,
const string &path,
SGPropertyNode *prop_root,
double sim_time_sec, int dummy ); */
virtual void update( const Point3D scenery_center );
virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
virtual FGLocation * getFGLocation () { return _location; }
virtual bool getVisible () const;
virtual void setVisible (bool visible);
virtual double getLongitudeDeg () const { return _lon_deg; }
virtual double getLatitudeDeg () const { return _lat_deg; }
virtual double getElevationFt () const { return _elev_ft; }
virtual void setLongitudeDeg (double lon_deg);
virtual void setLatitudeDeg (double lat_deg);
virtual void setElevationFt (double elev_ft);
virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
virtual double getRollDeg () const { return _roll_deg; }
virtual double getPitchDeg () const { return _pitch_deg; }
virtual double getHeadingDeg () const { return _heading_deg; }
virtual void setRollDeg (double roll_deg);
virtual void setPitchDeg (double pitch_deg);
virtual void setHeadingDeg (double heading_deg);
virtual void setOrientation (double roll_deg, double pitch_deg,
double heading_deg);
// Addition by Diarmuid Tyson for Multiplayer Support
// Allows multiplayer to get players position transform
virtual const sgVec4 *get_POS() { return POS; }
private:
// Geodetic position
double _lon_deg;
double _lat_deg;
double _elev_ft;
// Orientation
double _roll_deg;
double _pitch_deg;
double _heading_deg;
ssgSelector * _selector;
ssgTransform * _position;
// Location
FGLocation * _location;
// Addition by Diarmuid Tyson for Multiplayer Support
// Moved from update method
// POS for transformation Matrix
sgMat4 POS;
};
#endif // _SG_PLACEMENT_HXX

View file

@ -28,8 +28,7 @@
#include <iostream>
#include <simgear/debug/logstream.hxx>
#include <Model/placement.hxx>
#include <simgear/scene/model/placement.hxx>
#include "multiplay.hxx"

View file

@ -51,7 +51,7 @@ bool FGBeacon::init() {
ptr += INNER_DIT_LEN;
}
inner = new SimpleSound( inner_buf, INNER_SIZE );
inner = new SGSimpleSound( inner_buf, INNER_SIZE );
// Make middle marker beacon sound
len= (int)(MIDDLE_DIT_LEN / 2.0 );
@ -69,7 +69,7 @@ bool FGBeacon::init() {
ptr += MIDDLE_DIT_LEN;
memcpy( ptr, middle_dah, MIDDLE_DAH_LEN );
middle = new SimpleSound( middle_buf, MIDDLE_SIZE );
middle = new SGSimpleSound( middle_buf, MIDDLE_SIZE );
// Make outer marker beacon sound
len= (int)(OUTER_DAH_LEN * 3.0 / 4.0 );
@ -82,7 +82,7 @@ bool FGBeacon::init() {
ptr += OUTER_DAH_LEN;
memcpy( ptr, outer_dah, OUTER_DAH_LEN );
outer = new SimpleSound( outer_buf, OUTER_SIZE );
outer = new SGSimpleSound( outer_buf, OUTER_SIZE );
return true;
}

View file

@ -100,9 +100,9 @@ private:
unsigned char middle_buf[ MIDDLE_SIZE ] ;
unsigned char outer_buf[ OUTER_SIZE ] ;
SimpleSound *inner;
SimpleSound *middle;
SimpleSound *outer;
SGSimpleSound *inner;
SGSimpleSound *middle;
SGSimpleSound *outer;
public:
@ -112,9 +112,9 @@ public:
// allocate and initialize sound samples
bool init();
SimpleSound *get_inner() { return inner; }
SimpleSound *get_middle() { return middle; }
SimpleSound *get_outer() { return outer; }
SGSimpleSound *get_inner() { return inner; }
SGSimpleSound *get_middle() { return middle; }
SGSimpleSound *get_outer() { return outer; }
};

View file

@ -76,7 +76,7 @@ FGFX::init()
node = root.getNode("fx");
for (i = 0; i < node->nChildren(); i++) {
Sound *sound = new Sound();
SGSound *sound = new SGSound();
sound->init(globals->get_props(), node->getChild(i),
globals->get_soundmgr(), globals->get_fg_root());

View file

@ -26,7 +26,7 @@
#include <Main/fgfs.hxx>
class Sound;
class SGSound;
/**
* Generator for FlightGear sound effects.
@ -51,7 +51,7 @@ public:
private:
vector<Sound *> _sound;
vector<SGSound *> _sound;
};

View file

@ -165,8 +165,8 @@ bool FGMorse::cust_init(const int freq ) {
}
// make a SimpleSound morse code transmission for the specified string
SimpleSound *FGMorse::make_ident( const string& id, const int freq ) {
// make a SGSimpleSound morse code transmission for the specified string
SGSimpleSound *FGMorse::make_ident( const string& id, const int freq ) {
char *idptr = (char *)id.c_str();
int length = 0;
@ -260,7 +260,7 @@ SimpleSound *FGMorse::make_ident( const string& id, const int freq ) {
buf_ptr += SPACE_SIZE;
// 4. create the simple sound and return
SimpleSound *sample = new SimpleSound( buffer, length );
SGSimpleSound *sample = new SGSimpleSound( buffer, length );
return sample;
}

View file

@ -124,7 +124,7 @@ public:
bool init();
// make a SimpleSound morse code transmission for the specified string
SimpleSound *make_ident( const string& id,
SGSimpleSound *make_ident( const string& id,
const int freq = LO_FREQUENCY );
};