Skip to content

Commit 318cd0f

Browse files
joye-ramonexrSimpAI
authored andcommitted
добавил clamp(fog_distance, 1.f, far_plane - 10); с аномалии
туман не должен быть такой же как far_plan а всегда меньше
1 parent c46a046 commit 318cd0f

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

ogsr_engine/Layers/xrRender/dxLensFlareRender.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "dxLensFlareRender.h"
33
#include "../../xr_3da/xr_efflensflare.h"
44
#include "../../xr_3da/iGame_persistent.h"
5+
56
#define MAX_Flares 24
67

7-
#define FAR_DIST g_pGamePersistent->Environment().CurrentEnv->far_plane
88

99
void dxFlareRender::Copy(IFlareRender& _in) { *this = *(dxFlareRender*)&_in; }
1010

@@ -31,7 +31,7 @@ void dxLensFlareRender::Render(CLensFlare& owner, BOOL bSun, BOOL bFlares, BOOL
3131
u32 VS_Offset;
3232
FVF::LIT* pv = (FVF::LIT*)RCache.Vertex.Lock(MAX_Flares * 4, hGeom.stride(), VS_Offset);
3333

34-
float fDistance = FAR_DIST * 0.75f;
34+
float fDistance = g_pGamePersistent->Environment().CurrentEnv->far_plane * 0.75f;
3535

3636
if (bSun)
3737
{

ogsr_engine/xr_3da/Environment_misc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ void CEnvDescriptorMixer::lerp(CEnvironment* env, CEnvDescriptor& A, CEnvDescrip
490490
}
491491

492492
fog_distance = (fi * A.fog_distance + f * B.fog_distance);
493+
clamp(fog_distance, 1.f, far_plane - 10);
493494
fog_near = (1.0f - fog_density) * 0.85f * fog_distance;
494495
fog_far = 0.99f * fog_distance;
495496

ogsr_engine/xr_3da/thunderbolt.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ BOOL CEffect_Thunderbolt::RayPick(const Fvector& s, const Fvector& d, float& dis
244244

245245
return bRes;
246246
}
247-
#define FAR_DIST g_pGamePersistent->Environment().CurrentEnv->far_plane
248247

249248
void CEffect_Thunderbolt::Bolt(shared_str id, float period, float lt)
250249
{
@@ -256,14 +255,16 @@ void CEffect_Thunderbolt::Bolt(shared_str id, float period, float lt)
256255
current = g_pGamePersistent->Environment().thunderbolt_collection(collection, id)->GetRandomDesc();
257256
VERIFY(current);
258257

258+
float far_plane = g_pGamePersistent->Environment().CurrentEnv->far_plane;
259+
259260
Fmatrix XF, S;
260261
Fvector pos, dev;
261262
float sun_h, sun_p;
262263
CEnvironment& environment = g_pGamePersistent->Environment();
263264
environment.CurrentEnv->sun_dir.getHP(sun_h, sun_p);
264265
float alt = environment.p_var_alt; // Random.randF(environment.p_var_alt.x,environment.p_var_alt.y);
265266
float lng = Random.randF(sun_h - environment.p_var_long + PI, sun_h + environment.p_var_long + PI);
266-
float dist = Random.randF(FAR_DIST * environment.p_min_dist, FAR_DIST * .95f);
267+
float dist = Random.randF(far_plane * environment.p_min_dist, far_plane * .95f);
267268
current_direction.setHP(lng, alt);
268269
pos.mad(Device.vCameraPosition, current_direction, dist);
269270
dev.x = Random.randF(-environment.p_tilt, environment.p_tilt);
@@ -273,7 +274,7 @@ void CEffect_Thunderbolt::Bolt(shared_str id, float period, float lt)
273274

274275
Fvector light_dir = {0.f, -1.f, 0.f};
275276
XF.transform_dir(light_dir);
276-
lightning_size = FAR_DIST * 2.f;
277+
lightning_size = far_plane * 2.f;
277278
RayPick(pos, light_dir, lightning_size);
278279

279280
lightning_center.mad(pos, light_dir, lightning_size * 0.5f);

ogsr_engine/xr_3da/xr_efflensflare.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "xr_object.h"
1717
#include "igame_level.h"
1818

19-
#define FAR_DIST g_pGamePersistent->Environment().CurrentEnv->far_plane
20-
2119
//#define MAX_Flares 24
2220
//////////////////////////////////////////////////////////////////////////////
2321
// Globals ///////////////////////////////////////////////////////////////////
@@ -351,7 +349,7 @@ void CLensFlare::OnFrame(shared_str id)
351349
bRender = true;
352350

353351
// Calculate the point directly in front of us, on the far clip plane
354-
float fDistance = FAR_DIST * 0.75f;
352+
float fDistance = g_pGamePersistent->Environment().CurrentEnv->far_plane * 0.75f;
355353
vecCenter.mul(vecDir, fDistance);
356354
vecCenter.add(vecPos);
357355
// Calculate position of light on the far clip plane

0 commit comments

Comments
 (0)