diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/model.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/render/model.cc b/src/render/model.cc index f048b7f..5019c7e 100644 --- a/src/render/model.cc +++ b/src/render/model.cc @@ -135,7 +135,7 @@ Model::Model(std::string const & name) : ifs.close(); - con_debug << "Loaded model " << name << " with " << model_face.size() << " polygons\n"; + con_debug << " maps/" << name << ".map " << model_face.size() << " polygons\n"; } Model::~Model() @@ -165,10 +165,10 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes vl.push_back(new math::Vector3f(0, -MAX_BOUNDS, MAX_BOUNDS)); vl.push_back(new math::Vector3f(0, MAX_BOUNDS, MAX_BOUNDS)); vl.push_back(new math::Vector3f(0, MAX_BOUNDS, -MAX_BOUNDS)); - + // calculate the x coordinate of each face vertex for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->x = ( face->d() - + (*it)->x = ( -face->d() - face->normal().z * (*it)->z - face->normal().y * (*it)->y ) / face->normal().x; @@ -185,7 +185,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes // calculate the x coordinate of each face vertex for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->y = ( face->d() - + (*it)->y = ( -face->d() - face->normal().z * (*it)->z - face->normal().x * (*it)->x ) / face->normal().y; @@ -202,7 +202,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes // calculate the x coordinate of each face vertex for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->z = ( face->d() - + (*it)->z = ( -face->d() - face->normal().x * (*it)->x - face->normal().y * (*it)->y ) / face->normal().z; @@ -289,10 +289,10 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes // calculate intersection // calculate intersection - float t1 = -plane->normal().x * next.x - plane->normal().y * next.y - plane->normal().z * next.z -plane->d(); - float t2 = (plane->normal().x * v.x - plane->normal().x * next.x + - plane->normal().y * v.y - plane->normal().y * next.y + - plane->normal().z * v.z - plane->normal().z * next.z); + float t1 = -plane->normal().x * v.x - plane->normal().y * v.y - plane->normal().z * v.z -plane->d(); + float t2 = (plane->normal().x * next.x - plane->normal().x * v.x + + plane->normal().y * next.y - plane->normal().y * v.y + + plane->normal().z * next.z - plane->normal().z * v.z); //cout << "next t2 " << t2 << std::endl; Vector3f *s = new Vector3f; @@ -300,7 +300,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes *s = v; } else { for (int j = 0; j < 3; j++) - (*s)[j] = next [j] + t1 * ( v[j] - next[j]) / t2; + (*s)[j] = v [j] + t1 * ( next[j] - v[j]) / t2; } //cout << " added " << *s << std::endl; |