Skip to content

Commit

Permalink
TREE_WIND_EFFECT is enabled by default
Browse files Browse the repository at this point in the history
Removed always enabled define..
  • Loading branch information
Xottab-DUTY committed Jun 17, 2018
1 parent 5b68e8e commit 86fefe3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/Common/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/* Visual */
#define DETAIL_RADIUS // detail draw radius (by K.D.)
#define TREE_WIND_EFFECT // configurable tree sway, can be used to have trees sway more during storms or lightly on clear days.

/* Tweaks: */
//#define FP_DEATH // first person death view
Expand Down
22 changes: 9 additions & 13 deletions src/Layers/xrRender/FTreeVisual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,26 @@ struct FTreeVisual_setup
Fvector4 wave;
Fvector4 wind;

FTreeVisual_setup() { dwFrame = 0; }
FTreeVisual_setup(): dwFrame(0), scale(0) {}

void calculate()
{
dwFrame = Device.dwFrame;

float tm_rot = PI_MUL_2 * Device.fTimeGlobal / ps_r__Tree_w_rot;
const float tm_rot = PI_MUL_2 * Device.fTimeGlobal / ps_r__Tree_w_rot;

// Calc wind-vector3, scale
#ifdef TREE_WIND_EFFECT
CEnvDescriptor& env = *g_pGamePersistent->Environment().CurrentEnv;


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

#if RENDER!=R_R1
CEnvDescriptor& env = *g_pGamePersistent->Environment().CurrentEnv;
float fValue = env.m_fTreeAmplitudeIntensity;
wind.mul(fValue); // dir1*amplitude
#else // R1
wind.mul(ps_r__Tree_w_amp); // dir1*amplitude
#endif //-RENDER!=R_R1
#else //!TREE_WIND_EFFECT
wind.set(_sin(tm_rot), 0, _cos(tm_rot), 0);
wind.normalize();
wind.mul(fValue); // dir1*amplitude
#else
wind.mul(ps_r__Tree_w_amp); // dir1*amplitude
#endif //-TREE_WIND_EFFECT
#endif

scale = 1.f / float(FTreeVisual_quant);

Expand Down
3 changes: 1 addition & 2 deletions src/Layers/xrRenderPC_R2/r2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ static class cl_water_intensity : public R_constant_setup
}
} binder_water_intensity;

#ifdef TREE_WIND_EFFECT
static class cl_tree_amplitude_intensity : public R_constant_setup
{
void setup(R_constant* C) override
Expand All @@ -95,7 +94,7 @@ static class cl_tree_amplitude_intensity : public R_constant_setup
RCache.set_c(C, fValue, fValue, fValue, 0);
}
} binder_tree_amplitude_intensity;
#endif
// XXX: do we need to register this binder?

static class cl_sun_shafts_intensity : public R_constant_setup
{
Expand Down
3 changes: 1 addition & 2 deletions src/Layers/xrRenderPC_R3/r3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ static class cl_water_intensity : public R_constant_setup
}
} binder_water_intensity;

#ifdef TREE_WIND_EFFECT
static class cl_tree_amplitude_intensity : public R_constant_setup
{
void setup(R_constant* C) override
Expand All @@ -106,7 +105,7 @@ static class cl_tree_amplitude_intensity : public R_constant_setup
RCache.set_c(C, fValue, fValue, fValue, 0);
}
} binder_tree_amplitude_intensity;
#endif
// XXX: do we need to register this binder?

static class cl_sun_shafts_intensity : public R_constant_setup
{
Expand Down
3 changes: 1 addition & 2 deletions src/Layers/xrRenderPC_R4/r4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ static class cl_water_intensity : public R_constant_setup
}
} binder_water_intensity;

#ifdef TREE_WIND_EFFECT
static class cl_tree_amplitude_intensity : public R_constant_setup
{
void setup(R_constant* C) override
Expand All @@ -111,7 +110,7 @@ static class cl_tree_amplitude_intensity : public R_constant_setup
RCache.set_c(C, fValue, fValue, fValue, 0);
}
} binder_tree_amplitude_intensity;
#endif
// XXX: do we need to register this binder?

static class cl_sun_shafts_intensity : public R_constant_setup
{
Expand Down
3 changes: 1 addition & 2 deletions src/xrEngine/Environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,8 @@ class ENGINE_API CEnvDescriptor
float m_fSunShaftsIntensity;
float m_fWaterIntensity;

#ifdef TREE_WIND_EFFECT
float m_fTreeAmplitudeIntensity;
#endif


// int lens_flare_id;
// int tb_id;
Expand Down
6 changes: 0 additions & 6 deletions src/xrEngine/Environment_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ CEnvDescriptor::CEnvDescriptor(shared_str const& identifier) : m_identifier(iden
m_fSunShaftsIntensity = 0;
m_fWaterIntensity = 1;

#ifdef TREE_WIND_EFFECT
m_fTreeAmplitudeIntensity = 0.01;
#endif

lens_flare_id = "";
tb_id = "";
Expand Down Expand Up @@ -299,10 +297,8 @@ void CEnvDescriptor::load(CEnvironment& environment, CInifile& config)
if (config.line_exist(m_identifier.c_str(), "water_intensity"))
m_fWaterIntensity = config.r_float(m_identifier.c_str(), "water_intensity");

#ifdef TREE_WIND_EFFECT
if (config.line_exist(m_identifier.c_str(), "tree_amplitude_intensity"))
m_fTreeAmplitudeIntensity = config.r_float(m_identifier.c_str(), "tree_amplitude_intensity");
#endif

C_CHECK(clouds_color);
C_CHECK(sky_color);
Expand Down Expand Up @@ -445,9 +441,7 @@ void CEnvDescriptorMixer::lerp(
m_fSunShaftsIntensity = fi * A.m_fSunShaftsIntensity + f * B.m_fSunShaftsIntensity;
m_fWaterIntensity = fi * A.m_fWaterIntensity + f * B.m_fWaterIntensity;

#ifdef TREE_WIND_EFFECT
m_fTreeAmplitudeIntensity = fi * A.m_fTreeAmplitudeIntensity + f * B.m_fTreeAmplitudeIntensity;
#endif

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

0 comments on commit 86fefe3

Please sign in to comment.