- Cleaned up some minor compiler warnings.
- Moved src/Model/placement.[ch]xx over into simgear/scene/model/
#include <plib/ssg.h>
#include <simgear/math/point3d.hxx>
+#include <simgear/scene/model/placement.hxx>
#include <Model/model.hxx>
-#include <Model/placement.hxx>
/*****************************************************************
// Run the internal calculations
virtual void Update(double dt);
- // Send a transmission *TO* the AIEntity.
- // FIXME int code is a hack - eventually this will receive Alexander's coded messages.
- virtual void RegisterTransmission(int code);
+ // Send a transmission *TO* the AIEntity.
+ // FIXME int code is a hack - eventually this will receive Alexander's coded messages.
+ virtual void RegisterTransmission(int code);
protected:
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"));
// 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 ) {
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" );
// 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" );
}
// 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" );
}
// 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" );
}
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)
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 );
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 );
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 ) ) {
_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))
{
}
// Draw yellow "hotspots" if directed to. This is a panel authoring
// feature; not intended to be high performance or to look good.
- if(fgGetBool("/sim/panel-hotspots")) {
+ if ( fgGetBool("/sim/panel-hotspots") ) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
glDisable(GL_DEPTH_TEST);
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();
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();
#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>
#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"
#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"
hide();
puDeleteObject(_menuBar);
- int i;
+ unsigned int i;
// Delete all the character arrays
// we were forced to keep around for
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];
}
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--) {
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]));
}
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();
// Initialize the sound subsystem.
////////////////////////////////////////////////////////////////////
- globals->set_soundmgr(new SoundMgr);
+ globals->set_soundmgr(new SGSoundMgr);
globals->get_soundmgr()->init();
globals->get_soundmgr()->bind();
frozen = f;
// Stop sound on a pause
- SoundMgr *s = globals->get_soundmgr();
+ SGSoundMgr *s = globals->get_soundmgr();
if ( s != NULL ) {
if ( f ) {
s->pause();
class SGPropertyNode;
class SGRoute;
class SGTime;
-class SoundMgr;
+class SGSoundMgr;
class FGAIMgr;
class FGATCMgr;
FGPanel *current_panel;
// sound manager
- SoundMgr *soundmgr;
+ SGSoundMgr *soundmgr;
// environment information
FGEnvironmentMgr * environment_mgr;
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; }
#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"
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
#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>
#include <Scenery/scenery.hxx>
#include "model_panel.hxx"
-#include "placement.hxx"
#include "acmodel.hxx"
//
// 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)
+++ /dev/null
-// 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);
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// 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
+++ /dev/null
-// 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
#include <iostream>
#include <simgear/debug/logstream.hxx>
-
-#include <Model/placement.hxx>
+#include <simgear/scene/model/placement.hxx>
#include "multiplay.hxx"
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 );
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 );
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;
}
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:
// 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; }
};
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());
#include <Main/fgfs.hxx>
-class Sound;
+class SGSound;
/**
* Generator for FlightGear sound effects.
private:
- vector<Sound *> _sound;
+ vector<SGSound *> _sound;
};
}
-// 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;
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;
}
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 );
};