Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Vehicles.h
1 //
2 // Vehicles.h
3 //
4 // Classes for describing and operating on vehicles.
5 //
6 // Copyright (c) 2001-2011 Virtual Terrain Project
7 // Free for all uses, see license.txt for details.
8 //
9 
10 #ifndef VEHICLEH
11 #define VEHICLEH
12 
13 class CarEngine;
14 
15 class Vehicle : public vtTransform
16 {
17 public:
18  Vehicle();
19  ~Vehicle();
20 
21  void ShowBounds(bool bShow);
22 
23  vtGeode *m_pHighlight; // The wireframe highlight
24 
25  vtTransform *m_pFrontLeft;
26  vtTransform *m_pFrontRight;
27  vtTransform *m_pRearLeft;
28  vtTransform *m_pRearRight;
29 
30  float GetWheelRadius() { return 0.25f; } // TODO: get real value
31 };
32 
34 {
35 public:
37  ~VehicleManager();
38 
39  Vehicle *CreateVehicle(const char *szType, const RGBf &cColor);
40 
41 protected:
42  Vehicle *CreateVehicleFromNode(osg::Node *node, const RGBf &cColor);
43 };
44 
46 {
47 public:
48  VehicleSet();
49 
50  void AddEngine(CarEngine *e);
51  int FindClosestVehicle(const FPoint3 &point, float &closest);
52  void VisualSelect(int vehicle);
53  void VisualDeselectAll();
54  int GetSelected() { return m_iSelected; }
55  void SetVehicleSpeed(int vehicle, float fMetersPerSec);
56 
57  CarEngine *GetSelectedCarEngine();
58  void SetSelectedRotation(float fRot);
59 
60  std::vector<CarEngine*> m_Engines;
61  int m_iSelected;
62 };
63 
64 #endif // VEHICLEH
65