| Line |   | 
|---|
| 1 | /** | 
|---|
| 2 |  * @file lense_flare.h | 
|---|
| 3 |  *  lense flare effect | 
|---|
| 4 |  */ | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef _LENSE_FLARE | 
|---|
| 7 | #define _LENSE_FLARE | 
|---|
| 8 |  | 
|---|
| 9 | #include "graphics_effect.h" | 
|---|
| 10 |  | 
|---|
| 11 | #include <vector> | 
|---|
| 12 |  | 
|---|
| 13 | #include "vector2D.h" | 
|---|
| 14 | #include "plane.h" | 
|---|
| 15 | #include "glincl.h" | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | #define LF_MAX_FLARES 7 | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | class TiXmlElement; | 
|---|
| 22 | class Light; | 
|---|
| 23 | class ImagePlane; | 
|---|
| 24 |  | 
|---|
| 25 | //! A class that handles LenseFlares. The LenseFlareManager operates on this. | 
|---|
| 26 | class LenseFlare : public GraphicsEffect | 
|---|
| 27 | { | 
|---|
| 28 |   ObjectListDeclaration(LenseFlare); | 
|---|
| 29 |   public: | 
|---|
| 30 |     LenseFlare(const TiXmlElement* root = NULL); | 
|---|
| 31 |     virtual ~LenseFlare(); | 
|---|
| 32 |  | 
|---|
| 33 |     virtual void loadParams(const TiXmlElement* root); | 
|---|
| 34 |  | 
|---|
| 35 |     virtual void init(); | 
|---|
| 36 |  | 
|---|
| 37 |     virtual void activate(); | 
|---|
| 38 |     virtual void deactivate(); | 
|---|
| 39 |  | 
|---|
| 40 |     virtual void draw() const; | 
|---|
| 41 |     virtual void tick(float dt); | 
|---|
| 42 |  | 
|---|
| 43 |     void addFlare(const std::string& textureName); | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 |   private: | 
|---|
| 47 |     GLint stringToFogMode(const std::string& mode); | 
|---|
| 48 |     void setSourceVisibility(bool visibility) ; | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 |   private: | 
|---|
| 52 |     bool                     bVisible;          //!< Checks visibility | 
|---|
| 53 |     Light*                   lightSource;        //!< reference to the sun (or primary light source) | 
|---|
| 54 |     std::vector<ImagePlane*> flares;             //!< the flares array | 
|---|
| 55 |  | 
|---|
| 56 |     Vector2D                 flareVector;        //!< the axis to draw the flares on | 
|---|
| 57 |     float                    distance;           //!< distance from center to source | 
|---|
| 58 |     Vector2D                 screenCenter;       //!< the vector marking the center of the screen | 
|---|
| 59 |  | 
|---|
| 60 |     float                    flareMatrix[14]; | 
|---|
| 61 |     Plane                    frustumPlane;       //!< plane that marks the view frustum | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 |  | 
|---|
| 65 | #endif /* _LENSE_FLARE */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.