From 95b3f5993151db7607f69132adc604e27e0f55ce Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 11 Aug 2009 12:40:08 +0000 Subject: implements misc_model rotation angle --- src/render/draw.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/render/draw.cc') diff --git a/src/render/draw.cc b/src/render/draw.cc index 339f127..e800d62 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -584,23 +584,19 @@ void draw_model_fragments(model::Model *model, if (group->transform()) { gl::push(); - //gl::translate(group->location()); - // FIXME this will go wrong if a Rotate group is imported as submodel + + gl::translate(group->location()); + if (group->type() == model::FragmentGroup::Rotate) { - gl::translate(group->location()); float rotation_angle = math::degrees360f(core::application()->time() * group->speed()); gl::rotate(-rotation_angle, group->axis().forward()); - gl::translate(group->location()* -1.0f); - } else { - float s = group->scale(); - if (s == 0.0f) - s = 1.0f; - gl::scale(s, s, s); - gl::translate(group->location() / s); + } else { + gl::multmatrix(group->axis()); } - - + const float s = group->scale(); + if (s) + gl::scale(s, s, s); } for (model::FragmentGroup::iterator fit = group->begin(); fit != group->end(); fit++) { -- cgit v1.2.3