| 1 | // acmodel.hxx - manage a 3D aircraft model. |
| 2 | // Written by David Megginson, started 2002. |
| 3 | // |
| 4 | // This file is in the Public Domain, and comes with no warranty. |
| 5 | |
| 6 | #ifndef __ACMODEL_HXX |
| 7 | #define __ACMODEL_HXX 1 |
| 8 | |
| 9 | #include <osg/ref_ptr> |
| 10 | #include <osg/Group> |
| 11 | #include <osg/Switch> |
| 12 | |
| 13 | #include <memory> |
| 14 | #include <simgear/structure/subsystem_mgr.hxx> // for SGSubsystem |
| 15 | #include <simgear/math/SGVec3.hxx> |
| 16 | |
| 17 | |
| 18 | // Don't pull in the headers, since we don't need them here. |
| 19 | class SGModelPlacement; |
| 20 | class FGFX; |
| 21 | |
| 22 | class FGAircraftModel : public SGSubsystem |
| 23 | { |
| 24 | public: |
| 25 | FGAircraftModel (); |
| 26 | virtual ~FGAircraftModel (); |
| 27 | |
| 28 | // Subsystem API. |
| 29 | void bind() override; |
| 30 | void init() override; |
| 31 | void reinit() override; |
| 32 | void shutdown() override; |
| 33 | void unbind() override; |
| 34 | void update(double dt) override; |
| 35 | |
| 36 | // Subsystem identification. |
| 37 | static const char* staticSubsystemClassId() { return "aircraft-model"; } |
| 38 | |
| 39 | virtual SGModelPlacement * get3DModel() { return _aircraft.get(); } |
| 40 | virtual SGVec3d& getVelocity() { return _velocity; } |
| 41 | |
| 42 | private: |
| 43 | void deinit (); |
| 44 | |
| 45 | std::unique_ptr<SGModelPlacement> _aircraft; |
| 46 | std::unique_ptr<SGModelPlacement> _interior; |
| 47 | |
| 48 | SGVec3d _velocity; |
| 49 | SGSharedPtr<FGFX> _fx; |
| 50 | |
| 51 | SGPropertyNode_ptr _speed_n; |
| 52 | SGPropertyNode_ptr _speed_e; |
| 53 | SGPropertyNode_ptr _speed_d; |
| 54 | }; |
| 55 | |
| 56 | #endif // __ACMODEL_HXX |