forked from alpet83/Xray-Research
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Environment.h
161 lines (121 loc) · 4.78 KB
/
Environment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef EnvironmentH
#define EnvironmentH
// refs
class ENGINE_API IRender_Visual;
class ENGINE_API CInifile;
class ENGINE_API CEnvironment;
// refs - effects
class ENGINE_API CEnvironment;
class ENGINE_API CLensFlare;
class ENGINE_API CEffect_Rain;
class ENGINE_API CEffect_Thunderbolt;
class ENGINE_API CPerlinNoise1D;
// t-defs
class ENGINE_API CEnvModifier
{
public:
Fvector3 position;
float radius;
float power;
float far_plane;
Fvector3 fog_color;
float fog_density;
Fvector3 ambient;
Fvector3 lmap_color;
void load (IReader* fs);
float sum (CEnvModifier& _another, Fvector3& view);
};
class ENGINE_API CEnvDescriptor
{
public:
float exec_time;
STextureList sky_r_textures; // C
float sky_factor; // C
ref_texture sky_texture;
Fvector3 sky_color;
float far_plane;
Fvector3 fog_color;
float fog_density;
float fog_near; // C
float fog_far; // C
float rain_density;
Fvector3 rain_color;
float bolt_period;
float bolt_duration;
float wind_velocity;
float wind_direction;
Fvector3 ambient;
Fvector3 lmap_color;
Fvector3 hemi_color;
Fvector3 sun_color;
Fvector3 sun_dir;
int lens_flare_id;
BOOL thunderbolt;
CEnvDescriptor ();
void load (LPCSTR exec_tm, LPCSTR sect, CEnvironment* parent);
void unload ();
void lerp (CEnvironment* parent, CEnvDescriptor& A, CEnvDescriptor& B, float f, CEnvModifier& M, float m_power);
};
class ENGINE_API CEnvironment
{
struct str_pred : public std::binary_function<shared_str, shared_str, bool> {
IC bool operator()(const shared_str& x, const shared_str& y) const
{ return xr_strcmp(x,y)<0; }
};
public:
DEFINE_VECTOR (CEnvDescriptor*,EnvVec,EnvIt);
DEFINE_MAP_PRED (shared_str,EnvVec,WeatherMap,WeatherPairIt,str_pred);
// Environments
CEnvDescriptor CurrentEnv;
CEnvDescriptor* CurrentA;
CEnvDescriptor* CurrentB;
bool bTerminator;
EnvVec* CurrentWeather;
shared_str CurrentWeatherName;
WeatherMap Weathers;
xr_vector<CEnvModifier> Modifiers;
float wind_strength;
ref_shader sh_2sky;
ref_geom sh_2geom;
CEffect_Rain* eff_Rain;
CLensFlare* eff_LensFlare;
CEffect_Thunderbolt* eff_Thunderbolt;
float fGameTime;
float fTimeFactor;
ref_texture tonemap;
// music interface
struct music
{
ref_sound left;
ref_sound right;
bool playing () { return left.feedback && right.feedback; }
};
xr_deque<music*> playlist;
void SelectEnvs (float gt);
public:
CEnvironment ();
~CEnvironment ();
void load ();
void unload ();
void mods_load ();
void mods_unload ();
void OnFrame ();
void RenderFirst ();
void RenderLast ();
void SetWeather (shared_str name);
shared_str GetWeather () { return CurrentWeatherName;}
void SetGameTime (float game_time, float time_factor) { fGameTime = game_time; fTimeFactor=time_factor; }
void OnDeviceCreate ();
void OnDeviceDestroy ();
// editor-related
#ifdef _EDITOR
public:
float ed_from_time;
float ed_to_time;
public:
void ED_Reload ();
#endif
};
ENGINE_API extern Flags32 psEnvFlags;
ENGINE_API extern float psVisDistance;
#endif //EnvironmentH