File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -166,12 +166,19 @@ class OpenGLUnderlay
166166 auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
167167 std::chrono::steady_clock::now () - start_time);
168168 glUniform1f (effect_time_location, elapsed.count ());
169+
170+ // Handle the rotation and freezing of rotation via the UI toggle.
169171 if (enable_rotation) {
170- glUniform1f (rotation_time_location, elapsed.count ());
171- } else {
172- glUniform1f (rotation_time_location, 0.0 );
172+ if (!last_rotation_enabled) {
173+ rotation_pause_offset = elapsed.count () - rotation_time;
174+ }
175+ rotation_time = elapsed.count () - rotation_pause_offset;
173176 }
174177
178+ glUniform1f (rotation_time_location, rotation_time);
179+
180+ last_rotation_enabled = enable_rotation;
181+
175182 glDrawArrays (GL_TRIANGLE_STRIP, 0 , 4 );
176183 glUseProgram (0 );
177184 }
@@ -185,6 +192,9 @@ class OpenGLUnderlay
185192 GLuint rotation_time_location = 0 ;
186193 std::chrono::time_point<std::chrono::steady_clock> start_time =
187194 std::chrono::steady_clock::now ();
195+ double rotation_time = 0.0 ;
196+ bool last_rotation_enabled = true ;
197+ double rotation_pause_offset = 0.0 ;
188198};
189199
190200int main ()
You can’t perform that action at this time.
0 commit comments