diff options
author | Stijn Buys <ingar@osirion.org> | 2011-03-27 15:19:19 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-03-27 15:19:19 +0000 |
commit | 6c2075993d68dbacf011756508f957cea1bde845 (patch) | |
tree | c97f2707eb5d36ee33a785139f6ce9e1eb8272a1 /src/render | |
parent | bf84493becfe1a08e9cb906fb85c7268c3a6c910 (diff) |
Corrected rotating fragmentgroups imported from submodels.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 48e53a2..ecabe21 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -662,30 +662,26 @@ void draw_model_fragments(model::Model *model, for (model::Model::Groups::const_iterator git = model->groups().begin(); git != model->groups().end(); git++) { const model::FragmentGroup *group = (*git); + gl::push(); - if (group->transform()) { - gl::push(); - - gl::translate(group->location()); - - 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 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()); - } + gl::translate(group->location()); + gl::multmatrix(group->axis()); + const float s = group->scale(); + if (s) + 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()); + gl::rotate(-rotation_angle, group->movement()); - const float s = group->scale(); - if (s) - gl::scale(s, s, s); + } else if (group->type() == model::FragmentGroup::Move ) { + const float speed = group->distance() / group->speed(); // units per second + math::Vector3f translation(group->movement() * group->distance()); + translation *= sinf((group->engine() ? enginetime : core::application()->time()) * M_PI * speed) * 0.5f + 0.5f; + gl::translate(translation); } + for (model::FragmentGroup::Fragments::const_iterator fit = group->fragments().begin(); fit != group->fragments().end(); fit++) { const model::Fragment *fragment = (*fit); @@ -861,9 +857,7 @@ void draw_model_fragments(model::Model *model, } } - if (group->transform()) { - gl::pop(); - } + gl::pop(); } if (!use_light) { |