]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/clouds3d/SkyControlled.hpp
A first attempt at making the clouds3d endian aware. Almost there.
[simgear.git] / simgear / scene / sky / clouds3d / SkyControlled.hpp
1 //------------------------------------------------------------------------------
2 // File : SkyControlled.hpp
3 //------------------------------------------------------------------------------
4 // SkyWorks : Copyright 2002 Mark J. Harris and
5 //                                              The University of North Carolina at Chapel Hill
6 //------------------------------------------------------------------------------
7 // Permission to use, copy, modify, distribute and sell this software and its 
8 // documentation for any purpose is hereby granted without fee, provided that 
9 // the above copyright notice appear in all copies and that both that copyright 
10 // notice and this permission notice appear in supporting documentation. 
11 // Binaries may be compiled with this software without any royalties or 
12 // restrictions. 
13 //
14 // The author(s) and The University of North Carolina at Chapel Hill make no 
15 // representations about the suitability of this software for any purpose. 
16 // It is provided "as is" without express or 
17 // implied warranty.
18 /**
19  * @file SkyControlled.hpp
20  * 
21  * Interface definition for controlled objects.
22  */
23 #ifndef __SKYCONTROLLED_HPP__
24 #define __SKYCONTROLLED_HPP__
25
26 //#include "BHXController.hpp"
27
28 template<typename ControlStateType> class SkyController;
29
30
31 //------------------------------------------------------------------------------
32 /**
33  * @class SkyControlled
34  * @brief A base class defining an interface for controlled objects.
35  * 
36  * This class abstracts the control of objects into a simple interface that a
37  * class may inherit that allows it to be controlled by SkyController objects.
38  * A class simply inherits from SkyControlled, which forces the class to implement
39  * the method UpdateStateFromControls().  This method usually uses the SkyController
40  * object passed to SetController() to query the input state via 
41  * SkyController::GetControlState().  
42  *
43  * @see SkyController
44  */
45 template<typename ControlStateType>
46 class SkyControlled
47 {
48 public:
49   //! Constructor.
50   SkyControlled()          { _pController = NULL; }
51   //! Destructor
52   virtual ~SkyControlled() { _pController = NULL; }
53
54   //! Sets the controller which will control this controlled object.
55   void SetController(SkyController<ControlStateType> *pController) { _pController = pController; }
56   
57   //! Updates the state of the controlled object based on the controls (received from the controller).
58   virtual SKYRESULT UpdateStateFromControls(SKYTIME timeStep) = 0;
59
60 protected:
61   SkyController<ControlStateType>  *_pController;
62   ControlStateType                  _controlState;
63 };
64
65 #endif //__SKYCONTROLLED_HPP__