From d763e294f44eb38b94bf7e2055b77a982b72b7c0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 16 Aug 2009 17:34:00 +0000 Subject: more constness --- src/model/asefile.cc | 6 ++--- src/model/face.cc | 4 ++-- src/model/fragment.cc | 2 +- src/model/mapfile.cc | 66 +++++++++++++++++++++++++-------------------------- 4 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/model') diff --git a/src/model/asefile.cc b/src/model/asefile.cc index 664a3f7..17169f4 100644 --- a/src/model/asefile.cc +++ b/src/model/asefile.cc @@ -270,11 +270,11 @@ size_t count = 0; math::Vector3f *t2 = ase_tvertexlist[c]; if (triangle) { if (t0) - triangle->t0().assign(t0->x, 1.0f - t0->y); + triangle->t0().assign(t0->x(), 1.0f - t0->y()); if (t1) - triangle->t1().assign(t1->x, 1.0f - t1->y); + triangle->t1().assign(t1->x(), 1.0f - t1->y()); if (t2) - triangle->t2().assign(t2->x, 1.0f - t2->y); + triangle->t2().assign(t2->x(), 1.0f - t2->y()); } count++; } diff --git a/src/model/face.cc b/src/model/face.cc index c6c3269..7626fac 100644 --- a/src/model/face.cc +++ b/src/model/face.cc @@ -28,7 +28,7 @@ Face::Face(Vector3f const & point0, Vector3f const &point1, Vector3f const &poin face_point[2] = point2; face_normal = crossproduct((face_point[1] - face_point[0]) , (face_point[2] - face_point[0])); - pd = -1 * (face_normal.x * face_point[0].x + face_normal.y * face_point[0].y + face_normal.z * face_point[0].z); + pd = -1 * (face_normal.x() * face_point[0].x() + face_normal.y() * face_point[0].y() + face_normal.z() * face_point[0].z()); } Face::Face(Face const & other) @@ -37,7 +37,7 @@ Face::Face(Face const & other) this->face_point[i] = other.face_point[i]; face_normal = crossproduct((face_point[1] - face_point[0]) , (face_point[2] - face_point[0])); - pd = -1 * (face_normal.x * face_point[0].x + face_normal.y * face_point[0].y + face_normal.z * face_point[0].z); + pd = -1 * (face_normal.x() * face_point[0].x() + face_normal.y() * face_point[0].y() + face_normal.z() * face_point[0].z()); } } diff --git a/src/model/fragment.cc b/src/model/fragment.cc index 8c3481c..ab0f9fa 100644 --- a/src/model/fragment.cc +++ b/src/model/fragment.cc @@ -48,7 +48,7 @@ size_t Fragment::add_vertex(math::Vector3f const & vertex, math::Vector3f const size_t Fragment::add_vertex(math::Vector3f const & vertex, math::Vector3f const &normal, math::Vector2f const &texcoord, bool detail) { - size_t n = VertexArray::instance()->add_vertex(vertex, normal, texcoord.x, texcoord.y); + size_t n = VertexArray::instance()->add_vertex(vertex, normal, texcoord.x(), texcoord.y()); if (n) { if (detail) fragment_detail_size += n; diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 54f6d78..cc96051 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -131,8 +131,8 @@ void face_texture_verts(Face &face, const math::Vector2f &tex_shift, const float const math::Vector2f map_texture_coords(Face *face, const math::Vector3f &v) { return math::Vector2f ( - (face->tex_shift().x + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(), - (face->tex_shift().y + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height() + (face->tex_shift().x() + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(), + (face->tex_shift().y() + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height() ); } @@ -446,9 +446,9 @@ void MapFile::make_brushface(Face *face) // calculate initial vertices on the bounding box // check if the face is x-axis oriented - if ((fabsf(face->normal().x) >= fabsf(face->normal().y)) && (fabsf(face->normal().x) >= fabsf(face->normal().z))) { + if ((fabsf(face->normal().x()) >= fabsf(face->normal().y())) && (fabsf(face->normal().x()) >= fabsf(face->normal().z()))) { - if (face->normal().x > MIN_DELTA) { + if (face->normal().x() > MIN_DELTA) { 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)); @@ -461,17 +461,17 @@ void MapFile::make_brushface(Face *face) } // calculate the x coordinate of each face vertex for (std::vector::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->x = (-face->d() - - face->normal().z * (*it)->z - - face->normal().y * (*it)->y) / - face->normal().x; + (*it)->get_x() = (-face->d() - + face->normal().z() * (*it)->z() - + face->normal().y() * (*it)->y()) / + face->normal().x(); } } // check if the face is y-axis oriented - else if ((fabsf(face->normal().y) >= fabsf(face->normal().x)) && (fabsf(face->normal().y) >= fabsf(face->normal().z))) { + else if ((fabsf(face->normal().y()) >= fabsf(face->normal().x())) && (fabsf(face->normal().y()) >= fabsf(face->normal().z()))) { - if (face->normal().y > MIN_DELTA) { + if (face->normal().y() > MIN_DELTA) { vl.push_back(new Vector3f(MAX_BOUNDS, 0, -MAX_BOUNDS)); vl.push_back(new Vector3f(MAX_BOUNDS, 0, MAX_BOUNDS)); vl.push_back(new Vector3f(-MAX_BOUNDS, 0, MAX_BOUNDS)); @@ -485,17 +485,17 @@ void MapFile::make_brushface(Face *face) // calculate the x coordinate of each face vertex for (std::vector::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->y = (-face->d() - - face->normal().z * (*it)->z - - face->normal().x * (*it)->x) / - face->normal().y; + (*it)->get_y() = (-face->d() - + face->normal().z() * (*it)->z() - + face->normal().x() * (*it)->x()) / + face->normal().y(); } } // face must be z-axis oriented else { - if (face->normal().z > MIN_DELTA) { + if (face->normal().z() > MIN_DELTA) { vl.push_back(new Vector3f(-MAX_BOUNDS, -MAX_BOUNDS, 0)); vl.push_back(new Vector3f(-MAX_BOUNDS, MAX_BOUNDS, 0)); vl.push_back(new Vector3f(MAX_BOUNDS, MAX_BOUNDS, 0)); @@ -509,10 +509,10 @@ void MapFile::make_brushface(Face *face) // calculate the x coordinate of each face vertex for (std::vector::iterator it = vl.begin(); it != vl.end(); it++) { - (*it)->z = (-face->d() - - face->normal().x * (*it)->x - - face->normal().y * (*it)->y) / - face->normal().z; + (*it)->get_z() = (-face->d() - + face->normal().x() * (*it)->x() - + face->normal().y() * (*it)->y()) / + face->normal().z(); } } @@ -529,7 +529,7 @@ void MapFile::make_brushface(Face *face) Vector3f pn = crossproduct(plane->point(1)-plane->point(0), plane->point(2)-plane->point(0)); Vector3f t = crossproduct(fn, pn); - if ((t.x == 0) && (t.y == 0) && (t.z == 0)) { + if ((t.x() == 0) && (t.y() == 0) && (t.z() == 0)) { continue; } @@ -552,7 +552,7 @@ void MapFile::make_brushface(Face *face) prev = *vl.back(); } - if ((v.x*plane->normal().x + v.y*plane->normal().y + v.z*plane->normal().z +plane->d()) < MIN_DELTA) { + if ((v.x() * plane->normal().x() + v.y() * plane->normal().y() + v.z() * plane->normal().z() + plane->d()) < MIN_DELTA) { // find current std::vector::iterator vit = vl.begin(); @@ -561,14 +561,14 @@ void MapFile::make_brushface(Face *face) } // check if prev - v intersects with plane - if ((prev.x*plane->normal().x + prev.y*plane->normal().y + prev.z*plane->normal().z + plane->d()) > MIN_DELTA) { + if ((prev.x() * plane->normal().x() + prev.y() * plane->normal().y() + prev.z() * plane->normal().z() + plane->d()) > MIN_DELTA) { // calculate intersection - float t1 = -plane->normal().x * prev.x - plane->normal().y * prev.y - plane->normal().z * prev.z -plane->d(); - float t2 = (plane->normal().x * v.x - plane->normal().x * prev.x + - plane->normal().y * v.y - plane->normal().y * prev.y + - plane->normal().z * v.z - plane->normal().z * prev.z); - + float t1 = -plane->normal().x() * prev.x() - plane->normal().y() * prev.y() - plane->normal().z() * prev.z() -plane->d(); + float t2 = (plane->normal().x() * v.x() - plane->normal().x() * prev.x() + + plane->normal().y() * v.y() - plane->normal().y() * prev.y() + + plane->normal().z() * v.z() - plane->normal().z() * prev.z()); + Vector3f *s = new Vector3f; if (t2 == 0) { @@ -584,14 +584,14 @@ void MapFile::make_brushface(Face *face) } // check if next - v intersects with plane - if ((next.x*plane->normal().x + next.y*plane->normal().y + next.z*plane->normal().z + plane->d()) > MIN_DELTA) { + if ((next.x() * plane->normal().x() + next.y() * plane->normal().y() + next.z() * plane->normal().z() + plane->d()) > MIN_DELTA) { // calculate intersection - 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; + 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()); + Vector3f *s = new Vector3f; if (t2 == 0) { -- cgit v1.2.3