Skip to content

Commit 0409331

Browse files
committed
Add trees_amplitude, trees_speed, trees_rotation and trees_wave weather parameters
Merged from Lost Alpha
1 parent 8cd060d commit 0409331

File tree

6 files changed

+26
-46
lines changed

6 files changed

+26
-46
lines changed

src/Layers/xrRender/FTreeVisual.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,19 @@ struct FTreeVisual_setup
119119
void calculate()
120120
{
121121
dwFrame = Device.dwFrame;
122-
123-
const float tm_rot = PI_MUL_2 * Device.fTimeGlobal / ps_r__Tree_w_rot;
122+
CEnvDescriptor& desc = g_pGamePersistent->Environment().CurrentEnv;
124123

125124
// Calc wind-vector3, scale
125+
float tm_rot = PI_MUL_2 * Device.fTimeGlobal / desc.m_fTreeRotation;
126126

127127
wind.set(_sin(tm_rot), 0, _cos(tm_rot), 0);
128128
wind.normalize();
129-
130-
#if RENDER!=R_R1
131-
const auto& env = g_pGamePersistent->Environment().CurrentEnv;
132-
const float fValue = env.m_fTreeAmplitudeIntensity;
133-
wind.mul(fValue); // dir1*amplitude
134-
#else
135-
wind.mul(ps_r__Tree_w_amp); // dir1*amplitude
136-
#endif
129+
wind.mul(desc.m_fTreeAmplitude); // dir1*amplitude
137130

138131
scale = 1.f / float(FTreeVisual_quant);
139132

140133
// setup constants
141-
wave.set(
142-
ps_r__Tree_Wave.x, ps_r__Tree_Wave.y, ps_r__Tree_Wave.z, Device.fTimeGlobal * ps_r__Tree_w_speed); // wave
134+
wave.set(desc.m_fTreeWave.x, desc.m_fTreeWave.y, desc.m_fTreeWave.z, Device.fTimeGlobal * desc.m_fTreeSpeed); // wave
143135
wave.div(PI_MUL_2);
144136
}
145137
};

src/Layers/xrRender/xrRender_console.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ float ps_r__Detail_density = 0.3f;
130130
float ps_r__Detail_height = 1.f;
131131
float ps_r__Detail_rainbow_hemi = 0.75f;
132132

133-
float ps_r__Tree_w_rot = 10.0f;
134-
float ps_r__Tree_w_speed = 1.00f;
135-
float ps_r__Tree_w_amp = 0.005f;
136-
Fvector ps_r__Tree_Wave = {.1f, .01f, .11f};
137133
float ps_r__Tree_SBC = 1.5f; // scale bias correct
138134

139135
float ps_r__WallmarkTTL = 50.f;
@@ -881,8 +877,6 @@ void xrRender_initconsole()
881877
CMD4(CCC_Float, "r__gamma", &ps_r2_img_gamma, 0.5f, 2.2f);
882878
CMD4(CCC_Float, "r__saturation", &ps_r2_img_saturation, 0.0f, 2.0f);
883879

884-
Fvector tw_min, tw_max;
885-
886880
CMD4(CCC_Float, "r__geometry_lod", &ps_r__LOD, 0.1f, 2.f);
887881
//CMD4(CCC_Float, "r__geometry_lod_pow", &ps_r__LOD_Power, 0, 2);
888882

@@ -893,14 +887,6 @@ void xrRender_initconsole()
893887
#ifdef DEBUG
894888
CMD4(CCC_Float, "r__detail_l_ambient", &ps_r__Detail_l_ambient, .5f, .95f);
895889
CMD4(CCC_Float, "r__detail_l_aniso", &ps_r__Detail_l_aniso, .1f, .5f);
896-
897-
CMD4(CCC_Float, "r__d_tree_w_amp", &ps_r__Tree_w_amp, .001f, 1.f);
898-
CMD4(CCC_Float, "r__d_tree_w_rot", &ps_r__Tree_w_rot, .01f, 100.f);
899-
CMD4(CCC_Float, "r__d_tree_w_speed", &ps_r__Tree_w_speed, 1.0f, 10.f);
900-
901-
tw_min.set(EPS, EPS, EPS);
902-
tw_max.set(2, 2, 2);
903-
CMD4(CCC_Vector3, "r__d_tree_wave", &ps_r__Tree_Wave, tw_min, tw_max);
904890
#endif // DEBUG
905891

906892
CMD3(CCC_Mask, "r__actor_shadow", &ps_r__common_flags, RFLAG_ACTOR_SHADOW);
@@ -1028,6 +1014,7 @@ void xrRender_initconsole()
10281014
CMD4(CCC_Float, "r2_slight_fade", &ps_r2_slight_fade, .2f, 1.f);
10291015
CMD3(CCC_Token, "r2_smap_size", &ps_r2_smapsize, qsmapsize_token);
10301016

1017+
Fvector tw_min, tw_max;
10311018
tw_min.set(0, 0, 0);
10321019
tw_max.set(1, 1, 1);
10331020
CMD4(CCC_Vector3, "r2_aa_break", &ps_r2_aa_barier, tw_min, tw_max);

