Skip to content

Commit

Permalink
Add trees_amplitude, trees_speed, trees_rotation and trees_wave weath…
Browse files Browse the repository at this point in the history
…er parameters

Merged from Lost Alpha
  • Loading branch information
Xottab-DUTY committed Jul 21, 2024
1 parent 8cd060d commit 0409331
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 46 deletions.
16 changes: 4 additions & 12 deletions src/Layers/xrRender/FTreeVisual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,19 @@ struct FTreeVisual_setup
void calculate()
{
dwFrame = Device.dwFrame;

const float tm_rot = PI_MUL_2 * Device.fTimeGlobal / ps_r__Tree_w_rot;
CEnvDescriptor& desc = g_pGamePersistent->Environment().CurrentEnv;

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

wind.set(_sin(tm_rot), 0, _cos(tm_rot), 0);
wind.normalize();

#if RENDER!=R_R1
const auto& env = g_pGamePersistent->Environment().CurrentEnv;
const float fValue = env.m_fTreeAmplitudeIntensity;
wind.mul(fValue); // dir1*amplitude
#else
wind.mul(ps_r__Tree_w_amp); // dir1*amplitude
#endif
wind.mul(desc.m_fTreeAmplitude); // dir1*amplitude

scale = 1.f / float(FTreeVisual_quant);

// setup constants
wave.set(
ps_r__Tree_Wave.x, ps_r__Tree_Wave.y, ps_r__Tree_Wave.z, Device.fTimeGlobal * ps_r__Tree_w_speed); // wave
wave.set(desc.m_fTreeWave.x, desc.m_fTreeWave.y, desc.m_fTreeWave.z, Device.fTimeGlobal * desc.m_fTreeSpeed); // wave
wave.div(PI_MUL_2);
}
};
Expand Down
15 changes: 1 addition & 14 deletions src/Layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ float ps_r__Detail_density = 0.3f;
float ps_r__Detail_height = 1.f;
float ps_r__Detail_rainbow_hemi = 0.75f;

float ps_r__Tree_w_rot = 10.0f;
float ps_r__Tree_w_speed = 1.00f;
float ps_r__Tree_w_amp = 0.005f;
Fvector ps_r__Tree_Wave = {.1f, .01f, .11f};
float ps_r__Tree_SBC = 1.5f; // scale bias correct

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

Fvector tw_min, tw_max;

CMD4(CCC_Float, "r__geometry_lod", &ps_r__LOD, 0.1f, 2.f);
//CMD4(CCC_Float, "r__geometry_lod_pow", &ps_r__LOD_Power, 0, 2);

Expand All @@ -893,14 +887,6 @@ void xrRender_initconsole()
#ifdef DEBUG
CMD4(CCC_Float, "r__detail_l_ambient", &ps_r__Detail_l_ambient, .5f, .95f);
CMD4(CCC_Float, "r__detail_l_aniso", &ps_r__Detail_l_aniso, .1f, .5f);

CMD4(CCC_Float, "r__d_tree_w_amp", &ps_r__Tree_w_amp, .001f, 1.f);
CMD4(CCC_Float, "r__d_tree_w_rot", &ps_r__Tree_w_rot, .01f, 100.f);
CMD4(CCC_Float, "r__d_tree_w_speed", &ps_r__Tree_w_speed, 1.0f, 10.f);

tw_min.set(EPS, EPS, EPS);
tw_max.set(2, 2, 2);
CMD4(CCC_Vector3, "r__d_tree_wave", &ps_r__Tree_Wave, tw_min, tw_max);
#endif // DEBUG

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

Fvector tw_min, tw_max;
tw_min.set(0, 0, 0);
tw_max.set(1, 1, 1);
CMD4(CCC_Vector3, "r2_aa_break", &ps_r2_aa_barier, tw_min, tw_max);
Expand Down
4 changes: 0 additions & 4 deletions src/Layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ extern ECORE_API float ps_r__Detail_l_aniso;
extern ECORE_API float ps_r__Detail_density;
extern ECORE_API float ps_r__Detail_height;

