From 397c496826bb314849cdd3c9a3fa610388b29b8f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 24 Mar 2011 14:14:38 +0000 Subject: Corrected rotated submodel locations. --- src/model/mapfile.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/model') diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 7efd44b..979eb38 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1770,7 +1770,8 @@ Model * MapFile::load(std::string const &name) } if (submodel_model) { - tag_submodel->get_location() -= submodel_model->origin() * tag_submodel->scale(); + // apply model origin translation to the submodel tag location + tag_submodel->get_location() -= tag_submodel->axis() * submodel_model->origin() * tag_submodel->scale(); // adjust the submodel bounding box to the origin const math::Vector3f min((submodel_model->model_box.min() - submodel_model->origin()) * tag_submodel->scale()); @@ -1788,8 +1789,8 @@ Model * MapFile::load(std::string const &name) cube[7].assign(max.x(), max.y(), max.z()); for (size_t i = 0; i < 8; i++) { - // rotate the bounding box around the origin - mapfile.map_box.expand(tag_submodel->location() + tag_submodel->axis() * cube[i] + submodel_model->origin() * tag_submodel->scale()); + // rotate the bounding box around the submodel origin + mapfile.map_box.expand(tag_submodel->location() + tag_submodel->axis() * cube[i]); } // copy fragmentgroups @@ -1802,7 +1803,9 @@ Model * MapFile::load(std::string const &name) groupdst->set_scale(groupsrc->scale() * tag_submodel->scale()); groupdst->set_engine(groupsrc->engine()); groupdst->set_speed(groupsrc->speed()); - groupdst->set_location(tag_submodel->location() + groupsrc->location() * tag_submodel->scale()); + + groupdst->set_location(tag_submodel->location() + tag_submodel->axis() * groupsrc->location() * tag_submodel->scale()); + groupdst->set_axis(groupsrc->axis() * tag_submodel->axis()); // copy fragments, this only copies the original fragment's pointer into the vertex array -- cgit v1.2.3