Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-03-27 14:28:52 +0000
committerStijn Buys <ingar@osirion.org>2011-03-27 14:28:52 +0000
commitbf84493becfe1a08e9cb906fb85c7268c3a6c910 (patch)
treed233f1ab1abd79b4d608180f0fafd74ca73d106e /src/model
parent5e4826a6fa493e4293d63ce71a0f1c9faec16ea7 (diff)
Corrected the axis for rotated fragmentgroups of rotated sub-models.
Diffstat (limited to 'src/model')
-rw-r--r--src/model/mapfile.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index 5f2d46f..698a0f6 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1770,9 +1770,6 @@ Model * MapFile::load(std::string const &name)
}
if (submodel_model) {
- // apply submodel 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 its origin
const math::Vector3f min((submodel_model->model_box.min() - submodel_model->origin()) * tag_submodel->scale());
const math::Vector3f max((submodel_model->model_box.max() - submodel_model->origin()) * tag_submodel->scale());
@@ -1804,9 +1801,8 @@ Model * MapFile::load(std::string const &name)
groupdst->set_engine(groupsrc->engine());
groupdst->set_speed(groupsrc->speed());
- groupdst->set_location(tag_submodel->location() + tag_submodel->axis() * groupsrc->location() * tag_submodel->scale());
-
- groupdst->set_axis(groupsrc->axis() * tag_submodel->axis());
+ groupdst->set_location(tag_submodel->location() + tag_submodel->axis() * (groupsrc->location() - submodel_model->origin()) * tag_submodel->scale());
+ groupdst->set_axis(tag_submodel->axis() * groupsrc->axis());
// copy fragments, this only copies the original fragment's pointer into the vertex array
for (FragmentGroup::Fragments::const_iterator fit = groupsrc->fragments().begin(); fit != groupsrc->fragments().end(); fit++) {
@@ -1836,7 +1832,7 @@ Model * MapFile::load(std::string const &name)
// copy light tags
for (Model::Lights::const_iterator lit = submodel_model->lights().begin(); lit != submodel_model->lights().end(); lit++) {
tag_light = new Light(*(*lit));
- tag_light->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_light->location() * tag_submodel->scale() );
+ tag_light->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_light->location() - submodel_model->origin()) * tag_submodel->scale());
tag_light->set_radius(tag_light->radius() * tag_submodel->scale());
model->add_light(tag_light);
}
@@ -1844,7 +1840,7 @@ Model * MapFile::load(std::string const &name)
// copy flare tags
for (Model::Flares::const_iterator flit = submodel_model->flares().begin(); flit != submodel_model->flares().end(); flit++) {
tag_flare = new Flare(*(*flit));
- tag_flare->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_flare->location() * tag_submodel->scale());
+ tag_flare->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_flare->location() - submodel_model->origin()) * tag_submodel->scale());
tag_flare->set_radius(tag_flare->radius() * tag_submodel->scale());
model->add_flare(tag_flare);
}
@@ -1852,7 +1848,7 @@ Model * MapFile::load(std::string const &name)
// copy particle system tags
for (Model::ParticleSystems::const_iterator pit = submodel_model->particles().begin(); pit != submodel_model->particles().end(); pit++) {
tag_particles = new Particles(*(*pit));
- tag_particles->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_particles->location() * tag_submodel->scale());
+ tag_particles->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_particles->location() - submodel_model->origin()) * tag_submodel->scale());
tag_particles->set_scale(tag_particles->scale() * tag_submodel->scale());
model->add_particles(tag_particles);
}
@@ -1860,15 +1856,14 @@ Model * MapFile::load(std::string const &name)
// copy sound tags
for (Model::Sounds::const_iterator sit = submodel_model->sounds().begin(); sit != submodel_model->sounds().end(); sit++) {
tag_sound = new Sound(*(*sit));
- tag_sound->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_sound->location() * tag_submodel->scale());
+ tag_sound->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_sound->location() - submodel_model->origin()) * tag_submodel->scale());
}
// copy dock tags
for (Model::Docks::const_iterator dit = submodel_model->docks().begin(); dit != submodel_model->docks().end(); dit++) {
tag_dock = new Dock(*(*dit));
- tag_dock->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_dock->location() * tag_submodel->scale());
+ tag_dock->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_dock->location() - submodel_model->origin()) * tag_submodel->scale());
}
- //con_debug << " imported submodel '" << submodel->name() << "'" << std::endl;
}
delete tag_submodel;
}