181 {
183 JsonUndergroundAreaBreadcrumb startPoint = points[0];
184 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
186
187 bool forceAcco;
188 float acco;
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)
198 {
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
219 #endif
220 }
221
222 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
223
224 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
225 acco = accoMax;
226 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
227 acco = accoMin;
228 else
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];
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);
251 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
252
253 if (points.Find(closestPoint) > points.Find(secondaryPoint))
255 else
257
258 }
259 }
260
262
264 {
266 {
269 }
270 else
271 {
274 }
275 }
276
277 #ifdef DIAG_DEVELOPER
279 {
281 if (acco != accoMin && acco != accoMax)
283
286 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
288 }
289 #endif
290 }
ref AnimationTimer m_AnimTimerLightBlend
UndergroundTrigger m_TransitionalTrigger
const float ACCO_MODIFIER
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
float m_LightingLerpTarget
const float LIGHT_BLEND_SPEED_OUT
AnimationTimer class. This timer is for animating float value. usage:
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
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.
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)
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.