182 {
184 JsonUndergroundAreaBreadcrumb startPoint = points[0];
185 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
187
188 bool forceAcco;
189 float acco;
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)
199 {
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
220 #endif
221 }
222
223 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
224
225 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
226 acco = accoMax;
227 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
228 acco = accoMin;
229 else
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];
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);
252 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
253
254 if (points.Find(closestPoint) > points.Find(secondaryPoint))
256 else
258
259 }
260 }
261
263
265 {
267 {
270 }
271 else
272 {
275 }
276 }
277
278 #ifdef DIAG_DEVELOPER
280 {
282 if (acco != accoMin && acco != accoMax)
284
287 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
289 }
290 #endif
291 }
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'.