src/Layers/xrRender/xrRender_console.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ extern ECORE_API float ps_r__Detail_l_aniso;
3737
extern ECORE_API float ps_r__Detail_density;
3838
extern ECORE_API float ps_r__Detail_height;
3939

40-
extern ECORE_API float ps_r__Tree_w_rot;
41-
extern ECORE_API float ps_r__Tree_w_speed;
42-
extern ECORE_API float ps_r__Tree_w_amp;
4340
extern ECORE_API float ps_r__Tree_SBC; // scale bias correct
44-
extern ECORE_API Fvector ps_r__Tree_Wave;
4541

4642
extern ECORE_API float ps_r__WallmarkTTL;
4743
extern ECORE_API float ps_r__WallmarkSHIFT;

src/Layers/xrRender_R2/r2.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,6 @@ static class cl_water_intensity : public R_constant_setup
109109
}
110110
} binder_water_intensity;
111111

112-
static class cl_tree_amplitude_intensity : public R_constant_setup
113-
{
114-
void setup(CBackend& cmd_list, R_constant* C) override
115-
{
116-
const auto& env = g_pGamePersistent->Environment().CurrentEnv;
117-
const float fValue = env.m_fTreeAmplitudeIntensity;
118-
cmd_list.set_c(C, fValue, fValue, fValue, 0.f);
119-
}
120-
} binder_tree_amplitude_intensity;
121-
// XXX: do we need to register this binder?
122-
123112
static class cl_sun_shafts_intensity : public R_constant_setup
124113
{
125114
void setup(CBackend& cmd_list, R_constant* C) override

src/xrEngine/Environment.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ class ENGINE_API CEnvDescriptor
169169
float m_fSunShaftsIntensity;
170170
float m_fWaterIntensity;
171171

172-
float m_fTreeAmplitudeIntensity;
172+
// SkyLoader: trees wave
173+
float m_fTreeAmplitude { 0.005f };
174+
float m_fTreeSpeed { 1.00f };
175+
float m_fTreeRotation { 10.0f };
176+
Fvector3 m_fTreeWave { 0.1f, 0.01f, 0.11f };
173177

174178
CLensFlareDescriptor* lens_flare;
175179
SThunderboltCollection* thunderbolt;

src/xrEngine/Environment_misc.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ CEnvDescriptor::CEnvDescriptor(shared_str const& identifier) : m_identifier(iden
288288
m_fSunShaftsIntensity = 0;
289289
m_fWaterIntensity = 1;
290290

291-
m_fTreeAmplitudeIntensity = 0.01f;
292-
293291
lens_flare = nullptr;
294292
thunderbolt = nullptr;
295293

@@ -407,7 +405,17 @@ void CEnvDescriptor::load(CEnvironment& environment, const CInifile& config, pcs
407405

408406
m_fSunShaftsIntensity = config.read_if_exists<float>(identifier, "sun_shafts_intensity", 0.0);
409407
m_fWaterIntensity = config.read_if_exists<float>(identifier, "water_intensity", 1.0);
410-
m_fTreeAmplitudeIntensity = config.read_if_exists<float>(identifier, "tree_amplitude_intensity", 0.01);
408+
409+
m_fTreeAmplitude = 0.005f;
410+
if (config.line_exist(identifier, "trees_amplitude")) // Lost Alpha config
411+
m_fTreeAmplitude = config.r_float(identifier, "trees_amplitude");
412+
else if (config.line_exist(identifier, "tree_amplitude_intensity")) // Call of Chernobyl config
413+
m_fTreeAmplitude = config.r_float(identifier, "tree_amplitude_intensity");
414+
415+
m_fTreeSpeed = config.read_if_exists<float>(identifier, "trees_speed", 1.0f);
416+
m_fTreeRotation = config.read_if_exists<float>(identifier, "trees_rotation", 10.0f);
417+
418+
m_fTreeWave = config.read_if_exists<Fvector>(identifier, "trees_wave", { .1f, .01f, .11f });
411419

412420
C_CHECK(clouds_color);
413421
C_CHECK(sky_color);
@@ -565,7 +573,11 @@ void CEnvDescriptorMixer::lerp(CEnvironment& parent, CEnvDescriptor& A, CEnvDesc
565573

566574
m_fWaterIntensity = fi * A.m_fWaterIntensity + f * B.m_fWaterIntensity;
567575

568-
m_fTreeAmplitudeIntensity = fi * A.m_fTreeAmplitudeIntensity + f * B.m_fTreeAmplitudeIntensity;
576+
// trees
577+
m_fTreeAmplitude = fi * A.m_fTreeAmplitude + f * B.m_fTreeAmplitude;
578+
m_fTreeSpeed = fi * A.m_fTreeSpeed + f * B.m_fTreeSpeed;
579+
m_fTreeRotation = fi * A.m_fTreeRotation + f * B.m_fTreeRotation;
580+
m_fTreeWave.lerp(A.m_fTreeWave, B.m_fTreeWave, f);
569581

570582
// colors
571583
//. sky_color.lerp (A.sky_color,B.sky_color,f).add(Mdf.sky_color).mul(modif_power);

0 commit comments

Comments
 (0)