1
0
Fork 0

In the process of changing, adding and removing files the last few years

there was the situation where four directories contained jst two files,
of which three directories were aircraft related, and one directory contained
test code from Curt that might be better of in SimGear anyhow.

This is just a patch to move a bunch of files to new locations. In case of
local changes to any of them you can do the following:

move replay.[ch]xx from src/Replay to src/Aircraft
move control.[ch]xx from src/Control to src/Aircraft
move ssgEntityArray.[ch]xx from src/Objects to simgear/screen

In addition it has been decided only to use .[ch]xx files in all directories
unless it's contained within an FDM specific directory, in which case the
author is free to do whatever (s)he wants.

In this repspect the following files have been renamed in src/Multiplayer:

tiny_xdr.[ch]pp has become tiny_xdr.[ch]xx
multiplaymgr.[ch]pp has become multiplaymgr.[ch]xx
This commit is contained in:
ehofman 2005-11-01 13:41:49 +00:00
parent 7ef74fc1d1
commit 029dda3297
40 changed files with 37 additions and 514 deletions

View file

@ -512,7 +512,6 @@ AC_CONFIG_FILES([ \
src/Autopilot/Makefile \ src/Autopilot/Makefile \
src/Cockpit/Makefile \ src/Cockpit/Makefile \
src/Cockpit/built_in/Makefile \ src/Cockpit/built_in/Makefile \
src/Controls/Makefile \
src/Environment/Makefile \ src/Environment/Makefile \
src/FDM/Balloon/Makefile \ src/FDM/Balloon/Makefile \
src/FDM/ExternalNet/Makefile \ src/FDM/ExternalNet/Makefile \
@ -535,8 +534,6 @@ AC_CONFIG_FILES([ \
src/MultiPlayer/Makefile \ src/MultiPlayer/Makefile \
src/Navaids/Makefile \ src/Navaids/Makefile \
src/Network/Makefile \ src/Network/Makefile \
src/Objects/Makefile \
src/Replay/Makefile \
src/Scenery/Makefile \ src/Scenery/Makefile \
src/Scripting/Makefile \ src/Scripting/Makefile \
src/Sound/Makefile \ src/Sound/Makefile \

View file

@ -1,5 +1,8 @@
noinst_LIBRARIES = libAircraft.a noinst_LIBRARIES = libAircraft.a
libAircraft_a_SOURCES = aircraft.cxx aircraft.hxx libAircraft_a_SOURCES = \
aircraft.cxx aircraft.hxx \
controls.cxx controls.hxx \
replay.cxx replay.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -33,9 +33,10 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Controls/controls.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include "controls.hxx"
// Define a structure containing all the parameters for an aircraft // Define a structure containing all the parameters for an aircraft
typedef struct{ typedef struct{

View file

@ -660,7 +660,6 @@ FGControls::bind ()
&FGControls::get_dome_norm, &FGControls::set_dome_norm); &FGControls::get_dome_norm, &FGControls::set_dome_norm);
fgSetArchivable("/controls/lighting/dome-norm"); fgSetArchivable("/controls/lighting/dome-norm");
#ifdef FG_HAVE_ARMAMENT
// armament // armament
fgTie("/controls/armament/master-arm", this, fgTie("/controls/armament/master-arm", this,
&FGControls::get_master_arm, &FGControls::set_master_arm); &FGControls::get_master_arm, &FGControls::set_master_arm);
@ -703,8 +702,6 @@ FGControls::bind ()
fgSetArchivable(name); fgSetArchivable(name);
} }
#endif
// seat // seat
fgTie("/controls/seat/vertical-adjust", this, fgTie("/controls/seat/vertical-adjust", this,
&FGControls::get_vertical_adjust, &FGControls::get_vertical_adjust,
@ -979,7 +976,6 @@ void FGControls::unbind ()
fgUntie("/controls/lighting/instruments-norm"); fgUntie("/controls/lighting/instruments-norm");
fgUntie("/controls/lighting/dome-norm"); fgUntie("/controls/lighting/dome-norm");
#ifdef FG_HAVE_ARMAMENT
fgUntie("/controls/armament/master-arm"); fgUntie("/controls/armament/master-arm");
fgUntie("/controls/armament/station-select"); fgUntie("/controls/armament/station-select");
fgUntie("/controls/armament/release-all"); fgUntie("/controls/armament/release-all");
@ -998,7 +994,7 @@ void FGControls::unbind ()
"/controls/armament/station[%d]/jettison-all", index); "/controls/armament/station[%d]/jettison-all", index);
fgUntie(name); fgUntie(name);
} }
#endif
fgUntie("/controls/seat/vertical-adjust"); fgUntie("/controls/seat/vertical-adjust");
fgUntie("/controls/seat/fore-aft-adjust"); fgUntie("/controls/seat/fore-aft-adjust");
for (index = 0; index < MAX_EJECTION_SEATS; index++) { for (index = 0; index < MAX_EJECTION_SEATS; index++) {
@ -2014,8 +2010,6 @@ FGControls::move_dome_norm( double amt )
CLAMP( &dome_norm, 0.0, 1.0 ); CLAMP( &dome_norm, 0.0, 1.0 );
} }
#ifdef FG_HAVE_ARMAMENT
void void
FGControls::set_master_arm( bool val ) FGControls::set_master_arm( bool val )
{ {
@ -2093,8 +2087,6 @@ FGControls::set_jettison_all( int station, bool val )
} }
} }
#endif
void void
FGControls::set_vertical_adjust( double pos ) FGControls::set_vertical_adjust( double pos )
{ {

View file

@ -407,7 +407,6 @@ public:
inline double get_instruments_norm() const { return instruments_norm; } inline double get_instruments_norm() const { return instruments_norm; }
inline double get_dome_norm() const { return dome_norm; } inline double get_dome_norm() const { return dome_norm; }
#ifdef FG_HAVE_ARMAMENT
// controls/armament/ // controls/armament/
inline bool get_master_arm() const { return master_arm; } inline bool get_master_arm() const { return master_arm; }
inline int get_station_select() const { return station_select; } inline int get_station_select() const { return station_select; }
@ -418,7 +417,6 @@ public:
inline bool get_release_stick(int station) const { return release_stick[station]; } inline bool get_release_stick(int station) const { return release_stick[station]; }
inline bool get_release_all(int station) const { return release_all[station]; } inline bool get_release_all(int station) const { return release_all[station]; }
inline bool get_jettison_all(int station) const { return jettison_all[station]; } inline bool get_jettison_all(int station) const { return jettison_all[station]; }
#endif
// controls/seat/ // controls/seat/
inline double get_vertical_adjust() const { return vertical_adjust; } inline double get_vertical_adjust() const { return vertical_adjust; }
@ -595,7 +593,6 @@ public:
void set_dome_norm( double intensity ); void set_dome_norm( double intensity );
void move_dome_norm( double amt ); void move_dome_norm( double amt );
#ifdef FG_HAVE_ARMAMENT
// controls/armament/ // controls/armament/
void set_master_arm( bool val ); void set_master_arm( bool val );
void set_station_select( int station ); void set_station_select( int station );
@ -606,7 +603,6 @@ public:
void set_release_stick( int station, bool val ); void set_release_stick( int station, bool val );
void set_release_all( int station, bool val ); void set_release_all( int station, bool val );
void set_jettison_all( int station, bool val ); void set_jettison_all( int station, bool val );
#endif
// controls/seat/ // controls/seat/
void set_vertical_adjust( double pos ); void set_vertical_adjust( double pos );

View file

@ -36,7 +36,6 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Controls/controls.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <simgear/constants.h> #include <simgear/constants.h>

View file

@ -54,8 +54,8 @@
#include <Include/fg_typedefs.h> #include <Include/fg_typedefs.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Controls/controls.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/viewmgr.hxx> #include <Main/viewmgr.hxx>

View file

@ -1,3 +0,0 @@
.deps
Makefile
Makefile.in

View file

@ -1,5 +0,0 @@
noinst_LIBRARIES = libControls.a
libControls_a_SOURCES = controls.cxx controls.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -55,7 +55,6 @@ HISTORY
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -43,7 +43,7 @@
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -29,7 +29,7 @@
#include <simgear/scene/model/placement.hxx> #include <simgear/scene/model/placement.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <FDM/UIUCModel/uiuc_aircraft.h> #include <FDM/UIUCModel/uiuc_aircraft.h>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -29,7 +29,7 @@
#include <simgear/math/point3d.hxx> #include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx> #include <simgear/math/polar3d.hxx>
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -26,11 +26,10 @@
#include <simgear/io/sg_socket.hxx> #include <simgear/io/sg_socket.hxx>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx> //to get ID of window (left/right or center)
#include <Scenery/scenery.hxx> //to pass ground elevation to FDM #include <Scenery/scenery.hxx> //to pass ground elevation to FDM
#include <Main/globals.hxx>
#include <Main/fg_props.hxx> //to get ID of window (left/right or center)
#include "ADA.hxx" #include "ADA.hxx"

View file

@ -29,7 +29,7 @@
#include <simgear/math/point3d.hxx> #include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx> #include <simgear/math/polar3d.hxx>
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -69,10 +69,10 @@
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx>
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
#include <Autopilot/auto_gui.hxx> #include <Autopilot/auto_gui.hxx>
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Controls/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Main/main.hxx> #include <Main/main.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
@ -427,7 +427,7 @@ void fgHiResDump()
message = "Snapshot saved to \""; message = "Snapshot saved to \"";
message += filename; message += filename;
message += '".'; message += "\".";
mkDialog (message.c_str()); mkDialog (message.c_str());
free(tile); free(tile);

View file

@ -55,10 +55,10 @@
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Aircraft/controls.hxx>
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
#include <Autopilot/auto_gui.hxx> #include <Autopilot/auto_gui.hxx>
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Controls/controls.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>

View file

@ -59,7 +59,6 @@ fgfs_LDADD = \
$(top_builddir)/src/ATC/libATC.a \ $(top_builddir)/src/ATC/libATC.a \
$(top_builddir)/src/Cockpit/libCockpit.a \ $(top_builddir)/src/Cockpit/libCockpit.a \
$(top_builddir)/src/Cockpit/built_in/libBuilt_in.a \ $(top_builddir)/src/Cockpit/built_in/libBuilt_in.a \
$(top_builddir)/src/Controls/libControls.a \
$(top_builddir)/src/FDM/libFlight.a \ $(top_builddir)/src/FDM/libFlight.a \
$(top_builddir)/src/FDM/Balloon/libBalloon.a \ $(top_builddir)/src/FDM/Balloon/libBalloon.a \
$(top_builddir)/src/FDM/ExternalNet/libExternalNet.a \ $(top_builddir)/src/FDM/ExternalNet/libExternalNet.a \
@ -83,7 +82,6 @@ fgfs_LDADD = \
$(top_builddir)/src/Sound/libSound.a \ $(top_builddir)/src/Sound/libSound.a \
$(top_builddir)/src/Airports/libAirports.a \ $(top_builddir)/src/Airports/libAirports.a \
$(MPLAYER_LIBS) \ $(MPLAYER_LIBS) \
$(top_builddir)/src/Replay/libReplay.a \
$(top_builddir)/src/Systems/libSystems.a \ $(top_builddir)/src/Systems/libSystems.a \
$(top_builddir)/src/Time/libTime.a \ $(top_builddir)/src/Time/libTime.a \
$(top_builddir)/src/Traffic/libTraffic.a \ $(top_builddir)/src/Traffic/libTraffic.a \

View file

@ -22,7 +22,7 @@
#include <GUI/gui.h> #include <GUI/gui.h>
#include <GUI/new_gui.hxx> #include <GUI/new_gui.hxx>
#include <GUI/dialog.hxx> #include <GUI/dialog.hxx>
#include <Replay/replay.hxx> #include <Aircraft/replay.hxx>
#include <Scenery/tilemgr.hxx> #include <Scenery/tilemgr.hxx>
#if defined(HAVE_PLIB_PSL) #if defined(HAVE_PLIB_PSL)
# include <Scripting/scriptmgr.hxx> # include <Scripting/scriptmgr.hxx>

View file

@ -64,6 +64,7 @@
#include <simgear/timing/lowleveltime.h> #include <simgear/timing/lowleveltime.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Aircraft/replay.hxx>
#include <Airports/apt_loader.hxx> #include <Airports/apt_loader.hxx>
#include <Airports/runways.hxx> #include <Airports/runways.hxx>
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
@ -99,7 +100,6 @@
#include <AIModel/AIManager.hxx> #include <AIModel/AIManager.hxx>
#include <Navaids/navdb.hxx> #include <Navaids/navdb.hxx>
#include <Navaids/navlist.hxx> #include <Navaids/navlist.hxx>
#include <Replay/replay.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx> #include <Scenery/tilemgr.hxx>
#include <Scripting/NasalSys.hxx> #include <Scripting/NasalSys.hxx>
@ -114,7 +114,7 @@
#include <Traffic/TrafficMgr.hxx> #include <Traffic/TrafficMgr.hxx>
#ifdef FG_MPLAYER_AS #ifdef FG_MPLAYER_AS
#include <MultiPlayer/multiplaymgr.hpp> #include <MultiPlayer/multiplaymgr.hxx>
#endif #endif
#include <Environment/environment_mgr.hxx> #include <Environment/environment_mgr.hxx>

View file

@ -55,6 +55,7 @@
#include <simgear/scene/sky/sky.hxx> #include <simgear/scene/sky/sky.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Aircraft/replay.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>
#include <Model/panelnode.hxx> #include <Model/panelnode.hxx>
@ -69,14 +70,13 @@
#include <ATC/ATCdisplay.hxx> #include <ATC/ATCdisplay.hxx>
#include <ATC/ATCmgr.hxx> #include <ATC/ATCmgr.hxx>
#include <ATC/AIMgr.hxx> #include <ATC/AIMgr.hxx>
#include <Replay/replay.hxx>
#include <Time/tmp.hxx> #include <Time/tmp.hxx>
#include <Time/fg_timer.hxx> #include <Time/fg_timer.hxx>
#include <Environment/environment_mgr.hxx> #include <Environment/environment_mgr.hxx>
#include <GUI/new_gui.hxx> #include <GUI/new_gui.hxx>
#ifdef FG_MPLAYER_AS #ifdef FG_MPLAYER_AS
#include <MultiPlayer/multiplaymgr.hpp> #include <MultiPlayer/multiplaymgr.hxx>
#endif #endif

View file

@ -57,6 +57,7 @@
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Time/light.hxx> #include <Time/light.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
// #include <Aircraft/replay.hxx>
#include <Cockpit/panel.hxx> #include <Cockpit/panel.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>
@ -66,7 +67,6 @@
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx> #include <Scenery/tilemgr.hxx>
#include <ATC/ATCdisplay.hxx> #include <ATC/ATCdisplay.hxx>
#include <Replay/replay.hxx>
#include <GUI/new_gui.hxx> #include <GUI/new_gui.hxx>
#include "splash.hxx" #include "splash.hxx"

View file

@ -1,9 +1,3 @@
if ENABLE_MPLAYER_AS
MPLAYER_DIRS = MultiPlayer
else
MPLAYER_DIRS =
endif
SUBDIRS = \ SUBDIRS = \
Include \ Include \
Aircraft \ Aircraft \
@ -11,7 +5,6 @@ SUBDIRS = \
ATC \ ATC \
Autopilot \ Autopilot \
Cockpit \ Cockpit \
Controls \
Environment \ Environment \
FDM \ FDM \
GUI \ GUI \
@ -21,9 +14,7 @@ SUBDIRS = \
AIModel \ AIModel \
Navaids \ Navaids \
Network \ Network \
$(MPLAYER_DIRS) \ MultiPlayer \
Objects \
Replay \
Scenery \ Scenery \
Scripting \ Scripting \
Sound \ Sound \

View file

@ -1,6 +1,6 @@
noinst_LIBRARIES = libMultiPlayer.a noinst_LIBRARIES = libMultiPlayer.a
libMultiPlayer_a_SOURCES = multiplaymgr.cpp multiplaymgr.hpp mpplayer.cxx mpplayer.hxx mpmessages.hxx tiny_xdr.cpp tiny_xdr.hpp libMultiPlayer_a_SOURCES = multiplaymgr.cxx multiplaymgr.hxx mpplayer.cxx mpplayer.hxx mpmessages.hxx tiny_xdr.cxx tiny_xdr.hxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -35,9 +35,9 @@
* *
******************************************************************/ ******************************************************************/
#include <simgear/compiler.h>
#include "tiny_xdr.hpp"
#include <plib/sg.h> #include <plib/sg.h>
#include <simgear/compiler.h>
#include "tiny_xdr.hxx"
// magic value for messages // magic value for messages
const uint32_t MSG_MAGIC = 0x46474653; // "FGFS" const uint32_t MSG_MAGIC = 0x46474653; // "FGFS"

View file

@ -38,13 +38,17 @@
# include <netinet/in.h> # include <netinet/in.h>
# include <arpa/inet.h> # include <arpa/inet.h>
#endif #endif
#include <plib/netSocket.h>
#include <stdlib.h> #include <stdlib.h>
#include <plib/netSocket.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "multiplaymgr.hpp" #include "multiplaymgr.hxx"
#include "mpmessages.hxx" #include "mpmessages.hxx"
#include "mpplayer.hxx" #include "mpplayer.hxx"
#define MAX_PACKET_SIZE 1024 #define MAX_PACKET_SIZE 1024
// These constants are provided so that the ident // These constants are provided so that the ident

View file

@ -13,7 +13,7 @@
#include <plib/ul.h> #include <plib/ul.h>
#include "tiny_xdr.hpp" #include "tiny_xdr.hxx"
/* XDR 8bit integers */ /* XDR 8bit integers */
xdr_data_t xdr_data_t

View file

@ -34,7 +34,7 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Model/acmodel.hxx> #include <Model/acmodel.hxx>
#include <MultiPlayer/multiplaymgr.hpp> #include <MultiPlayer/multiplaymgr.hxx>
#include "protocol.hxx" #include "protocol.hxx"

View file

@ -29,14 +29,12 @@
#include STL_STRING #include STL_STRING
#include <Controls/controls.hxx> #include <Aircraft/controls.hxx>
#include "protocol.hxx" #include "protocol.hxx"
#include "net_ctrls.hxx" #include "net_ctrls.hxx"
SG_USING_STD(string); SG_USING_STD(string);
class FGNativeCtrls : public FGProtocol { class FGNativeCtrls : public FGProtocol {
FGNetCtrls net_ctrls; FGNetCtrls net_ctrls;

View file

@ -36,7 +36,6 @@
#include "opengc.hxx" #include "opengc.hxx"
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Controls/controls.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
SG_USING_STD(vector); SG_USING_STD(vector);

View file

@ -1,3 +0,0 @@
.deps
Makefile
Makefile.in

View file

@ -1,6 +0,0 @@
#noinst_LIBRARIES = libObjects.a
#libObjects_a_SOURCES =
# ssgEntityArray.hxx ssgEntityArray.cxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -1,362 +0,0 @@
/*
PLIB - A Suite of Portable Game Libraries
Copyright (C) 1998,2002 Steve Baker
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information visit http://plib.sourceforge.net
$Id$
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "ssgEntityArray.hxx"
// Forward declaration of internal ssg stuff (for hot/isec/los/etc.)
void _ssgPushPath ( ssgEntity *l ) ;
void _ssgPopPath () ;
void ssgEntityArray::copy_from ( ssgEntityArray *src, int clone_flags )
{
ssgEntity::copy_from ( src, clone_flags ) ;
ssgEntity *k = src -> getModel ( ) ;
if ( k != NULL && ( clone_flags & SSG_CLONE_RECURSIVE ) )
setModel ( (ssgEntity *)( k -> clone ( clone_flags )) ) ;
else
setModel ( k ) ;
ssgTransform *t = src -> getPosTransform();
if ( t != NULL && ( clone_flags & SSG_CLONE_RECURSIVE ) )
pos = (ssgTransform *)( t -> clone ( clone_flags ) );
else
pos = t;
ssgVertexArray *v = src -> getLocations();
if ( v != NULL && ( clone_flags & SSG_CLONE_RECURSIVE ) )
locations = (ssgVertexArray *)( v -> clone ( clone_flags ) );
else
locations = v;
v = src -> getOrientations();
if ( v != NULL && ( clone_flags & SSG_CLONE_RECURSIVE ) )
orientations = (ssgVertexArray *)( v -> clone ( clone_flags ) );
else
orientations = v;
}
ssgBase *ssgEntityArray::clone ( int clone_flags )
{
ssgEntityArray *b = new ssgEntityArray ;
b -> copy_from ( this, clone_flags ) ;
return b ;
}
ssgEntityArray::ssgEntityArray (void)
{
type = ssgTypeBranch () ;
pos = new ssgTransform;
locations = new ssgVertexArray();
orientations = new ssgVertexArray();
}
ssgEntityArray::~ssgEntityArray (void)
{
removeModel() ;
ssgDeRefDelete( pos );
locations->removeAll();
orientations->removeAll();
delete orientations;
delete locations;
delete pos;
}
void ssgEntityArray::zeroSpareRecursive ()
{
zeroSpare () ;
model -> zeroSpareRecursive () ;
pos -> zeroSpareRecursive () ;
locations -> zeroSpareRecursive () ;
orientations -> zeroSpareRecursive () ;
}
void ssgEntityArray::recalcBSphere (void)
{
emptyBSphere () ;
pos->removeAllKids();
pos->addKid( model );
for ( int i = 0; i < locations->getNum(); ++i ) {
sgCoord c;
sgSetCoord( &c, locations->get(i), orientations->get(i) );
pos->setTransform( &c );
extendBSphere( pos->getBSphere() );
}
pos->removeAllKids();
/* FIXME: Traverse placement list
for ( ssgEntity *k = getKid ( 0 ) ; k != NULL ; k = getNextKid () )
extendBSphere ( k -> getBSphere () ) ;
*/
bsphere_is_invalid = FALSE ;
}
void ssgEntityArray::removeModel ()
{
model->deadBeefCheck () ;
ssgDeRefDelete ( model ) ;
}
void ssgEntityArray::replaceModel ( ssgEntity *new_entity )
{
removeModel();
setModel( new_entity );
}
void ssgEntityArray::addPlacement ( sgVec3 loc, sgVec3 orient )
{
locations->add( loc ) ;
orientations->add( orient ) ;
dirtyBSphere () ;
}
void ssgEntityArray::removeAllPlacements()
{
locations->removeAll();
orientations->removeAll();
dirtyBSphere () ;
}
void ssgEntityArray::print ( FILE *fd, char *indent, int how_much )
{
ssgEntity::print ( fd, indent, how_much ) ;
fprintf ( fd, "%s Num Kids=%d\n", indent, getNumKids() ) ;
if ( getNumParents() != getRef() )
ulSetError ( UL_WARNING, "Ref count doesn't tally with parent count" ) ;
if ( how_much > 1 )
{ if ( bsphere.isEmpty() )
fprintf ( fd, "%s BSphere is Empty.\n", indent ) ;
else
fprintf ( fd, "%s BSphere R=%g, C=(%g,%g,%g)\n", indent,
bsphere.getRadius(), bsphere.getCenter()[0], bsphere.getCenter()[1], bsphere.getCenter()[2] ) ;
}
char in [ 100 ] ;
sprintf ( in, "%s ", indent ) ;
model -> print ( fd, in, how_much ) ;
}
#ifdef HAVE_PLIB_PSL
void ssgEntityArray::getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_verts )
{
int nb, nl, nt, nv ;
*num_branches = 1 ; /* this! */
*num_leaves = 0 ;
*num_tris = 0 ;
*num_verts = 0 ;
model -> getStats ( & nb, & nl, & nt, & nv ) ;
*num_branches += nb * locations->getNum() ;
*num_leaves += nl * locations->getNum() ;
*num_tris += nt * locations->getNum() ;
*num_verts += nv * locations->getNum() ;
}
#endif
void ssgEntityArray::cull ( sgFrustum *f, sgMat4 m, int test_needed )
{
if ( ! preTravTests ( &test_needed, SSGTRAV_CULL ) )
return ;
int cull_result = cull_test ( f, m, test_needed ) ;
if ( cull_result == SSG_OUTSIDE )
return ;
pos->removeAllKids();
pos->addKid( model );
for ( int i = 0; i < locations->getNum(); ++i ) {
sgCoord c;
sgSetCoord( &c, locations->get(i), orientations->get(i) );
pos->setTransform( &c );
pos->cull( f, m, cull_result != SSG_INSIDE );
}
pos->removeAllKids();
postTravTests ( SSGTRAV_CULL ) ;
}
void ssgEntityArray::hot ( sgVec3 s, sgMat4 m, int test_needed )
{
if ( ! preTravTests ( &test_needed, SSGTRAV_HOT ) )
return ;
int hot_result = hot_test ( s, m, test_needed ) ;
if ( hot_result == SSG_OUTSIDE )
return ;
_ssgPushPath ( this ) ;
pos->removeAllKids();
pos->addKid( model );
for ( int i = 0; i < locations->getNum(); ++i ) {
sgCoord c;
sgSetCoord( &c, locations->get(i), orientations->get(i) );
pos->setTransform( &c );
pos->hot ( s, m, hot_result != SSG_INSIDE );
}
pos->removeAllKids();
_ssgPopPath () ;
postTravTests ( SSGTRAV_HOT ) ;
}
void ssgEntityArray::los ( sgVec3 s, sgMat4 m, int test_needed )
{
if ( ! preTravTests ( &test_needed, SSGTRAV_LOS ) )
return ;
int los_result = los_test ( s, m, test_needed ) ;
if ( los_result == SSG_OUTSIDE )
return ;
_ssgPushPath ( this ) ;
pos->removeAllKids();
pos->addKid( model );
for ( int i = 0; i < locations->getNum(); ++i ) {
sgCoord c;
sgSetCoord( &c, locations->get(i), orientations->get(i) );
pos->setTransform( &c );
pos->los ( s, m, los_result != SSG_INSIDE ) ;
}
pos->removeAllKids();
_ssgPopPath () ;
postTravTests ( SSGTRAV_LOS) ;
}
void ssgEntityArray::isect ( sgSphere *s, sgMat4 m, int test_needed )
{
if ( ! preTravTests ( &test_needed, SSGTRAV_ISECT ) )
return ;
int isect_result = isect_test ( s, m, test_needed ) ;
if ( isect_result == SSG_OUTSIDE )
return ;
_ssgPushPath ( this ) ;
pos->removeAllKids();
pos->addKid( model );
for ( int i = 0; i < locations->getNum(); ++i ) {
sgCoord c;
sgSetCoord( &c, locations->get(i), orientations->get(i) );
pos->setTransform( &c );
pos->isect ( s, m, isect_result != SSG_INSIDE ) ;
}
pos->removeAllKids();
_ssgPopPath () ;
postTravTests ( SSGTRAV_ISECT ) ;
}
#if 0
int ssgEntityArray::load ( FILE *fd )
{
int nkids ;
_ssgReadInt ( fd, & nkids ) ;
if ( ! ssgEntity::load ( fd ) )
return FALSE ;
for ( int i = 0 ; i < nkids ; i++ )
{
ssgEntity *kid ;
if ( ! _ssgLoadObject ( fd, (ssgBase **) &kid, ssgTypeEntity () ) )
return FALSE ;
addKid ( kid ) ;
}
return TRUE ;
}
int ssgEntityArray::save ( FILE *fd )
{
_ssgWriteInt ( fd, getNumKids() ) ;
if ( ! ssgEntity::save ( fd ) )
return FALSE ;
for ( int i = 0 ; i < getNumKids() ; i++ )
{
if ( ! _ssgSaveObject ( fd, getKid ( i ) ) )
return FALSE ;
}
return TRUE ;
}
#endif

View file

@ -1,66 +0,0 @@
#ifndef _SSG_ENTITY_ARRAY_HXX
#define _SSG_ENTITY_ARRAY_HXX
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <plib/ssg.h>
class ssgEntityArray : public ssgEntity
{
// The replicated child
ssgEntity *model ;
// The one transformation node
ssgTransform *pos;
// The list of locations and orientations
ssgVertexArray *locations;
ssgVertexArray *orientations;
protected:
virtual void copy_from ( ssgEntityArray *src, int clone_flags ) ;
public:
virtual void zeroSpareRecursive ();
virtual ssgBase *clone ( int clone_flags = 0 ) ;
ssgEntityArray (void) ;
virtual ~ssgEntityArray (void) ;
ssgEntity *getModel () const { return model ; }
void setModel ( ssgEntity *entity ) { model = entity; }
void removeModel () ;
void replaceModel ( ssgEntity *new_entity ) ;
ssgVertexArray *getLocations () const { return locations; }
ssgVertexArray *getOrientations () const { return orientations; }
float *getLocation ( int i ) const { return locations->get( i ); }
float *getOrientation ( int i ) const { return orientations->get( i ); }
void addPlacement ( sgVec3 loc, sgVec3 orient );
virtual int getNumPlacements() const { return locations->getNum(); }
void removeAllPlacements();
ssgTransform *getPosTransform() { return pos; }
virtual const char *getTypeName(void) ;
virtual void cull ( sgFrustum *f, sgMat4 m, int test_needed ) ;
virtual void isect ( sgSphere *s, sgMat4 m, int test_needed ) ;
virtual void hot ( sgVec3 s, sgMat4 m, int test_needed ) ;
virtual void los ( sgVec3 s, sgMat4 m, int test_needed ) ;
virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ;
#ifdef HAVE_PLIB_PSL
virtual void getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_vertices ) ;
#endif
virtual int load ( FILE *fd ) ;
virtual int save ( FILE *fd ) ;
virtual void recalcBSphere () ;
} ;
#endif // _SSG_ENTITY_ARRAY_HXX

View file

@ -1,3 +0,0 @@
.deps
Makefile
Makefile.in

View file

@ -1,5 +0,0 @@
noinst_LIBRARIES = libReplay.a
libReplay_a_SOURCES = replay.hxx replay.cxx
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src