DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CalcBaseEnvironmentTemperature()

float WorldData::CalcBaseEnvironmentTemperature ( float monthday,
float daytime )
inlineprotected

См. определение в файле WorldData.c строка 122

123 {
124 float approxSunrise = GetApproxSunriseTime( monthday );
125 float approxSunset = GetApproxSunsetTime( monthday );
126 float dayLight = approxSunset - approxSunrise;
127 float nightTime = 24.0 - dayLight;
128 int tempArrayIndex = Math.Floor(monthday) - 1;
129 int tempArrayIndexToLerp = tempArrayIndex + 1;
130 if ( tempArrayIndexToLerp >= 12 )
131 tempArrayIndexToLerp = 0;
132 float tempArrayLerp = monthday - Math.Floor(monthday);
133 float minTempA = m_MinTemps[tempArrayIndex];
134 float minTempB = m_MinTemps[tempArrayIndexToLerp];
135 float maxTempA = m_MaxTemps[tempArrayIndex];
136 float maxTempB = m_MaxTemps[tempArrayIndexToLerp];
137 float eveningMinA = minTempA + ( 0.5 * Math.AbsFloat( minTempA - maxTempA ) );
138 float eveningMinB = minTempB + ( 0.5 * Math.AbsFloat( minTempB - maxTempB ) );
139
140 if ( ( daytime >= approxSunrise ) && ( daytime <= approxSunset ) ) {
141 if ( daytime <= ( approxSunrise + ( dayLight * 0.75 ) ) )
142 return Math.Lerp(
143 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
144 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
145 ( ( daytime - approxSunrise ) / ( dayLight * 0.75 ) ) );
146 else
147 return Math.Lerp(
148 Math.Lerp( maxTempA, maxTempB, tempArrayLerp ),
149 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
150 ( ( ( daytime - approxSunrise ) - ( dayLight * 0.75 ) ) / ( dayLight - ( dayLight * 0.75 ) ) ) );
151 } else {
152 if ( ( daytime > approxSunset ) && ( daytime < 24 ) )
153 return Math.Lerp(
154 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
155 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
156 ( ( daytime - approxSunset ) / ( 24 - approxSunset ) ) / 2.0 );
157 else
158 return Math.Lerp(
159 Math.Lerp( eveningMinA, eveningMinB, tempArrayLerp ),
160 Math.Lerp( minTempA, minTempB, tempArrayLerp ),
161 ( ( ( daytime + ( 24 - approxSunset ) ) / nightTime ) / 2.0 ) + 0.5 );
162 }
163 }
float GetApproxSunriseTime(float monthday)
Определения WorldData.c:89
float GetApproxSunsetTime(float monthday)
Определения WorldData.c:96
float m_MaxTemps[12]
Определения WorldData.c:22
float m_MinTemps[12]
Определения WorldData.c:23

Перекрестные ссылки Math::AbsFloat(), Math::Floor(), GetApproxSunriseTime(), GetApproxSunsetTime(), Math::Lerp(), m_MaxTemps и m_MinTemps.

Используется в GetBaseEnvTemperatureExact() и UpdateBaseEnvTemperature().