diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 30271f5..1e166b3 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -608,10 +608,16 @@ void draw_model_fragments(model::Model *model, if (group->type() == model::FragmentGroup::Rotate) { const float rotation_angle = math::degrees360f((group->engine() ? enginetime : core::application()->time()) * group->speed()); gl::rotate(-rotation_angle, group->axis().forward()); - } else { + + } else if (group->type() == model::FragmentGroup::Move ) { + const float speed = group->distance() / group->speed(); // units per second + math::Vector3f translation(group->axis().forward() * group->distance()); + translation *= sinf((group->engine() ? enginetime : core::application()->time()) * M_PI * speed) * 0.5f + 0.5f; + gl::translate(translation); + } else { gl::multmatrix(group->axis()); } - + const float s = group->scale(); if (s) gl::scale(s, s, s); |