3 #include "../MathUtilities.h" 16 D3DXCOLOR colorzenith;
23 const float scaledTurbulence = scaledTurbidity *
GetTurbulence() * 18.214f;
25 if (!
g_bAboveClouds && rand() < static_cast<short>(scaledTurbulence * 2.0f))
29 float distance = 14.0f + scaledTurbidity -
RandomFloat() * 14.0f;
36 const float seconds = (1.0f - distance) * 15.0f;
62 command.
name =
"AuralHullIonization";
83 logger->
Log(
"----------------------------------- ACMPL");
112 logger->
Log(
"----------------------------------- BCMPL");
161 const float angle = D3DX_HALFPI - acosf(
radiusC / f_temp);
163 elevation = D3DXVec3Dot(&result1, &Xsunlight);
183 else if (inview > 0.9f)
206 sprintf_s(
msg,
sizeof(
msg),
"Trapped a violation with shearRate...");
265 if (f_temp <= 0.0f && f_temp > -20.0f)
269 else if (f_temp > 0.0f && f_temp <= 0.05f)
276 if (f_temp > 0.15f || f_temp == -20.0f)
308 if (winddiff > D3DX_PI)
314 else if (winddiff < -D3DX_PI)
330 const float whereWeThinkWeLeaveOffAt63 = -27.89f;
345 else if (
f_MSL >= 90.0f)
348 temperature = 1006.115f - 1097.39779f / (1.0f + powf(
f_MSL / 179.8561f, 9.161937f));
368 else if (f_temp > 1.0f)
374 f_temp *= sqrtf(1.0f - (
GetTurbidity() - 2.0f) / 14.0f) * 0.5f + 0.5f;
382 bcllight.r =
sunrC * f_temp;
386 bcllight.g =
sungC * f_temp;
387 bcllight.b =
sunbC * f_temp;
419 bcllight.r += 0.7f * f_temp;
420 if (bcllight.r > 1.0f)
422 bcllight.g += 0.7f * f_temp;
423 if (bcllight.g > 1.0f)
425 bcllight.b += f_temp;
426 if (bcllight.b > 1.0f)
484 else if (
f_ACL > 0.300f)
501 float r = 0.0f, g = 0.0f, b = 0.0f, avg = 0.0f;
507 f_temp = D3DXVec3Length(&result) / 20.0f;
510 f_temp = sqrtf(1.0f - f_temp) * 0.15f;
528 bcllight.r +=
r / avg;
529 if (bcllight.r > 1.0f)
531 bcllight.g += g / avg;
532 if (bcllight.g > 1.0f)
534 bcllight.b += b / avg;
535 if (bcllight.b > 1.0f)
583 colorzenith.r = 100.0f / 255.0f; colorzenith.g = 50.0f / 255.0f; colorzenith.b = 100.0f / 255.0f;
587 colorzenith.r = 100.0f / 255.0f;
588 colorzenith.g = 50.0f / 255.0f;
589 colorzenith.b = (100.0f - 50.0f * (
elevation + 0.09f) / 0.03f) / 255.0f;
593 colorzenith.r = (100.0f - 50.0f * (
elevation + 0.06f) / 0.04f) / 255.0f;
594 colorzenith.g = 50.0f / 255.0f;
595 colorzenith.b = (50.0f + 50.0f * (
elevation + 0.06f) / 0.04f) / 255.0f;
599 colorzenith.r = colorzenith.g = (50.0f + 50.0f * (
elevation + 0.02f) / 1.02f) / 255.0f;
600 colorzenith.b = (100.0f + 100.0f * (
elevation + 0.02f) / 1.02f) / 255.0f;
632 shiplight.r = 0; shiplight.g = 0; shiplight.b = 0;
648 if (effect.
power == 2.0f)
654 else if (effect.
power == 1.5f)
663 else if (effect.
power == 0.5f)
668 shiplight.r += effect.
diffuse.r * f_temp;
669 shiplight.g += effect.
diffuse.g * f_temp;
670 shiplight.b += effect.
diffuse.b * f_temp;
677 D3DXVECTOR4 shipdiff;
678 shipdiff.x = shiplight.r; shipdiff.y = shiplight.g; shipdiff.z = shiplight.b; shipdiff.w = 0;
683 f_temp = sqrtf(bcllight.r * bcllight.r + bcllight.g * bcllight.g + bcllight.b * bcllight.b);
686 f_temp = (1.0f - f_temp) * 0.5f;
748 if (cloudVisSmooth1 < cloudVisTarget1)
750 cloudVisSmooth1 += D3DXVec3Length(&
locvelcomp) * fElapsedTime * 10.0f;
751 if (cloudVisSmooth1 > cloudVisTarget1)
752 cloudVisSmooth1 = cloudVisTarget1;
754 else if (cloudVisSmooth1 > cloudVisTarget1)
756 cloudVisSmooth1 -= D3DXVec3Length(&
locvelcomp) * fElapsedTime * 10.0f;
757 if (cloudVisSmooth1 < cloudVisTarget1)
758 cloudVisSmooth1 = cloudVisTarget1;
760 if (cloudVisTarget1 == cloudVisSmooth1)
763 const float targetSpectrum = (
GetTurbidity() - 2.0f) / 12.0f;
802 else if (f_temp < 0.0f)
804 f_temp = sqrtf(1.0f - f_temp);
805 if (elevation<0.0f && elevation>-0.09f)
810 colorzenith.a = f_temp;
815 colorzenith.a = 1.0f;
841 logger->
Log(
"Weather1 initialized smoothwinddir!");
857 logger->
Log(
"Weather1 initialized smoothTemperature!");
873 logger->
Log(
"Weather1 initialized smoothVisibility!");
883 logger->
Log(
"Weather2 initialized cloudSurfaceSmoothKm!");
893 logger->
Log(
"Weather2 initialized cloudCeilingSmoothKm!");
void SetCloudCeilingTargetKm(float prmCloudCeilingTargetKm)
float GetCloudCeilingMslKm() const
float cloudSurfaceSmoothKm
void EnergyWeaponImpact()
std::vector< Command > commandStream
float GetWindDirectionRadians() const
FIREWORKS fireworks[fireworksC]
s_network_objects playerships[MAX_SCAN]
float alphascreenOverride
float ProbeBoundSphere(D3DXVECTOR3 *position, const D3DXVECTOR3 *Xsunlight) const
void SetTurbidity(float prmTurbidity)
float cloudCeilingTargetKm
bool m_bDeviceSupportsVizQuery
float cloudHorizonDistance
void SetTurbulenceScalar(float prmTurbulence)
std::vector< s_light_effect > effects
propulsion * ptrPropulsion
float GetWindspeedKms() const
float GetTemperatureCelsius() const
void FrameMove(float fElapsedTime)
void TriggerBCLLightning(float distanceScalar, float intensityScalar) const
void InitializeSmoothValues()
LIGHTNINGBELOW lightningbelow
SPlayerData player[MAX_ONLINEPLAYERS]
void SetWindDirectionRadians(float prmWinddir)
float Clamp(float val, float min, float max)
float cloudSurfaceTargetKm
LIGHTNINGABOVE lightningabove[ACLlightningC]
void AddDelayedSound(int soundEnum, float delay, float volume=1.0f)
float GetAttenuation(bool applyDensity) const
void Log(const char *msg, Level level=Info, int errorCode=0)
s_polygon_object polyobjects[maxpolyC]
D3DXCOLOR dwFogColorHorizon
float Play(int soundEnum)
D3DXCOLOR dwFogColorZenith
void SetTemperatureCelsius(float prmTemperature)
float Lerp(float val1, float val2, float lerp)
float GetTurbulence() const
void SetWindspeedKms(float prmWindspeed)
float GetTurbidity() const
void AddToCallStack(const char *msg)
void SetCloudSurfaceTargetKm(float prmCloudSurfaceTargetKm)
D3DXCOLOR dwFogFactorZenith
float cloudCeilingSmoothAglKm