=== modified file 'src/scene-buffer.cpp'
@@ -412,19 +412,11 @@
void
SceneBuffer::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
priv_->wave->update(elapsed_time);
-
- currentFrame_++;
}
void
=== modified file 'src/scene-build.cpp'
@@ -196,20 +196,11 @@
void
SceneBuild::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- rotation_ += rotationSpeed_ * dt;
-
- currentFrame_++;
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
+
+ rotation_ = rotationSpeed_ * elapsed_time;
}
void
=== modified file 'src/scene-bump.cpp'
@@ -314,20 +314,11 @@
void
SceneBump::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- rotation_ += rotationSpeed_ * dt;
-
- currentFrame_++;
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
+
+ rotation_ = rotationSpeed_ * elapsed_time;
}
void
=== modified file 'src/scene-desktop.cpp'
@@ -866,9 +866,8 @@
{
double current_time = Util::get_timestamp_us() / 1000000.0;
double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
- lastUpdateTime_ = current_time;
+ Scene::update();
std::vector<RenderObject *>& windows(priv_->windows);
@@ -903,13 +902,6 @@
if (should_update)
win->position(new_pos);
}
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- currentFrame_++;
}
void
=== modified file 'src/scene-effect-2d.cpp'
@@ -368,17 +368,7 @@
void
SceneEffect2D::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- currentFrame_++;
+ Scene::update();
}
void
=== modified file 'src/scene-grid.cpp'
@@ -93,20 +93,11 @@
void
SceneGrid::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- rotation_ += rotationSpeed_ * dt;
-
- currentFrame_++;
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
+
+ rotation_ = rotationSpeed_ * elapsed_time;
}
void
=== modified file 'src/scene-pulsar.cpp'
@@ -169,24 +169,15 @@
void
ScenePulsar::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
for (int i = 0; i < numQuads_; i++) {
- rotations_[i] += rotationSpeeds_[i] * (dt * 60);
+ rotations_[i] = rotationSpeeds_[i] * (elapsed_time * 60);
}
scale_ = vec3(cos(elapsed_time / 3.60) * 10.0, sin(elapsed_time / 3.60) * 10.0, 1.0);
-
- currentFrame_++;
}
void
=== modified file 'src/scene-shading.cpp'
@@ -265,20 +265,11 @@
void
SceneShading::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- rotation_ += rotationSpeed_ * dt;
-
- currentFrame_++;
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
+
+ rotation_ = rotationSpeed_ * elapsed_time;
}
void
=== modified file 'src/scene-texture.cpp'
@@ -158,20 +158,11 @@
void
SceneTexture::update()
{
- double current_time = Util::get_timestamp_us() / 1000000.0;
- double dt = current_time - lastUpdateTime_;
- double elapsed_time = current_time - startTime_;
-
- lastUpdateTime_ = current_time;
-
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
- running_ = false;
- }
-
- rotation_ += rotationSpeed_ * dt;
-
- currentFrame_++;
+ Scene::update();
+
+ double elapsed_time = lastUpdateTime_ - startTime_;
+
+ rotation_ = rotationSpeed_ * elapsed_time;
}
void
=== modified file 'src/scene.cpp'
@@ -88,6 +88,17 @@
void
Scene::update()
{
+ double current_time = Util::get_timestamp_us() / 1000000.0;
+ double elapsed_time = current_time - startTime_;
+
+ currentFrame_++;
+
+ lastUpdateTime_ = current_time;
+
+ if (elapsed_time >= duration_) {
+ averageFPS_ = currentFrame_ / elapsed_time;
+ running_ = false;
+ }
}
void