Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-03-24 14:14:38 +0000
committerStijn Buys <ingar@osirion.org>2011-03-24 14:14:38 +0000
commit397c496826bb314849cdd3c9a3fa610388b29b8f (patch)
tree378cdd34a7cda9a49361cee8e429e49bf790ae00 /src
parentf875dbe0d629acbe3d27c0552016a7b594843c36 (diff)
Corrected rotated submodel locations.
Diffstat (limited to 'src')
-rw-r--r--src/model/mapfile.cc11
1 files changed, 7 insertions, 4 deletions
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