Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r--src/model/mapfile.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index fd82036..9badc9b 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -2045,11 +2045,25 @@ Model * MapFile::load(std::string const &name)
model->set_origin(map_center * -1.0f);
// translate transformed vertex groups
+ size_t frags = 0;
for (Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
FragmentGroup *fragmentgroup = (*git);
fragmentgroup->set_location(fragmentgroup->location() - map_center);
+ frags += fragmentgroup->size();
}
+ // set a sane radius if the mapfile is empty
+ if (frags == 0) {
+ const float r = SCALE;
+ model->model_box.assign(
+ math::Vector3f(-r, -r, -r),
+ math::Vector3f(r, r, r)
+
+ );
+ model->set_radius(model->box().max().length());
+ }
+
+
// translate tags
for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) {
(*lit)->get_location() -= map_center;
@@ -2074,7 +2088,7 @@ Model * MapFile::load(std::string const &name)
for (Model::Weapons::iterator wit = model->weapons().begin(); wit != model->weapons().end(); wit++) {
(*wit)->get_location() -= map_center;
}
-
+
if (mapfile.warning_q2brush)
con_warn << mapfile.name() << " quake2 style brushes detected" << std::endl;