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

◆ CalculateLinePointFade()

void CalculateLinePointFade ( )
protected

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

181 {
183 JsonUndergroundAreaBreadcrumb startPoint = points[0];
184 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
185 vector playerPos = m_Player.GetPosition();
186
187 bool forceAcco;
188 float acco;
189 float accoMax = m_TransitionalTrigger.m_Data.Breadcrumbs[0].EyeAccommodation;
190 float accoMin = endPoint.EyeAccommodation;
191 JsonUndergroundAreaBreadcrumb closestPoint;
192 JsonUndergroundAreaBreadcrumb secondaryPoint;
193 float distanceToClosest;
194 float distanceToSecondary;
195 float distanceBetweenPoints;
196
197 foreach (JsonUndergroundAreaBreadcrumb point : points) //identify closest segment
198 {
199 float dist = vector.DistanceSq(playerPos, point.GetPosition());
200 if (!closestPoint || dist < distanceToClosest)
201 {
202 if (closestPoint)
203 {
204 secondaryPoint = closestPoint;
205 distanceToSecondary = distanceToClosest;
206 }
207 closestPoint = point;
208 distanceToClosest = dist;
209 }
210 else if (!secondaryPoint || dist < secondaryPoint)
211 {
212 secondaryPoint = point;
213 distanceToSecondary = dist;
214 }
215
216 #ifdef DIAG_DEVELOPER
217 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
218 Debug.DrawSphere(point.GetPosition(),0.1, COLOR_RED, ShapeFlags.ONCE);
219 #endif
220 }
221
222 distanceBetweenPoints = vector.DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
223
224 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints) // before first point, do nothing
225 acco = accoMax;
226 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints) // past second point, do nothing
227 acco = accoMin;
228 else // between the two points, lerp
229 {
230 if (closestPoint == endPoint)
231 secondaryPoint = points[points.Count() - 2];
232 else if (closestPoint == startPoint)
233 secondaryPoint = points[1];
234 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
235 {
236 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
237 if (vector.DistanceSq(playerPos, nexPoint.GetPosition()) < vector.DistanceSq(closestPoint.GetPosition(), nexPoint.GetPosition()))
238 secondaryPoint = nexPoint;
239 else
240 {
241 acco = closestPoint.EyeAccommodation;
242 forceAcco = true;
243 }
244 }
245
246 if (!forceAcco)
247 {
248 distanceToSecondary = vector.DistanceSq(playerPos, secondaryPoint.GetPosition());
249
250 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary); // progress
251 acco = Math.Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
252
253 if (points.Find(closestPoint) > points.Find(secondaryPoint))
254 m_LightingLerpTarget = closestPoint.LightLerp;
255 else
256 m_LightingLerpTarget = secondaryPoint.LightLerp;
257
258 }
259 }
260
262
264 {
265 if (m_LightingLerpTarget == 1)
266 {
268 m_AnimTimerLightBlend.Run(1, this, "OnUpdateTimerIn", "OnUpdateTimerEnd",0, false, LIGHT_BLEND_SPEED_IN);
269 }
270 else
271 {
273 m_AnimTimerLightBlend.Run(0, this, "OnUpdateTimerOut", "OnUpdateTimerEnd",m_LightingLerp, false, LIGHT_BLEND_SPEED_OUT);
274 }
275 }
276
277 #ifdef DIAG_DEVELOPER
278 if (DiagMenu.GetBool(DiagMenuIDs.UNDERGROUND_SHOW_BREADCRUMB))
279 {
280 Debug.DrawLine(m_Player.GetPosition() + "0 1 0", closestPoint.GetPosition(), COLOR_YELLOW, ShapeFlags.ONCE);
281 if (acco != accoMin && acco != accoMax)
282 Debug.DrawLine(closestPoint.GetPosition(), secondaryPoint.GetPosition(), COLOR_RED, ShapeFlags.ONCE);
283
284 DbgUI.Begin(String("Underground Areas"), 20, 20);
285 DbgUI.Text(String("Closest point id: " + points.Find(closestPoint)));
286 DbgUI.Text(String("Second closest id: " + points.Find(secondaryPoint)));
287 DbgUI.End();
288 }
289 #endif
290 }
DiagMenuIDs
Определения EDiagMenuIDs.c:2
DayZPlayer m_Player
Определения Hand_Events.c:42
ref AnimationTimer m_AnimTimerLightBlend
Определения UndergroundHandlerClient.c:19
UndergroundTrigger m_TransitionalTrigger
Определения UndergroundHandlerClient.c:34
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:
Определения tools.c:653
Определения DbgUI.c:60
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения Debug.c:319
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Определения Debug.c:382
Определения Debug.c:2
Определения EnDebug.c:233
Определения 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
Определения constants.c:64
const int COLOR_YELLOW
Определения 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().