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

◆ CalculateLinePointFade()

void CalculateLinePointFade ( )
protected

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

182 {
184 JsonUndergroundAreaBreadcrumb startPoint = points[0];
185 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
186 vector playerPos = m_Player.GetPosition();
187
188 bool forceAcco;
189 float acco;
190 float accoMax = m_TransitionalTrigger.m_Data.Breadcrumbs[0].EyeAccommodation;
191 float accoMin = endPoint.EyeAccommodation;
192 JsonUndergroundAreaBreadcrumb closestPoint;
193 JsonUndergroundAreaBreadcrumb secondaryPoint;
194 float distanceToClosest;
195 float distanceToSecondary;
196 float distanceBetweenPoints;
197
198 foreach (JsonUndergroundAreaBreadcrumb point : points) //identify closest segment
199 {
200 float dist = vector.DistanceSq(playerPos, point.GetPosition());
201 if (!closestPoint || dist < distanceToClosest)
202 {
203 if (closestPoint)
204 {
205 secondaryPoint = closestPoint;
206 distanceToSecondary = distanceToClosest;
207 }
208 closestPoint = point;
209 distanceToClosest = dist;
210 }
211 else if (!secondaryPoint || dist < secondaryPoint)
212 {
213 secondaryPoint = point;
214 distanceToSecondary = dist;
215 }
216
217 #ifdef DIAG_DEVELOPER
218 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
219 Debug.DrawSphere(point.GetPosition(),0.1, COLOR_RED, ShapeFlags.ONCE);
220 #endif
221 }
222
223 distanceBetweenPoints = vector.DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
224
225 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints) // before first point, do nothing
226 acco = accoMax;
227 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints) // past second point, do nothing
228 acco = accoMin;
229 else // between the two points, lerp
230 {
231 if (closestPoint == endPoint)
232 secondaryPoint = points[points.Count() - 2];
233 else if (closestPoint == startPoint)
234 secondaryPoint = points[1];
235 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
236 {
237 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
238 if (vector.DistanceSq(playerPos, nexPoint.GetPosition()) < vector.DistanceSq(closestPoint.GetPosition(), nexPoint.GetPosition()))
239 secondaryPoint = nexPoint;
240 else
241 {
242 acco = closestPoint.EyeAccommodation;
243 forceAcco = true;
244 }
245 }
246
247 if (!forceAcco)
248 {
249 distanceToSecondary = vector.DistanceSq(playerPos, secondaryPoint.GetPosition());
250
251 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary); // progress
252 acco = Math.Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
253
254 if (points.Find(closestPoint) > points.Find(secondaryPoint))
255 m_LightingLerpTarget = closestPoint.LightLerp;
256 else
257 m_LightingLerpTarget = secondaryPoint.LightLerp;
258
259 }
260 }
261
263
265 {
266 if (m_LightingLerpTarget == 1)
267 {
269 m_AnimTimerLightBlend.Run(1, this, "OnUpdateTimerIn", "OnUpdateTimerEnd",0, false, LIGHT_BLEND_SPEED_IN);
270 }
271 else
272 {
274 m_AnimTimerLightBlend.Run(0, this, "OnUpdateTimerOut", "OnUpdateTimerEnd",m_LightingLerp, false, LIGHT_BLEND_SPEED_OUT);
275 }
276 }
277
278 #ifdef DIAG_DEVELOPER
279 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
280 {
281 Debug.DrawLine(m_Player.GetPosition() + "0 1 0", closestPoint.GetPosition(), COLOR_YELLOW, ShapeFlags.ONCE);
282 if (acco != accoMin && acco != accoMax)
283 Debug.DrawLine(closestPoint.GetPosition(), secondaryPoint.GetPosition(), COLOR_RED, ShapeFlags.ONCE);
284
285 DbgUI.Begin(String("Underground Areas"), 20, 20);
286 DbgUI.Text(String("Closest point id: " + points.Find(closestPoint)));
287 DbgUI.Text(String("Second closest id: " + points.Find(secondaryPoint)));
288 DbgUI.End();
289 }
290 #endif
291 }
DiagMenuIDs
Определения EDiagMenuIDs.c:2
DayZPlayer m_Player
Определения Hand_Events.c:42
ref AnimationTimer m_AnimTimerLightBlend
Определения UndergroundHandlerClient.c:19
UndergroundTrigger m_TransitionalTrigger
Определения UndergroundHandlerClient.c:35
const float ACCO_MODIFIER
Определения UndergroundHandlerClient.c:16
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
float m_LightingLerpTarget
Определения UndergroundHandlerClient.c:29
const float LIGHT_BLEND_SPEED_OUT
Определения UndergroundHandlerClient.c:12
float m_EyeAccoTarget
Определения UndergroundHandlerClient.c:26
float m_LightingLerp
Определения UndergroundHandlerClient.c:30
AnimationTimer class. This timer is for animating float value. usage:
Определения 3_Game/tools/tools.c:653
Определения DbgUI.c:60
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения 3_Game/tools/Debug.c:319
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Определения 3_Game/tools/Debug.c:382
Определения 3_Game/tools/Debug.c:2
Определения EnDebug.c:241
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
const int COLOR_RED
Определения 1_Core/constants.c:64
const int COLOR_YELLOW
Определения 1_Core/constants.c:67
ShapeFlags
Определения EnDebug.c:126
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки ACCO_MODIFIER, DbgUI::Begin(), COLOR_RED, COLOR_YELLOW, vector::DistanceSq(), Debug::DrawLine(), Debug::DrawSphere(), DbgUI::End(), DiagMenu::GetBool(), Math::Lerp(), LIGHT_BLEND_SPEED_IN, LIGHT_BLEND_SPEED_OUT, m_AnimTimerLightBlend, m_EyeAccoTarget, m_LightingLerp, m_LightingLerpTarget, m_Player, m_TransitionalTrigger, String() и DbgUI::Text().

Используется в CalculateEyeAccoTarget().