UFO: Alien Invasion
r_weather.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2013 Alexander Y. Tishin
8 Copyright (C) 2013-2020 UFO: Alien Invasion.
9 
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 as published by the Free Software Foundation; either version 2
13 of the License, or (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 See the GNU General Public License for more details.
20 
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 
25 */
26 
27 #pragma once
28 
29 class Weather {
30  public:
31  /* public members are intended; they are to avoid need of getters/setters to change weather in-flight */
35  float windStrength;
36  float windDirection;
38  float fallingSpeed;
40  int splashTime;
41  float splashSize;
43  Weather(void);
44  Weather(weatherTypes weather);
45  virtual ~Weather();
46 
47  void setDefaults(void);
48  void changeTo(weatherTypes weather);
49  void clearParticles(void);
50 
51  void update(int milliseconds);
52  void render(void);
53  protected:
54  static const size_t MAX_PARTICLES = 8192;
55  float smearLength;
56  float particleSize;
59 
60  struct particle {
61  GLfloat x, y, z;
62  GLfloat vx, vy, vz;
63  int timeout;
64  int ttl;
65  };
66 
68 };
virtual ~Weather()
Definition: r_weather.cpp:157
void changeTo(weatherTypes weather)
changes to weather of given type; parameters are randomized
Definition: r_weather.cpp:91
Weather(void)
make a default (clean) weather
Definition: r_weather.cpp:142
static const size_t MAX_PARTICLES
Definition: r_weather.h:54
vec4_t color
Definition: r_weather.h:58
float windStrength
Definition: r_weather.h:35
weatherTypes
Definition: r_weather.h:32
int splashTime
Definition: r_weather.h:40
float windDirection
Definition: r_weather.h:36
void clearParticles(void)
Just a shared methods for ctors to initialize the weather.
Definition: r_weather.cpp:132
weatherTypes weatherType
Definition: r_weather.h:33
float windTurbulence
Definition: r_weather.h:37
float splashSize
Definition: r_weather.h:41
particle particles[MAX_PARTICLES]
Definition: r_weather.h:67
float weatherStrength
Definition: r_weather.h:34
void update(int milliseconds)
Updates weather for the time passed; handles particle creation/removal automatically.
Definition: r_weather.cpp:164
float fallingSpeed
Definition: r_weather.h:38
float smearLength
Definition: r_weather.h:55
void setDefaults(void)
Sets clean weather, but generate some parameters usable for easily changing it into the worse varieti...
Definition: r_weather.cpp:71
void render(void)
Draws weather effects.
Definition: r_weather.cpp:257
float particleSize
Definition: r_weather.h:56
vec_t vec4_t[4]
Definition: ufotypes.h:40