Rise
The Vieneo Province
Loading...
Searching...
No Matches
LoadingEyeReveal.h
Go to the documentation of this file.
1#pragma once
2#include <algorithm>
3#include <cmath>
4
5// The loading eye starts inside the pupil and pulls back over 78 seconds.
6// Use an absolute monotonic clock: resource loading can reset the frame clock,
7// and a shader preparation stall can span several seconds between draws.
9{
10public:
11 float Progress(double now)
12 {
13 if (!std::isfinite(now)) return progress;
14 if (started < 0) started = now;
15 progress = (std::max)(progress, float((std::clamp)((now - started) / 78.0, 0.0, 1.0)));
16 return progress;
17 }
18 void Reset() { started = -1; progress = 0; }
19private:
20 double started = -1;
21 float progress = 0;
22};
float Progress(double now)