From b3592ed213574b97c458dc6b8243c1abac44105b Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Tue, 15 Aug 2017 09:08:53 -0600 Subject: demos: Fix disappearing objects in smoketest When an object reaches the end of its "curve" path it receives a new curve. To ease the transition from the old curve to the new curve, the origin of the new curve is the ending point of the old curve. However, this can result in the starting point of the new curve being out of the view. This results in objects slowing leaving the view. Add code to move the origin of the new curve back inside the original view bounds only if the end of the old curve is out of the view bounds. This does not add any additional jarring because any object getting a new origin is already outside the view anyway. Change-Id: I50e88be453f31b9c37878f63c97d4c7c8154e718 --- demos/smoke/Simulation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/smoke/Simulation.cpp b/demos/smoke/Simulation.cpp index 35a4101d..cc5fbabf 100644 --- a/demos/smoke/Simulation.cpp +++ b/demos/smoke/Simulation.cpp @@ -206,6 +206,7 @@ void Path::generate_subpath() { if (current_.curve) { current_.origin += current_.curve->evaluate(current_.end - current_.start); + current_.origin = glm::mod(current_.origin, glm::vec3(2.0f)); current_.start = current_.end; } else { std::uniform_real_distribution origin(0.0f, 2.0f); -- cgit v1.2.3