/////////////////////////////////////////////////////////////////////////// // // Realistic rain real-time simulation program // // Pierre Rousseau // /////////////////////////////////////////////////////////////////////////// // // Light Handling // /////////////////////////////////////////////////////////////////////////// #ifndef __RAIN_LIGHT__ #define __RAIN_LIGHT__ #include "CommonRain.h" #include "ExampleApplication.h" #include /** RainLight class * enables a change of appearance of raindrops close to a light source */ class RainLight { private : SceneManager *mSceneMgr; SceneNode *mLightNode; SceneNode *mConeNode; BillboardSet *mBillboardSet; Billboard *mBillboard; ColourValue mColour; Vector3 mLightPos, mLightInitialPos, mLightDir; float mLightCutoff, mLightAttenuation; bool isAnimated; float stepH1, stepH2, stepH3, stepV1, stepV2; float h1, h2, h3; float v1, v2; public : /** Constructor for street light. Should not be called directly. Use RainLightManager->addStreetLight() instead.*/ RainLight(SceneManager *sceneMgr, int lightNumber = 0, ColourValue col = ColourValue::Red, Vector3 LightPos = Vector3(0, 0, 0), float LightAttenuation = 150); void animate(); ColourValue getColour() { return mColour; } Vector3 getPosition() { return mLightPos; } Vector3 getDirection() { return mLightDir; } float getCutoff() { return mLightCutoff; } float getAttenuation() { return mLightAttenuation; } bool getIsAnimated() { return isAnimated; } }; class RainLightManager { private : int lightCount; std::vector lightVector; SceneManager *mSceneMgr; public : RainLightManager(SceneManager *sceneMgr); ~RainLightManager(); int getLightCount() { return lightCount; } void addStreetLight(ColourValue col = ColourValue::Red + ColourValue::Green + ColourValue::Blue, Vector3 LightPos = Vector3(0, 0, 0), float LightAttenuation = 150); /** defines the light information texture, used by the particles to get lighted */ void createLightInfoTexture(); void updateLightInfoTexture(); void updateLights(); void finalizeLights(); }; #endif // __RAIN_LIGHT__