Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model.cc')
-rw-r--r--src/core/model.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/core/model.cc b/src/core/model.cc
index da179e5..88a1040 100644
--- a/src/core/model.cc
+++ b/src/core/model.cc
@@ -247,6 +247,11 @@ Model::Model(std::string const & name) :
ifs.close();
if (model_face.size()) {
+ if (model_maxbbox.lengthsquared() > model_minbbox.lengthsquared()) {
+ model_radius = model_maxbbox.length();
+ } else {
+ model_radius = model_minbbox.length();
+ }
model_valid = true;
}
con_debug << " maps/" << name << ".map " << model_face.size() << " polygons\n";
@@ -502,18 +507,17 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
Face *mf = new Face(face->normal()*-1, color);
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
mf->add_vertex(*(*it) * model_scale);
- }
- add_face(mf);
- /*
- mf->add_vertex(*(*vn) * model_scale);
- mf->add_vertex(*(*v0) * model_scale);
- mf->add_vertex(*(*vn1) * model_scale);
- add_face(mf);
+
+ // bounding box
+ for (int i=0; i < 3; i++) {
+ if (model_maxbbox[i] < (*(*it))[i] * model_scale)
+ model_maxbbox[i] = (*(*it))[i] * model_scale;
- vl.pop_back();
+ if (model_minbbox[i] > (*(*it))[i] * model_scale)
+ model_minbbox[i] = (*(*it))[i] * model_scale;
+ }
}
- */
-
+ add_face(mf);
if (color) delete color;
} else {
con_debug << "Unresolved face!\n";