1 // model-mgr.hxx - manage user-specified 3D models.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain, and comes with no warranty.
7 #define __MODELMGR_HXX 1
10 # error This library requires C++
15 #include <simgear/compiler.h> // for SG_USING_STD
17 #include <Main/fgfs.hxx> // for FGSubsystem
21 // Don't pull in headers, since we don't need them here.
24 class FGModelPlacement;
28 * Manage a list of user-specified models.
30 class FGModelMgr : public FGSubsystem
35 * A dynamically-placed model using properties.
37 * The model manager uses the property nodes to update the model's
38 * position and orientation; any of the property node pointers may
39 * be set to zero to avoid update. Normally, a caller should
40 * load the model by instantiating FGModelPlacement with the path
41 * to the model or its XML wrapper, then assign any relevant
42 * property node pointers.
44 * @see FGModelPlacement
45 * @see FGModelMgr#add_instance
51 FGModelPlacement * model;
52 SGPropertyNode * lon_deg_node;
53 SGPropertyNode * lat_deg_node;
54 SGPropertyNode * elev_ft_node;
55 SGPropertyNode * roll_deg_node;
56 SGPropertyNode * pitch_deg_node;
57 SGPropertyNode * heading_deg_node;
61 virtual ~FGModelMgr ();
65 virtual void unbind ();
66 virtual void update (double dt);
69 * Add an instance of a dynamic model to the manager.
71 * NOTE: pointer ownership is transferred to the model manager!
73 * The caller is responsible for setting up the Instance structure
74 * as required. The model manager will continuously update the
75 * location and orientation of the model based on the current
76 * values of the properties.
78 virtual void add_instance (Instance * instance);
82 * Remove an instance of a dynamic model from the manager.
84 * NOTE: the manager will delete the instance as well.
86 virtual void remove_instance (Instance * instance);
92 vector<Instance *> _instances;
94 ssgSelector * _selector;
98 #endif // __MODELMGR_HXX