extern ECORE_API float ps_r__Tree_w_rot;
extern ECORE_API float ps_r__Tree_w_speed;
extern ECORE_API float ps_r__Tree_w_amp;
extern ECORE_API float ps_r__Tree_SBC; // scale bias correct
extern ECORE_API Fvector ps_r__Tree_Wave;

extern ECORE_API float ps_r__WallmarkTTL;
extern ECORE_API float ps_r__WallmarkSHIFT;
Expand Down
11 changes: 0 additions & 11 deletions src/Layers/xrRender_R2/r2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,6 @@ static class cl_water_intensity : public R_constant_setup
}
} binder_water_intensity;

static class cl_tree_amplitude_intensity : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
const auto& env = g_pGamePersistent->Environment().CurrentEnv;
const float fValue = env.m_fTreeAmplitudeIntensity;
cmd_list.set_c(C, fValue, fValue, fValue, 0.f);
}
} binder_tree_amplitude_intensity;
// XXX: do we need to register this binder?

static class cl_sun_shafts_intensity : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
Expand Down
6 changes: 5 additions & 1 deletion src/xrEngine/Environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ class ENGINE_API CEnvDescriptor
float m_fSunShaftsIntensity;
float m_fWaterIntensity;

float m_fTreeAmplitudeIntensity;
// SkyLoader: trees wave
float m_fTreeAmplitude { 0.005f };
float m_fTreeSpeed { 1.00f };
float m_fTreeRotation { 10.0f };
Fvector3 m_fTreeWave { 0.1f, 0.01f, 0.11f };

CLensFlareDescriptor* lens_flare;
SThunderboltCollection* thunderbolt;
Expand Down
20 changes: 16 additions & 4 deletions src/xrEngine/Environment_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,6 @@ CEnvDescriptor::CEnvDescriptor(shared_str const& identifier) : m_identifier(iden
m_fSunShaftsIntensity = 0;
m_fWaterIntensity = 1;

m_fTreeAmplitudeIntensity = 0.01f;

lens_flare = nullptr;
thunderbolt = nullptr;

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

m_fSunShaftsIntensity = config.read_if_exists<float>(identifier, "sun_shafts_intensity", 0.0);
m_fWaterIntensity = config.read_if_exists<float>(identifier, "water_intensity", 1.0);
m_fTreeAmplitudeIntensity = config.read_if_exists<float>(identifier, "tree_amplitude_intensity", 0.01);

m_fTreeAmplitude = 0.005f;
if (config.line_exist(identifier, "trees_amplitude")) // Lost Alpha config
m_fTreeAmplitude = config.r_float(identifier, "trees_amplitude");
else if (config.line_exist(identifier, "tree_amplitude_intensity")) // Call of Chernobyl config
m_fTreeAmplitude = config.r_float(identifier, "tree_amplitude_intensity");

m_fTreeSpeed = config.read_if_exists<float>(identifier, "trees_speed", 1.0f);
m_fTreeRotation = config.read_if_exists<float>(identifier, "trees_rotation", 10.0f);

m_fTreeWave = config.read_if_exists<Fvector>(identifier, "trees_wave", { .1f, .01f, .11f });

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

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

m_fTreeAmplitudeIntensity = fi * A.m_fTreeAmplitudeIntensity + f * B.m_fTreeAmplitudeIntensity;
// trees
m_fTreeAmplitude = fi * A.m_fTreeAmplitude + f * B.m_fTreeAmplitude;
m_fTreeSpeed = fi * A.m_fTreeSpeed + f * B.m_fTreeSpeed;
m_fTreeRotation = fi * A.m_fTreeRotation + f * B.m_fTreeRotation;
m_fTreeWave.lerp(A.m_fTreeWave, B.m_fTreeWave, f);

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

0 comments on commit 0409331

Please sign in to comment.