diff options
author | Stijn Buys <ingar@osirion.org> | 2011-03-30 16:39:27 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-03-30 16:39:27 +0000 |
commit | 2aea4a37f8007d429132b9b83da3dda7482be67e (patch) | |
tree | aec6ed7261759ec32b478d23fb7c77299f9e2e1b /src/render | |
parent | 4f5aa3b27c358815f2574ff65871e7ab291be597 (diff) |
Corrected func_move submodel instancing.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index ecabe21..c19dc39 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -671,13 +671,14 @@ void draw_model_fragments(model::Model *model, gl::scale(s, s, s); if (group->type() == model::FragmentGroup::Rotate) { - const float rotation_angle = math::degrees360f((group->engine() ? enginetime : core::game()->time()) * group->speed()); + const float rotation_angle = math::degrees360f((group->engine() ? enginetime : core::application()->time()) * group->speed()); gl::rotate(-rotation_angle, group->movement()); - } else if (group->type() == model::FragmentGroup::Move ) { - const float speed = group->distance() / group->speed(); // units per second + } else if (group->type() == model::FragmentGroup::Move ) { + + const float freq = group->speed() / group->distance(); math::Vector3f translation(group->movement() * group->distance()); - translation *= sinf((group->engine() ? enginetime : core::application()->time()) * M_PI * speed) * 0.5f + 0.5f; + translation *= sinf((group->engine() ? enginetime : core::application()->time()) * M_PI * freq) * 0.5f + 0.5f; gl::translate(translation); } |