From 5e4826a6fa493e4293d63ce71a0f1c9faec16ea7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 24 Mar 2011 16:07:39 +0000 Subject: Corrected position for light, flares and other entities imported through submodels. --- src/model/mapfile.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 979eb38..5f2d46f 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1770,10 +1770,10 @@ Model * MapFile::load(std::string const &name) } if (submodel_model) { - // apply model origin translation to the submodel tag location + // 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 the origin + // 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()); @@ -1836,7 +1836,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_light->location() * tag_submodel->scale()); + tag_light->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_light->location() * tag_submodel->scale() ); tag_light->set_radius(tag_light->radius() * tag_submodel->scale()); model->add_light(tag_light); } @@ -1844,7 +1844,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_flare->location() * tag_submodel->scale()); + tag_flare->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_flare->location() * tag_submodel->scale()); tag_flare->set_radius(tag_flare->radius() * tag_submodel->scale()); model->add_flare(tag_flare); } @@ -1852,7 +1852,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_particles->location() * tag_submodel->scale()); + tag_particles->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_particles->location() * tag_submodel->scale()); tag_particles->set_scale(tag_particles->scale() * tag_submodel->scale()); model->add_particles(tag_particles); } @@ -1860,13 +1860,13 @@ 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_sound->location() * tag_submodel->scale()); + tag_sound->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_sound->location() * 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_dock->location() * tag_submodel->scale()); + tag_dock->get_location().assign(tag_submodel->location() + tag_submodel->axis() * tag_dock->location() * tag_submodel->scale()); } //con_debug << " imported submodel '" << submodel->name() << "'" << std::endl; } -- cgit v1.2.3