From 924c366a6ae1747f8cd75403d9028a1a07fe8bb3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 1 Feb 2015 22:18:19 +0000 Subject: Corrected a bug where submodel tags where not rotated according to the submodel axis. --- src/model/mapfile.cc | 3 +++ src/model/tags.h | 10 ++++++++++ 2 files changed, 13 insertions(+) (limited to 'src/model') diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 9cdb23e..05cea2a 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -2075,6 +2075,7 @@ Model * MapFile::load(std::string const &name) 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() - submodel_model->origin()) * tag_submodel->scale()); + tag_flare->set_axis(tag_submodel->axis() * tag_flare->axis()); tag_flare->set_radius(tag_flare->radius() * tag_submodel->scale()); model->add_flare(tag_flare); } @@ -2083,6 +2084,7 @@ Model * MapFile::load(std::string const &name) 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() - submodel_model->origin()) * tag_submodel->scale()); + tag_particles->set_axis(tag_submodel->axis() * tag_particles->axis()); tag_particles->set_scale(tag_particles->scale() * tag_submodel->scale()); model->add_particles(tag_particles); } @@ -2098,6 +2100,7 @@ Model * MapFile::load(std::string const &name) for (Model::Slots::const_iterator slit = submodel_model->slots().begin(); slit != submodel_model->slots().end(); ++slit) { tag_slot = new Slot(*(*slit)); tag_slot->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_slot->location() - submodel_model->origin()) * tag_submodel->scale()); + tag_slot->set_axis(tag_submodel->axis() * tag_slot->axis()); model->add_slot(tag_slot); } } diff --git a/src/model/tags.h b/src/model/tags.h index 775dc73..7e4a9de 100644 --- a/src/model/tags.h +++ b/src/model/tags.h @@ -376,6 +376,11 @@ public: { flare_cull = cull; } + + inline void set_axis(const math::Axis& axis) + { + flare_axis.assign(axis); + } /* ---- actors --------------------------------------------- */ @@ -521,6 +526,11 @@ public: particles_has_color = true; } + inline void set_axis(const math::Axis& axis) + { + particles_axis.assign(axis); + } + /* ---- actors --------------------------------------------- */ /** -- cgit v1.2.3