Rain
Class : Rain.h
Made By : Steve
Uses : GL_LINES
Complexity : HIGH
Simulates an falling rain using the box model.
The rain effect was the first one coded. It was basic at first, then more functionality was added as the project progressed.
The rain is utilized with the Rain class. It is initialized with :
Rain r = new Rain (int MAX_RAIN, vector3f coord, vector3f radius, float rand);
The constructor asks the user to specify the maximum number of raindrops, middle coordinates of the box, and its dimensions (radius). Since the rain box uses the box model, it is drawn with :
r -> drawRain();
... and it's surrounding box drawn with :
r -> drawBox();
As with any of the line-based effects, GL_LIGHTING must be disabled before making the call to the drawing method. The input values for editing are somewhat sensitive :
- Random : This value lies between 0 and 1. Higher values result in rain coming down in batches, and lower gives more distributed rain.
- Speed : The speed should be between 0 and -1. This is the speed of the rain. Positive values yield rain pouring upwards.
- Height : This is the height of each raindrop. It is measured in units, so any float will do, but make sure it is > 0.
Thoughts : This class yields impressive results, and can compute thousands of raindrops in real-time. If used in a game, it could create good distributed light rain. For heavy rain, placing a rain box that always follows a character would be best to keep the box size small. This effect by far took the most time to create, and adding wind to it made it even more impressive.