aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Schultz <karl@lunarg.com>2017-08-15 09:08:53 -0600
committerKarl Schultz <karl@lunarg.com>2017-08-15 13:16:25 -0600
commitb3592ed213574b97c458dc6b8243c1abac44105b (patch)
treefceaf171e71f35dd386d969264e4e95bc5a83e50
parentb01a770355a7ad7c67c8f14e5f948f451efac3b2 (diff)
downloadusermoji-b3592ed213574b97c458dc6b8243c1abac44105b.tar.xz
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
-rw-r--r--demos/smoke/Simulation.cpp1
1 files changed, 1 insertions, 0 deletions
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<float> origin(0.0f, 2.0f);