source: GTP/trunk/App/Demos/Illum/Rain/include/RainLight.h @ 2221

Revision 2221, 2.3 KB checked in by plemenos, 18 years ago (diff)
  • Property svn:executable set to *
Line 
1
2///////////////////////////////////////////////////////////////////////////
3//
4//              Realistic rain real-time simulation program
5//
6//              Pierre Rousseau
7//
8///////////////////////////////////////////////////////////////////////////
9//
10//              Light Handling
11//
12///////////////////////////////////////////////////////////////////////////
13
14
15#ifndef __RAIN_LIGHT__
16#define __RAIN_LIGHT__
17
18
19
20#include "CommonRain.h"
21#include "ExampleApplication.h"
22#include <vector>
23
24
25
26
27/** RainLight class
28  * enables a change of appearance of raindrops close to a light source
29  */
30class RainLight
31{
32private :
33    SceneManager *mSceneMgr;
34    SceneNode *mLightNode;
35    SceneNode *mConeNode;
36    BillboardSet *mBillboardSet;
37    Billboard *mBillboard;
38
39    ColourValue mColour;
40    Vector3 mLightPos, mLightInitialPos, mLightDir;
41    float mLightCutoff, mLightAttenuation;
42    bool isAnimated;
43
44
45    float stepH1, stepH2, stepH3, stepV1, stepV2;
46    float h1, h2, h3;
47    float v1, v2;
48
49public :
50    /** Constructor for street light. Should not be called directly. Use RainLightManager->addStreetLight() instead.*/
51    RainLight(SceneManager *sceneMgr, int lightNumber = 0, ColourValue col = ColourValue::Red, Vector3 LightPos = Vector3(0, 0, 0), float LightAttenuation = 150);
52
53    void animate();
54
55    ColourValue getColour()
56    {
57        return mColour;
58    }
59
60    Vector3 getPosition()
61    {
62        return mLightPos;
63    }
64
65    Vector3 getDirection()
66    {
67        return mLightDir;
68    }
69
70    float getCutoff()
71    {
72        return mLightCutoff;
73    }
74
75    float getAttenuation()
76    {
77        return mLightAttenuation;
78    }
79
80    bool getIsAnimated()
81    {
82        return isAnimated;
83    }
84
85};
86
87
88
89class RainLightManager
90{
91private :
92    int lightCount;
93    std::vector<RainLight *> lightVector;
94    SceneManager *mSceneMgr;
95
96public :
97    RainLightManager(SceneManager *sceneMgr);
98
99    ~RainLightManager();
100
101    int getLightCount()
102    {
103        return lightCount;
104    }
105
106    void addStreetLight(ColourValue col = ColourValue::Red + ColourValue::Green + ColourValue::Blue, Vector3 LightPos = Vector3(0, 0, 0), float LightAttenuation = 150);
107
108    /** defines the light information texture, used by the particles to get lighted */
109    void createLightInfoTexture();
110
111    void updateLightInfoTexture();
112
113    void updateLights();
114
115    void finalizeLights();
116};
117
118#endif // __RAIN_LIGHT__
119
Note: See TracBrowser for help on using the repository browser.