configure.ac src/AIModel/AIAircraft.cxx src/AIModel/AIBase.cxx src/AIModel/AIBase.hxx src/AIModel/AICarrier.cxx src/AIModel/AICarrier.hxx src/AIModel/AIManager.cxx src/AIModel/AIManager.hxx src/ATC/AIEntity.cxx src/ATC/AIEntity.hxx src/ATC/AIMgr.cxx src/ATC/AIMgr.hxx src/ATC/ATCdisplay.cxx src/ATC/ATCdisplay.hxx src/Cockpit/cockpit.cxx src/Cockpit/cockpit.hxx src/Cockpit/hud.cxx src/Cockpit/hud.hxx src/Cockpit/hud_rwy.cxx src/Cockpit/panel.cxx src/Cockpit/panel.hxx src/Cockpit/built_in/FGMagRibbon.cxx src/Cockpit/built_in/FGMagRibbon.hxx src/FDM/flight.cxx src/FDM/groundcache.cxx src/FDM/groundcache.hxx src/GUI/gui_funcs.cxx src/Input/input.cxx src/Instrumentation/od_gauge.cxx src/Instrumentation/od_gauge.hxx src/Instrumentation/render_area_2d.cxx src/Instrumentation/render_area_2d.hxx src/Instrumentation/wxradar.cxx src/Instrumentation/wxradar.hxx src/Instrumentation/HUD/HUD.cxx src/Instrumentation/HUD/HUD.hxx src/Instrumentation/HUD/HUD_runway.cxx src/Main/Makefile.am src/Main/main.cxx src/Main/renderer.cxx src/Main/renderer.hxx src/Main/viewmgr.cxx src/Model/acmodel.cxx src/Model/acmodel.hxx src/Model/model_panel.cxx src/Model/model_panel.hxx src/Model/modelmgr.cxx src/Model/modelmgr.hxx src/Model/panelnode.cxx src/Model/panelnode.hxx src/Navaids/awynet.cxx src/Scenery/Makefile.am src/Scenery/hitlist.cxx src/Scenery/hitlist.hxx src/Scenery/newcache.cxx src/Scenery/scenery.cxx src/Scenery/scenery.hxx src/Scenery/tileentry.cxx src/Scenery/tileentry.hxx src/Scenery/tilemgr.cxx src/Scripting/NasalSys.cxx src/Scripting/NasalSys.hxx src/Time/light.cxx Big BLOB on the way to OSG.
113 lines
2.8 KiB
C++
113 lines
2.8 KiB
C++
// model-mgr.hxx - manage user-specified 3D models.
|
|
// Written by David Megginson, started 2002.
|
|
//
|
|
// This file is in the Public Domain, and comes with no warranty.
|
|
|
|
#ifndef __MODELMGR_HXX
|
|
#define __MODELMGR_HXX 1
|
|
|
|
#ifndef __cplusplus
|
|
# error This library requires C++
|
|
#endif
|
|
|
|
#include <vector>
|
|
|
|
#include <simgear/compiler.h> // for SG_USING_STD
|
|
#include <simgear/structure/subsystem_mgr.hxx>
|
|
|
|
SG_USING_STD(vector);
|
|
|
|
// Don't pull in headers, since we don't need them here.
|
|
class SGPropertyNode;
|
|
class SGModelPlacement;
|
|
|
|
|
|
/**
|
|
* Manage a list of user-specified models.
|
|
*/
|
|
class FGModelMgr : public SGSubsystem
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* A dynamically-placed model using properties.
|
|
*
|
|
* The model manager uses the property nodes to update the model's
|
|
* position and orientation; any of the property node pointers may
|
|
* be set to zero to avoid update. Normally, a caller should
|
|
* load the model by instantiating SGModelPlacement with the path
|
|
* to the model or its XML wrapper, then assign any relevant
|
|
* property node pointers.
|
|
*
|
|
* @see SGModelPlacement
|
|
* @see FGModelMgr#add_instance
|
|
*/
|
|
struct Instance
|
|
{
|
|
Instance ();
|
|
virtual ~Instance ();
|
|
SGModelPlacement * model;
|
|
SGPropertyNode_ptr node;
|
|
SGPropertyNode_ptr lon_deg_node;
|
|
SGPropertyNode_ptr lat_deg_node;
|
|
SGPropertyNode_ptr elev_ft_node;
|
|
SGPropertyNode_ptr roll_deg_node;
|
|
SGPropertyNode_ptr pitch_deg_node;
|
|
SGPropertyNode_ptr heading_deg_node;
|
|
bool shadow;
|
|
};
|
|
|
|
FGModelMgr ();
|
|
virtual ~FGModelMgr ();
|
|
|
|
virtual void init ();
|
|
virtual void bind ();
|
|
virtual void unbind ();
|
|
virtual void update (double dt);
|
|
|
|
virtual void add_model (SGPropertyNode * node);
|
|
|
|
/**
|
|
* Add an instance of a dynamic model to the manager.
|
|
*
|
|
* NOTE: pointer ownership is transferred to the model manager!
|
|
*
|
|
* The caller is responsible for setting up the Instance structure
|
|
* as required. The model manager will continuously update the
|
|
* location and orientation of the model based on the current
|
|
* values of the properties.
|
|
*/
|
|
virtual void add_instance (Instance * instance);
|
|
|
|
|
|
/**
|
|
* Remove an instance of a dynamic model from the manager.
|
|
*
|
|
* NOTE: the manager will delete the instance as well.
|
|
*/
|
|
virtual void remove_instance (Instance * instance);
|
|
|
|
|
|
private:
|
|
/**
|
|
* Listener class that adds models at runtime.
|
|
*/
|
|
class Listener : public SGPropertyChangeListener
|
|
{
|
|
public:
|
|
Listener(FGModelMgr *mgr) : _mgr(mgr) {}
|
|
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
|
|
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
|
|
|
|
private:
|
|
FGModelMgr * _mgr;
|
|
};
|
|
|
|
SGPropertyNode_ptr _models;
|
|
Listener * _listener;
|
|
|
|
vector<Instance *> _instances;
|
|
|
|
};
|
|
|
|
#endif // __MODELMGR_HXX
|